From a2f7944a811296372e542ec29838ebd1599868ed Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Fri, 3 Jul 2020 16:36:22 +0200 Subject: [PATCH] Ensure dramsync runs at 100Mhz, sync2x at 200Mhz --- gram/simulation/simcrgtb.sv | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gram/simulation/simcrgtb.sv b/gram/simulation/simcrgtb.sv index d753a84..289c9ec 100644 --- a/gram/simulation/simcrgtb.sv +++ b/gram/simulation/simcrgtb.sv @@ -39,9 +39,31 @@ module simcrgtb; assert (top.crg_dramsync_rst == 1'b1) else $error("DRAM clock domain is not reset at t=0"); end - always @ (negedge top.crg_dramsync_rst) + always @(negedge top.crg_dramsync_rst) begin assert($time > 600000) else $error("DRAM sync got out of reset before 600us (too early)"); assert($time < 700000) else $error("DRAM sync got out of reset after 700us (too late)"); end + + time last_dramsync_tick; + always @(posedge top.crg_dramsync_clk) + begin + if (top.crg_dramsync_rst == 1'b0) + begin + assert ($time - last_dramsync_tick == 10) else $error("dramsync isn't running at 100Mhz"); + end + + last_dramsync_tick = $time; + end + + time last_sync2x_tick; + always @(posedge top.crg_sync2x_clk) + begin + if (top.crg_dramsync_rst == 1'b0) + begin + assert ($time - last_sync2x_tick == 5) else $error("sync2x isn't running at 200Mhz"); + end + + last_sync2x_tick = $time; + end endmodule -- 2.30.2