Is is possible to define something like OOP-style instance method for a record in VHDL to be recognized by XST?
For a record type rectangle:
type rectangle is record
x : integer;
y : integer;
width : integer;
height : integer;
end record;
I’d like to define methods like is_square, get_area, etc.
Can it be done using attributes?
No, but you can get close with
protectedtypes.Here’s an example, taken from Protected Shared Variables in VHDL: IEEE Std 1076a
I have no idea if the concept of a protected type is synthesisable with XST though.