diff fpga/sniffer-pps/clk_check.v @ 53:737579209153

fpga/sniffer-pps: add LED indication of running SIM CLK
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 03 Oct 2023 19:35:29 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fpga/sniffer-pps/clk_check.v	Tue Oct 03 19:35:29 2023 +0000
@@ -0,0 +1,19 @@
+/*
+ * The logic implemented in this module detects if SIM_CLK is running or not,
+ * for the purpose of visual indication on a LED.
+ */
+
+module clk_check (IntClk, SIM_CLK_sync, SIM_CLK_running);
+
+input IntClk;
+input SIM_CLK_sync;
+output SIM_CLK_running;
+
+reg [11:0] shift_reg;
+
+always @(posedge IntClk)
+	shift_reg <= {shift_reg[10:0],SIM_CLK_sync};
+
+assign SIM_CLK_running = (shift_reg != 12'h000) && (shift_reg != 12'hFFF);
+
+endmodule