I am trying to randomize some data members, I encountered that if I don’t do .randomize() in a repeat loop, I don’t see random behavior on my rand data members. Can anyone please help me out here.
Below is my code
Thanks
// Code your testbench here
class avmm_param;
typedef enum {user_mode} support_mode;
//engineering_mode
typedef enum {duplex,tx,rx} duplex_mode;
rand support_mode protocol_support_mode;
rand duplex_mode transceiver_mode;
function void display_params();
$display("****************Randomized Parameters********************");
$display("support_mode is %s \n", protocol_support_mode);
$display("duplex_mode is %s \n",transceiver_mode);
endfunction
endclass
module param_config ();
initial begin
avmm_param avmm_config_inst = new();
// repeat (5) begin If I remove the repeat loop, I am not able to see random behavior everytime I compile this file. If I add repeat loop than I see random behavior
if (avmm_config_inst.randomize()) avmm_config_inst.display_params();
else $error("Randomization Failed \n");
// end
end
endmodule