I’m a newbie on UVM verification, I’m building a environment to verify my design. In my design It has a clock input whose the clock frequency can change from user. I intend to test the design with with different clock frequency. How can I configure this?
You didn’t show how you intended to use cycle_2 to represent the clock frequency. You can’t change the value of a parameter at run-time, but you can change the value of a variable. Fortunately, you can use the value of a variable in a procedural delay. Your clock generator can read the value from the uvm_config_db and set up the clock period.
Thanks for your reply.
Here it is,
//Clock generation
always #cycle_1 vif.clk1 = ~vif.clk1;
always #cycle_2 vif.clk2 = ~vif.clk2;
Clk1 is fixed, clk2 varies depending on testcases.
As you said, How can I make a procedural delay? Can I write it one wdt_top_tb or open a new class for clock generator?
I’m still unclear, Can you give me an example?
Hi Hongnhattl,
I tried your clock configuration concept in my one of my project,but i have following issues,
I’m not able to get the cfg value inside initial begin block (used same like your below code). I tried declaring it as real/int,but the simulation hangs without clock - i’m not able to get the value from testlib. Kindly clarify.
start_of_simulation_ph.wait_for_state(UVM_PHASE_STARTED);
void'(uvm_config_db#(spi_config)::get(null,"uvm_test_top","config",cfg));
begin
sck_cyc = cfg.sck_cyc;
sck_hcyc = sck_cyc/2;
sck_hcyc_div2 = sck_hcyc/2;
end
2.In testlib, where should i use below code? In build_phase or in run_phase?.