Add functions for setting/getting register field values
When writing testbenches, we often have to set/get the value of single fields within a variable representing the value of a register.
Currently, the only way to do that is to use the <register><field>BITOFFSET and <register><field>BITWIDTH from the VHDL/SV packages:
MemRegv(CTRLDURATIONBITWIDTH + CTRLDURATIONBITOFFSET - 1 downto CTRLDURATIONBITOFFSET) := "1000";
I would be nice to have a "setregisterfield" function for that, which could take the register and field names as arguments:
MemRegv := setregisterfield("CTRL", "DURATION", "1000", MemRegv);
2
votes
AdminGuy Eschemann
(Manager, airhdl)
shared this idea