diff options
author | Matt Ettus <matt@ettus.com> | 2010-07-20 15:22:19 -0700 |
---|---|---|
committer | Matt Ettus <matt@ettus.com> | 2010-07-28 10:00:44 -0700 |
commit | 0cf5dc0aac63940358f13db6f60ef44b55e78a50 (patch) | |
tree | 868d2886ba08ebbbbb70e9fe563cbab5b78b8d88 /usrp2/vrt | |
parent | ffadd16f70d918fc7774c0b88fb6d47d7b257763 (diff) | |
download | uhd-0cf5dc0aac63940358f13db6f60ef44b55e78a50.tar.gz uhd-0cf5dc0aac63940358f13db6f60ef44b55e78a50.tar.bz2 uhd-0cf5dc0aac63940358f13db6f60ef44b55e78a50.zip |
introduce new error types
Diffstat (limited to 'usrp2/vrt')
-rw-r--r-- | usrp2/vrt/vita_tx_chain.v | 33 | ||||
-rw-r--r-- | usrp2/vrt/vita_tx_control.v | 57 | ||||
-rw-r--r-- | usrp2/vrt/vita_tx_deframer.v | 24 |
3 files changed, 80 insertions, 34 deletions
diff --git a/usrp2/vrt/vita_tx_chain.v b/usrp2/vrt/vita_tx_chain.v index 84e502b5f..ad9f11fc6 100644 --- a/usrp2/vrt/vita_tx_chain.v +++ b/usrp2/vrt/vita_tx_chain.v @@ -12,30 +12,39 @@ module vita_tx_chain output [15:0] dac_a, output [15:0] dac_b, output underrun, output run, output [31:0] debug); + + localparam MAXCHAN = 1; + localparam FIFOWIDTH = 5+64+(32*MAXCHAN); + + wire [FIFOWIDTH-1:0] tx1_data; + wire tx1_src_rdy, tx1_dst_rdy; + wire clear_vita; + wire [31:0] sample_tx; + wire [31:0] streamid, message; + wire trigger, sent; + wire [31:0] debug_vtc, debug_vtd, debug_tx_dsp; + + wire error; + wire [3:0] error_code; - wire [31:0] debug_vtc, debug_vtd, debug_tx_dsp; - wire [99:0] tx1_data; - wire tx1_src_rdy, tx1_dst_rdy; - wire clear_vita; - wire [31:0] sample_tx; - wire [31:0] streamid, message; - wire trigger, sent; - + assign underrun = error; + assign message = {28'h0,error_code}; + setting_reg #(.my_addr(BASE_CTRL+2), .at_reset(0)) sr_streamid (.clk(clk),.rst(reset),.strobe(set_stb),.addr(set_addr), .in(set_data),.out(streamid),.changed()); - vita_tx_deframer #(.BASE(BASE_CTRL), .MAXCHAN(1)) vita_tx_deframer + vita_tx_deframer #(.BASE(BASE_CTRL), .MAXCHAN(MAXCHAN)) vita_tx_deframer (.clk(clk), .reset(reset), .clear(clear_vita), .set_stb(set_stb),.set_addr(set_addr),.set_data(set_data), .data_i(tx_data_i), .src_rdy_i(tx_src_rdy_i), .dst_rdy_o(tx_dst_rdy_o), .sample_fifo_o(tx1_data), .sample_fifo_src_rdy_o(tx1_src_rdy), .sample_fifo_dst_rdy_i(tx1_dst_rdy), .debug(debug_vtd) ); - vita_tx_control #(.BASE(BASE_CTRL), .WIDTH(32)) vita_tx_control + vita_tx_control #(.BASE(BASE_CTRL), .WIDTH(32*MAXCHAN)) vita_tx_control (.clk(clk), .reset(reset), .clear(clear_vita), .set_stb(set_stb),.set_addr(set_addr),.set_data(set_data), - .vita_time(vita_time),.underrun(underrun), + .vita_time(vita_time),.error(error),.error_code(error_code), .sample_fifo_i(tx1_data), .sample_fifo_src_rdy_i(tx1_src_rdy), .sample_fifo_dst_rdy_o(tx1_dst_rdy), .sample(sample_tx), .run(run), .strobe(strobe_tx), .debug(debug_vtc) ); @@ -51,7 +60,7 @@ module vita_tx_chain if(REPORT_ERROR==1) gen_context_pkt #(.PROT_ENG_FLAGS(PROT_ENG_FLAGS)) gen_tx_err_pkt (.clk(clk), .reset(reset), .clear(clear_vita), - .trigger(underrun), .sent(), + .trigger(error), .sent(), .streamid(streamid), .vita_time(vita_time), .message(message), .data_o(err_data_o), .src_rdy_o(err_src_rdy_o), .dst_rdy_i(err_dst_rdy_i)); endgenerate diff --git a/usrp2/vrt/vita_tx_control.v b/usrp2/vrt/vita_tx_control.v index bffc64e52..29d3041b5 100644 --- a/usrp2/vrt/vita_tx_control.v +++ b/usrp2/vrt/vita_tx_control.v @@ -6,10 +6,11 @@ module vita_tx_control input set_stb, input [7:0] set_addr, input [31:0] set_data, input [63:0] vita_time, - output underrun, + output reg [3:0] error_code, + output error, // From vita_tx_deframer - input [4+64+WIDTH-1:0] sample_fifo_i, + input [5+64+WIDTH-1:0] sample_fifo_i, input sample_fifo_src_rdy_i, output sample_fifo_dst_rdy_o, @@ -20,14 +21,16 @@ module vita_tx_control output [31:0] debug ); - - assign sample = sample_fifo_i[4+64+WIDTH-1:4+64]; + + assign sample = sample_fifo_i[5+64+WIDTH-1:5+64]; wire [63:0] send_time = sample_fifo_i[63:0]; wire eop = sample_fifo_i[64]; wire eob = sample_fifo_i[65]; wire sob = sample_fifo_i[66]; wire send_at = sample_fifo_i[67]; + wire seqnum_err = sample_fifo_i[68]; + wire now, early, late, too_early; // FIXME ignore too_early for now for timing reasons @@ -41,7 +44,13 @@ module vita_tx_control localparam IBS_RUN = 1; // FIXME do we need this? localparam IBS_CONT_BURST = 2; localparam IBS_UNDERRUN = 3; - localparam IBS_UNDERRUN_DONE = 4; + localparam IBS_TIME_ERROR = 4; + localparam IBS_SEQ_ERROR = 5; + localparam IBS_ERROR_DONE = 7; + + localparam CODE_UNDERRUN = 2; + localparam CODE_SEQ_ERROR = 4; + localparam CODE_TIME_ERROR = 8; reg [2:0] ibs_state; @@ -57,10 +66,12 @@ module vita_tx_control case(ibs_state) IBS_IDLE : if(sample_fifo_src_rdy_i) - if(~send_at | now) + if(seqnum_err) + ibs_state <= IBS_SEQ_ERROR; + else if(~send_at | now) ibs_state <= IBS_RUN; else if(late | too_early) - ibs_state <= IBS_UNDERRUN; + ibs_state <= IBS_TIME_ERROR; IBS_RUN : if(strobe) @@ -74,24 +85,40 @@ module vita_tx_control IBS_CONT_BURST : if(strobe) - ibs_state <= IBS_UNDERRUN_DONE; + ibs_state <= IBS_ERROR_DONE; else if(sample_fifo_src_rdy_i) - ibs_state <= IBS_RUN; + if(seqnum_err) + ibs_state <= IBS_SEQ_ERROR; + else + ibs_state <= IBS_RUN; IBS_UNDERRUN : - if(sample_fifo_src_rdy_i & eop) - ibs_state <= IBS_UNDERRUN_DONE; - - IBS_UNDERRUN_DONE : + begin + error_code <= CODE_UNDERRUN; + if(sample_fifo_src_rdy_i & eop) + ibs_state <= IBS_ERROR_DONE; + end + IBS_TIME_ERROR : + begin + error_code <= CODE_TIME_ERROR; + ibs_state <= IBS_ERROR_DONE; + end + IBS_SEQ_ERROR : + begin + error_code <= CODE_SEQ_ERROR; + ibs_state <= IBS_ERROR_DONE; + end + IBS_ERROR_DONE : ; + endcase // case (ibs_state) assign sample_fifo_dst_rdy_o = (ibs_state == IBS_UNDERRUN) | (strobe & (ibs_state == IBS_RUN)); // FIXME also cleanout assign run = (ibs_state == IBS_RUN) | (ibs_state == IBS_CONT_BURST); - assign underrun = (ibs_state == IBS_UNDERRUN_DONE); + assign error = (ibs_state == IBS_ERROR_DONE); assign debug = { { now,early,late,too_early,eop,eob,sob,send_at }, - { sample_fifo_src_rdy_i, sample_fifo_dst_rdy_o, strobe, run, underrun, ibs_state[2:0] }, + { sample_fifo_src_rdy_i, sample_fifo_dst_rdy_o, strobe, run, error, ibs_state[2:0] }, { 8'b0 }, { 8'b0 } }; diff --git a/usrp2/vrt/vita_tx_deframer.v b/usrp2/vrt/vita_tx_deframer.v index 3b95f5902..55869b6e7 100644 --- a/usrp2/vrt/vita_tx_deframer.v +++ b/usrp2/vrt/vita_tx_deframer.v @@ -10,7 +10,7 @@ module vita_tx_deframer input src_rdy_i, output dst_rdy_o, - output [4+64+(32*MAXCHAN)-1:0] sample_fifo_o, + output [5+64+(32*MAXCHAN)-1:0] sample_fifo_o, output sample_fifo_src_rdy_o, input sample_fifo_dst_rdy_i, @@ -21,6 +21,8 @@ module vita_tx_deframer output [31:0] debug ); + localparam FIFOWIDTH = 5+64+(32*MAXCHAN); + wire [1:0] numchan; setting_reg #(.my_addr(BASE), .at_reset(0), .width(2)) sr_numchan (.clk(clk),.rst(reset),.strobe(set_stb),.addr(set_addr), @@ -36,14 +38,18 @@ module vita_tx_deframer assign is_sob = data_i[25]; assign is_eob = data_i[24]; wire eof = data_i[33]; - reg has_streamid_reg, has_classid_reg, has_secs_reg, has_tics_reg; reg has_trailer_reg, is_sob_reg, is_eob_reg; - + reg [15:0] pkt_len; reg [1:0] vector_phase; wire line_done; + reg seqnum_err; + reg [3:0] seqnum_reg; + wire [3:0] seqnum = data_i[19:16]; + wire [3:0] next_seqnum = seqnum_reg + 4'd1; + // Output FIFO for packetized data localparam VITA_HEADER = 0; localparam VITA_STREAMID = 1; @@ -61,13 +67,15 @@ module vita_tx_deframer wire eop = eof | (pkt_len==hdr_len); // FIXME would ignoring eof allow larger VITA packets? wire fifo_space; - + always @(posedge clk) if(reset | clear) begin vita_state <= VITA_HEADER; {has_streamid_reg, has_classid_reg, has_secs_reg, has_tics_reg, has_trailer_reg, is_sob_reg, is_eob_reg} <= 0; + seqnum_err <= 0; + seqnum_reg <= 0; end else if((vita_state == VITA_STORE) & fifo_space) @@ -99,6 +107,8 @@ module vita_tx_deframer vita_state <= VITA_TICS; else vita_state <= VITA_PAYLOAD; + seqnum_reg <= seqnum; + seqnum_err <= ~(is_sob | (seqnum == next_seqnum)); end // case: VITA_HEADER VITA_STREAMID : if(has_classid_reg) @@ -145,7 +155,7 @@ module vita_tx_deframer assign line_done = (vector_phase == numchan); - wire [4+64+32*MAXCHAN-1:0] fifo_i; + wire [FIFOWIDTH-1:0] fifo_i; reg [63:0] send_time; reg [31:0] sample_a, sample_b, sample_c, sample_d; @@ -169,13 +179,13 @@ module vita_tx_deframer endcase // case (vector_phase) wire store = (vita_state == VITA_STORE); - fifo_short #(.WIDTH(4+64+32*MAXCHAN)) short_tx_q + fifo_short #(.WIDTH(FIFOWIDTH)) short_tx_q (.clk(clk), .reset(reset), .clear(clear), .datain(fifo_i), .src_rdy_i(store), .dst_rdy_o(fifo_space), .dataout(sample_fifo_o), .src_rdy_o(sample_fifo_src_rdy_o), .dst_rdy_i(sample_fifo_dst_rdy_i) ); // sob, eob, has_secs (send_at) ignored on all lines except first - assign fifo_i = {sample_d,sample_c,sample_b,sample_a,has_secs_reg,is_sob_reg,is_eob_reg,eop,send_time}; + assign fifo_i = {sample_d,sample_c,sample_b,sample_a,seqnum_err,has_secs_reg,is_sob_reg,is_eob_reg,eop,send_time}; assign dst_rdy_o = ~(vita_state == VITA_PAYLOAD) & ~((vita_state==VITA_STORE)& ~fifo_space) ; |