aboutsummaryrefslogtreecommitdiffstats
path: root/usrp2/vrt/trigger_context_pkt.v
diff options
context:
space:
mode:
authorMatt Ettus <matt@ettus.com>2010-10-08 14:01:33 -0700
committerMatt Ettus <matt@ettus.com>2010-11-11 18:07:07 -0800
commit4139894fe6d0031897422c46b59746fe6bf0074f (patch)
tree302443339c6bfce8ab7b978f0828cdcc0005cf97 /usrp2/vrt/trigger_context_pkt.v
parent6ead587793fc9ddeb3daff8725fe8c95bf6abfe7 (diff)
downloaduhd-4139894fe6d0031897422c46b59746fe6bf0074f.tar.gz
uhd-4139894fe6d0031897422c46b59746fe6bf0074f.tar.bz2
uhd-4139894fe6d0031897422c46b59746fe6bf0074f.zip
checkpoint in flow control packet generation
Diffstat (limited to 'usrp2/vrt/trigger_context_pkt.v')
-rw-r--r--usrp2/vrt/trigger_context_pkt.v52
1 files changed, 52 insertions, 0 deletions
diff --git a/usrp2/vrt/trigger_context_pkt.v b/usrp2/vrt/trigger_context_pkt.v
new file mode 100644
index 000000000..51790dfae
--- /dev/null
+++ b/usrp2/vrt/trigger_context_pkt.v
@@ -0,0 +1,52 @@
+
+
+module trigger_context_pkt
+ #(parameter BASE=0)
+ (input clk, input reset, input clear,
+ input set_stb, input [7:0] set_addr, input [31:0] set_data,
+ input packet_consumed, output reg trigger);
+
+ wire [23:0] cycles;
+ wire [15:0] packets;
+ wire [6:0] dummy1;
+ wire [14:0] dummy2;
+ wire enable_timed, enable_consumed;
+ reg [30:0] cycle_count, packet_count;
+
+
+ setting_reg #(.my_addr(BASE_CTRL+X), .at_reset(0)) sr_settings
+ (.clk(clk),.rst(reset),.strobe(set_stb),.addr(set_addr),
+ .in(set_data),.out({enable_cycle,dummy1,cycles}),.changed());
+
+ setting_reg #(.my_addr(BASE_CTRL+X), .at_reset(0)) sr_settings
+ (.clk(clk),.rst(reset),.strobe(set_stb),.addr(set_addr),
+ .in(set_data),.out({enable_consumed,dummy2,packets}),.changed());
+
+ always @(posedge clk)
+ if(reset | clear)
+ cycle_count <= 0;
+ else
+ if(trigger)
+ cycle_count <= 0;
+ else if(enable_cycle)
+ cycle_count <= cycle_count + 1;
+
+ always @(posedge clk)
+ if(reset | clear)
+ packet_count <= 0;
+ else
+ if(trigger)
+ packet_count <= 0;
+ else if(packet_consumed & enable_consumed)
+ packet_count <= packet_count + 1;
+
+ always @(posedge clk)
+ if(reset | clear)
+ trigger <= 0;
+ else
+ if((cycle_count > cycles)|(packet_count > packets))
+ trigger <= 1;
+ else
+ trigger <= 0;
+
+endmodule // trigger_context_pkt