summaryrefslogtreecommitdiffstats
path: root/usrp2/gpmc/edge_sync.v
diff options
context:
space:
mode:
Diffstat (limited to 'usrp2/gpmc/edge_sync.v')
-rw-r--r--usrp2/gpmc/edge_sync.v22
1 files changed, 22 insertions, 0 deletions
diff --git a/usrp2/gpmc/edge_sync.v b/usrp2/gpmc/edge_sync.v
new file mode 100644
index 000000000..5d9417c08
--- /dev/null
+++ b/usrp2/gpmc/edge_sync.v
@@ -0,0 +1,22 @@
+
+
+module edge_sync
+ #(parameter POSEDGE = 1)
+ (input clk,
+ input rst,
+ input sig,
+ output trig);
+
+ reg [1:0] delay;
+
+ always @(posedge clk)
+ if(rst)
+ delay <= 2'b00;
+ else
+ delay <= {delay[0],sig};
+
+ assign trig = POSEDGE ? (delay==2'b01) : (delay==2'b10);
+
+endmodule // edge_sync
+
+