aboutsummaryrefslogtreecommitdiffstats
path: root/fpga/usrp3/lib/axi/axi_chdr_header_trigger.v
blob: e8dee3675ed57b0846a00f7265d52ecb69360ec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 Ettus Research LLC


module axi_chdr_header_trigger
  #(
    parameter WIDTH=64,
    parameter SID=0
   )
    (input clk, input reset, input clear,
     input [WIDTH-1:0] i_tdata, input i_tlast, input i_tvalid, input i_tready,
     output trigger
     );

   
   reg 	  state;
   localparam IDLE = 0;
   localparam RUN  = 1;
 

   always @(posedge clk)
     if(reset | clear)
       state <= IDLE;
     else
       case (state)
	 IDLE :
	   if(i_tvalid && i_tready)
	     state <= RUN;

	 RUN :
	   if(i_tready && i_tvalid && i_tlast)	    
	     state <= IDLE;

	 default :
	   state <= IDLE;
       endcase // case (state)

   assign     trigger =  i_tvalid && i_tready && (state == IDLE) && (i_tdata[15:0] != SID);

endmodule // axi_chdr_header_trigger