I have part of a register that looks something like this
register CC {
field CSS @ [6:4] is write {
method write(uint64 value) {
if (CC.EN.val == 0b1) {
log spec_viol: "Command set selection should not " +
"occur when controller has been enabled.";
return;
}
default(value);
}
}
field EN @ [0];
}
How can I ensure that when CC.EN is set to 1 (for the first time) by setting the value of the register CC, that the spec-viol in CC.CSS does not occur?
I tried writing to the register for the first time and the spec-viol was triggered
Fields in a register in DML are accessed in order of increasing least significant bit. This means that in your example, the
ENfield will be written before theCCSfield. So to achieve this we must pass the state ofENbefore the write to the register. We do this by utilizing thevoid *auxargument in thewrite_registerandwrite_fieldtemplates: