From: Jean THOMAS Date: Fri, 3 Jul 2020 14:36:22 +0000 (+0200) Subject: Ensure dramsync runs at 100Mhz, sync2x at 200Mhz X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2f7944a811296372e542ec29838ebd1599868ed;p=gram.git Ensure dramsync runs at 100Mhz, sync2x at 200Mhz --- 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