Ensure sync2x and sync are in sync (fixes #20)
authorJean THOMAS <git0@pub.jeanthomas.me>
Wed, 29 Jul 2020 14:46:25 +0000 (16:46 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Wed, 29 Jul 2020 14:46:25 +0000 (16:46 +0200)
gram/simulation/simcrgtb.sv

index 289c9ec51f4b1c511e291acd48454397c9f85022..4039581fbb5208c9c1c2181afbbc5cdf398fcbab 100644 (file)
@@ -66,4 +66,12 @@ module simcrgtb;
 
       last_sync2x_tick = $time;
     end
+
+  always @(posedge top.crg_dramsync_clk)
+    begin
+      if (top.crg_dramsync_clk && $time > 700000)
+        begin
+          assert(top.crg_sync2x_clk == 1) else $error("dramsync and sync2x are out of sync");
+        end
+    end
 endmodule