3 // USRP - Universal Software Radio Peripheral
5 // Copyright (C) 2007 Corgan Enterprises LLC
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
22 `include "../../../../usrp/firmware/include/fpga_regs_common.v"
23 `include "../../../../usrp/firmware/include/fpga_regs_standard.v"
25 module radar_rx(clk_i,rst_i,ena_i,dbg_i,
27 rx_i_o,rx_q_o,rx_strobe_o);
34 input [15:0] rx_in_i_i;
35 input [15:0] rx_in_q_i;
39 output reg rx_strobe_o;
43 always @(posedge clk_i)
47 count <= count + 16'b1;
49 wire [31:0] fifo_data = dbg_i ? {count[15:0],16'hAA55} : {rx_in_i_i,rx_in_q_i};
51 // Need to buffer received samples as they come in at 32 bits per cycle
52 // but the rx_buffer.v fifo is only 16 bits wide.
58 fifo32_4k fifo(.clock(clk_i),.sclr(rst_i),
59 .data(fifo_data),.wrreq(ena_i),
60 .q(fifo_out),.rdreq(fifo_read),
63 `define ST_RD_IDLE 4'b0001
64 `define ST_RD_REQ 4'b0010
65 `define ST_WR_FIFO 4'b0100
66 `define ST_RD_DELAY 4'b1000
71 always @(posedge clk_i)
100 state <= `ST_RD_DELAY;
107 state <= `ST_RD_IDLE;
110 delay <= delay + 1'b1;
112 endcase // case(state)
114 assign rx_i_o = fifo_out[31:16];
115 assign rx_q_o = fifo_out[15:0];
117 endmodule // radar_rx