Changeset 9104
- Timestamp:
- 07/31/08 20:35:03
- Files:
-
- usrp2/trunk/fpga/serdes/serdes_rx.v (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
usrp2/trunk/fpga/serdes/serdes_rx.v
r8609 r9104 41 41 output [15:0] fifo_space, 42 42 output xon_rcvd, output xoff_rcvd, 43 44 output [15:0] fifo_occupied, output fifo_full, output fifo_empty, 43 45 output [31:0] debug 44 46 ); … … 81 83 reg write_d; 82 84 85 oneshot_2clk rst_1s(.clk_in(clk),.in(rst),.clk_out(ser_rx_clk),.out(rst_rxclk)); 86 83 87 /* 84 88 ss_rcvr #(.WIDTH(18)) ss_rcvr … … 90 94 91 95 always @(posedge ser_rx_clk) 92 if(rst )96 if(rst_rxclk) 93 97 holder <= 9'd0; 94 98 else … … 96 100 97 101 always @(posedge ser_rx_clk) 98 if(rst )102 if(rst_rxclk) 99 103 odd_data <= 18'd0; 100 104 else … … 103 107 assign chosen_data = odd ? odd_data : even_data; 104 108 105 assign xon_rcvd = ({1'b1,K_XON} == {ser_rkmsb,ser_r[15:8]}) | ({1'b1,K_XON} == {ser_rklsb,ser_r[7:0]} ); 106 assign xoff_rcvd = ({1'b1,K_XOFF} == {ser_rkmsb,ser_r[15:8]}) | ({1'b1,K_XOFF} == {ser_rklsb,ser_r[7:0]} ); 107 109 // Transfer xon and xoff info to the main system clock for flow control purposes 110 reg xon_rcvd_rxclk, xoff_rcvd_rxclk; 111 always @(posedge ser_rx_clk) 112 xon_rcvd_rxclk = ({1'b1,K_XON} == {ser_rkmsb,ser_r[15:8]}) | ({1'b1,K_XON} == {ser_rklsb,ser_r[7:0]} ); 113 always @(posedge ser_rx_clk) 114 xoff_rcvd_rxclk = ({1'b1,K_XOFF} == {ser_rkmsb,ser_r[15:8]}) | ({1'b1,K_XOFF} == {ser_rklsb,ser_r[7:0]} ); 115 116 oneshot_2clk xon_1s(.clk_in(ser_rx_clk),.in(xon_rcvd_rxclk),.clk_out(clk),.out(xon_rcvd)); 117 oneshot_2clk xoff_1s(.clk_in(ser_rx_clk),.in(xoff_rcvd_rxclk),.clk_out(clk),.out(xoff_rcvd)); 118 119 // If the other side is sending xon or xoff, or is flow controlled (b/c we told them to be), don't fill the fifos 108 120 wire wait_here = ((chosen_data == {2'b10,K_COMMA,D_56})|| 109 121 (chosen_data == {2'b11,K_XON,K_XON})|| … … 111 123 112 124 always @(posedge ser_rx_clk) 113 if(rst ) sop_i <= 0;125 if(rst_rxclk) sop_i <= 0; 114 126 else if(state == FIRSTLINE1) sop_i <= 1; 115 127 else if(write_d) sop_i <= 0; … … 117 129 reg write_pre; 118 130 always @(posedge ser_rx_clk) 119 if(rst )131 if(rst_rxclk) 120 132 begin 121 133 state <= IDLE; … … 238 250 239 251 always @(posedge ser_rx_clk) 240 if(rst )252 if(rst_rxclk) 241 253 CRC <= 16'hFFFF; 242 254 else if(state == IDLE) … … 248 260 249 261 always @(posedge ser_rx_clk) 250 if(rst ) write_d <= 0;262 if(rst_rxclk) write_d <= 0; 251 263 else write_d <= write_pre; 252 264 … … 257 269 //`define CASC 1 258 270 `define MYFIFO 1 259 //`define XILFIFO 1271 //`define XILFIFO 1 260 272 261 273 `ifdef CASC … … 264 276 .datain({error_i,sop_i,eop_i,line_i}), .write(write), .full(full), 265 277 .dataout({error_o,sop_o,eop_o,line_o}), .read(read), .empty(empty), 266 .fifo_space(fifo_space) ); 278 .space(fifo_space),.occupied(fifo_occupied) ); 279 assign fifo_full = full; 280 assign fifo_empty = empty; 267 281 `endif 268 282 … … 276 290 assign fifo_space = {{(16-FIFOSIZE){1'b0}},{FIFOSIZE{1'b1}}} - 277 291 {{(16-FIFOSIZE){1'b0}},level}; 292 assign fifo_occupied = { {(16-FIFOSIZE){1'b0}} ,level}; 293 assign fifo_full = full; // Note -- fifo_full is in the wrong clock domain 294 assign fifo_empty = empty; 278 295 `endif 279 296 … … 290 307 .empty(empty), 291 308 .full(full), 292 .rd_data_count( ),293 .wr_data_count( level));309 .rd_data_count(level), 310 .wr_data_count() ); 294 311 assign fifo_space = {{(16-FIFOSIZE){1'b0}},{FIFOSIZE{1'b1}}} - 295 312 {{(16-FIFOSIZE){1'b0}},level}; 313 assign fifo_occupied = { {(16-FIFOSIZE){1'b0}}, level }; 314 assign fifo_full = full; // Note -- fifo_full is in the wrong clock domain 315 assign fifo_empty = empty; 296 316 `endif // `ifdef XILFIFO 297 317 … … 322 342 { 2'd0, error_i, sop_i, eop_i, error_o, sop_o, eop_o }, 323 343 { full, empty, write, read, xfer_active, state[2:0] } }; 324 */ 325 326 /* 344 327 345 assign debug = { { xoff_rcvd,xon_rcvd,sop_i,eop_i,error_i,state[2:0] }, 328 346 { odd, wait_here, write_pre, write_d, write, full, chosen_data[17:16]},
