Hello everyone.
I’m trying to instantiate a VHDL block that has 2 generics and one of them is a record type.
entity block_top is
generic
(
constant ENABLE_g : std_logic := '0';
constant REGS_DEFAULT_g : REGS_t := REGS_DEFAULT_c
);
port
( ...
type REGS_t is record
ADDR : std_logic_vector(15 downto 00);
LENGTH : std_logic_vector(15 downto 00);
...
I’ve tried importing the REGS_t to my TB module and created an object of that type and used this object as a parameter:
parameter bit[15:0] ADDR_p;
parameter bit[15:0] LENGTH_p;
regs_t generics;
initial
begin
generics.ADDR = ADDR_p;
generics.LENGTH = LENGTH_p;
end
\block.block_top #(
.enable_g (3'b011),
.regs_default_g (generics)
)
block_top
( ...
But this gives me a error saying that that parameter needs to be constant. I also need to parameterize the fields of the record (ADDR, LENGTH) to implement testcases with different generics values. I’m avoiding making a wrapper to break that record and I’m wondering if there is another way to instantiate that generic. Thank you!