samedi 4 mai 2019

Randomizing and then constraining bits

I am trying to verify a CPU and I need to make some constraints for a NOOP instruction. Basically if the upper 4 bits (of a 16 bit instruction are set to 4'h0 then the remaining 12 bits need to be set to 12'h000 after randomization.

I am able to find if the upper 4 bits are 4'h0 but when I force the lower bits to 12'h000 instead a new instruction gets generated.

class cpu_transaction;
    static int next_ID;
    const int ID;
    const cpu_stream owner;
    rand RRR_type RRR_value;
    rand generic_type generic_value;


    constraint c_NOOP_all_zero { generic_value[15:12] == 4'h0 -> generic_value[11:0] == 12'h000;}

I expect that once the upper 4 bits are 4'h0 then the lower 12 bits are 12'h000.




Aucun commentaire:

Enregistrer un commentaire