Ensure dramsync runs at 100Mhz, sync2x at 200Mhz
authorJean THOMAS <git0@pub.jeanthomas.me>
Fri, 3 Jul 2020 14:36:22 +0000 (16:36 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Fri, 3 Jul 2020 14:36:22 +0000 (16:36 +0200)
gram/simulation/simcrgtb.sv

index d753a840adeef66da1c7dd58bb6eeb52f353b7ed..289c9ec51f4b1c511e291acd48454397c9f85022 100644 (file)
@@ -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