summaryrefslogtreecommitdiffstats
path: root/usrp2
diff options
context:
space:
mode:
authorMatt Ettus <matt@ettus.com>2011-06-03 16:18:48 -0700
committerMatt Ettus <matt@ettus.com>2011-06-08 10:55:22 -0700
commitd7a3b89d4f7fea444602b0f8ff52029b0efa835f (patch)
treea5346e4d573fd9791bbf672aec84f62342cb2214 /usrp2
parent8217bfcafbba769677ccf299c35fd4112dcb07a7 (diff)
downloaduhd-d7a3b89d4f7fea444602b0f8ff52029b0efa835f.tar.gz
uhd-d7a3b89d4f7fea444602b0f8ff52029b0efa835f.tar.bz2
uhd-d7a3b89d4f7fea444602b0f8ff52029b0efa835f.zip
dsp: added tx_frontend, instantiated in u2/u2p
Diffstat (limited to 'usrp2')
-rw-r--r--usrp2/sdr_lib/Makefile.srcs4
-rw-r--r--usrp2/sdr_lib/dsp_core_tx.v20
-rw-r--r--usrp2/sdr_lib/tx_frontend.v54
-rw-r--r--usrp2/top/N2x0/u2plus_core.v12
-rw-r--r--usrp2/top/USRP2/u2_core.v12
-rw-r--r--usrp2/vrt/vita_tx_chain.v4
6 files changed, 81 insertions, 25 deletions
diff --git a/usrp2/sdr_lib/Makefile.srcs b/usrp2/sdr_lib/Makefile.srcs
index 6dab1db5e..defbced17 100644
--- a/usrp2/sdr_lib/Makefile.srcs
+++ b/usrp2/sdr_lib/Makefile.srcs
@@ -24,18 +24,16 @@ cordic.v \
cordic_z24.v \
cordic_stage.v \
dsp_core_rx.v \
-dsp_core_rx_old.v \
dsp_core_tx.v \
hb_dec.v \
hb_interp.v \
round.v \
round_reg.v \
round_sd.v \
-rx_control.v \
rx_dcoffset.v \
rx_frontend.v \
sign_extend.v \
small_hb_dec.v \
small_hb_int.v \
-tx_control.v \
+tx_frontend.v \
))
diff --git a/usrp2/sdr_lib/dsp_core_tx.v b/usrp2/sdr_lib/dsp_core_tx.v
index 58bd82f6e..66dcee261 100644
--- a/usrp2/sdr_lib/dsp_core_tx.v
+++ b/usrp2/sdr_lib/dsp_core_tx.v
@@ -21,8 +21,7 @@ module dsp_core_tx
(input clk, input rst,
input set_stb, input [7:0] set_addr, input [31:0] set_data,
- output reg [15:0] dac_a,
- output reg [15:0] dac_b,
+ output [23:0] tx_i, output [23:0] tx_q,
// To tx_control
input [31:0] sample,
@@ -148,20 +147,9 @@ module dsp_core_tx
.CE(1), // Clock enable input
.R(rst) // Synchronous reset input
);
-
- always @(posedge clk)
- case(dacmux_a)
- 0 : dac_a <= prod_i[28:13];
- 1 : dac_a <= prod_q[28:13];
- default : dac_a <= 0;
- endcase // case(dacmux_a)
-
- always @(posedge clk)
- case(dacmux_b)
- 0 : dac_b <= prod_i[28:13];
- 1 : dac_b <= prod_q[28:13];
- default : dac_b <= 0;
- endcase // case(dacmux_b)
+
+ assign tx_i = prod_i[28:5];
+ assign tx_q = prod_q[28:5];
assign debug = {strobe_cic, strobe_hb1, strobe_hb2,run};
diff --git a/usrp2/sdr_lib/tx_frontend.v b/usrp2/sdr_lib/tx_frontend.v
new file mode 100644
index 000000000..2817c1510
--- /dev/null
+++ b/usrp2/sdr_lib/tx_frontend.v
@@ -0,0 +1,54 @@
+
+module tx_frontend
+ #(parameter BASE=0)
+ (input clk, input rst,
+ input set_stb, input [7:0] set_addr, input [31:0] set_data,
+ input [23:0] tx_i, input [23:0] tx_q, input run,
+ output reg [15:0] dac_a, output reg [15:0] dac_b
+ );
+
+ // IQ balance --> DC offset --> rounding --> mux
+
+ wire [23:0] i_dco, q_dco, i_ofs, q_ofs;
+ wire [15:0] i_final, q_final;
+ wire [7:0] mux_ctrl;
+
+ setting_reg #(.my_addr(BASE+0), .width(24)) sr_0
+ (.clk(clk),.rst(rst),.strobe(set_stb),.addr(set_addr),
+ .in(set_data),.out(i_dco),.changed());
+
+ setting_reg #(.my_addr(BASE+1), .width(24)) sr_1
+ (.clk(clk),.rst(rst),.strobe(set_stb),.addr(set_addr),
+ .in(set_data),.out(q_dco),.changed());
+
+ setting_reg #(.my_addr(BASE+2), .width(4)) sr_2
+ (.clk(clk),.rst(rst),.strobe(set_stb),.addr(set_addr),
+ .in(set_data),.out(mux_ctrl),.changed());
+
+ add2_and_clip_reg #(.WIDTH(24)) add_dco_i
+ (.clk(clk), .rst(rst), .in1(i_dco), .in2(tx_i), .strobe_in(1'b1), .sum(i_ofs), .strobe_out());
+
+ add2_and_clip_reg #(.WIDTH(24)) add_dco_q
+ (.clk(clk), .rst(rst), .in1(q_dco), .in2(tx_q), .strobe_in(1'b1), .sum(q_ofs), .strobe_out());
+
+ round_sd #(.WIDTH_IN(24),.WIDTH_OUT(16)) round_i
+ (.clk(clk), .reset(rst), .in(i_ofs),.strobe_in(1'b1), .out(i_final), .strobe_out());
+
+ round_sd #(.WIDTH_IN(24),.WIDTH_OUT(16)) round_q
+ (.clk(clk), .reset(rst), .in(q_ofs),.strobe_in(1'b1), .out(q_final), .strobe_out());
+
+ always @(posedge clk)
+ case(mux_ctrl[3:0])
+ 0 : dac_a <= i_final;
+ 1 : dac_a <= q_final;
+ default : dac_a <= 0;
+ endcase // case (mux_ctrl[3:0])
+
+ always @(posedge clk)
+ case(mux_ctrl[7:4])
+ 0 : dac_b <= i_final;
+ 1 : dac_b <= q_final;
+ default : dac_b <= 0;
+ endcase // case (mux_ctrl[7:4])
+
+endmodule // tx_frontend
diff --git a/usrp2/top/N2x0/u2plus_core.v b/usrp2/top/N2x0/u2plus_core.v
index 899ee472b..6154a9926 100644
--- a/usrp2/top/N2x0/u2plus_core.v
+++ b/usrp2/top/N2x0/u2plus_core.v
@@ -687,6 +687,8 @@ module u2plus_core
.debug(debug_extfifo),
.debug2(debug_extfifo2) );
+ wire [23:0] tx_i, tx_q;
+
vita_tx_chain #(.BASE_CTRL(SR_TX_CTRL), .BASE_DSP(SR_TX_DSP),
.REPORT_ERROR(1), .DO_FLOW_CONTROL(1),
.PROT_ENG_FLAGS(1), .USE_TRANS_HEADER(1),
@@ -697,10 +699,16 @@ module u2plus_core
.vita_time(vita_time),
.tx_data_i(tx_data), .tx_src_rdy_i(tx_src_rdy), .tx_dst_rdy_o(tx_dst_rdy),
.err_data_o(tx_err_data), .err_src_rdy_o(tx_err_src_rdy), .err_dst_rdy_i(tx_err_dst_rdy),
- .dac_a(dac_a),.dac_b(dac_b),
+ .tx_i(tx_i),.tx_q(tx_q),
.underrun(underrun), .run(run_tx),
.debug(debug_vt));
-
+
+ tx_frontend #(.BASE(SR_TX_FRONT)) tx_frontend
+ (.clk(dsp_clk), .rst(dsp_rst),
+ .set_stb(set_stb_dsp),.set_addr(set_addr_dsp),.set_data(set_data_dsp),
+ .tx_i(tx_i), .tx_q(tx_q), .run(1'b1),
+ .dac_a(dac_a), .dac_b(dac_b));
+
// ///////////////////////////////////////////////////////////////////////////////////
// SERDES
diff --git a/usrp2/top/USRP2/u2_core.v b/usrp2/top/USRP2/u2_core.v
index 1c75f50fc..04a3cc6c9 100644
--- a/usrp2/top/USRP2/u2_core.v
+++ b/usrp2/top/USRP2/u2_core.v
@@ -684,6 +684,8 @@ module u2_core
.debug(debug_extfifo),
.debug2(debug_extfifo2) );
+ wire [23:0] tx_i, tx_q;
+
vita_tx_chain #(.BASE_CTRL(SR_TX_CTRL), .BASE_DSP(SR_TX_DSP),
.REPORT_ERROR(1), .DO_FLOW_CONTROL(1),
.PROT_ENG_FLAGS(1), .USE_TRANS_HEADER(1),
@@ -694,10 +696,16 @@ module u2_core
.vita_time(vita_time),
.tx_data_i(tx_data), .tx_src_rdy_i(tx_src_rdy), .tx_dst_rdy_o(tx_dst_rdy),
.err_data_o(tx_err_data), .err_src_rdy_o(tx_err_src_rdy), .err_dst_rdy_i(tx_err_dst_rdy),
- .dac_a(dac_a),.dac_b(dac_b),
+ .tx_i(tx_i),.tx_q(tx_q),
.underrun(underrun), .run(run_tx),
.debug(debug_vt));
-
+
+ tx_frontend #(.BASE(SR_TX_FRONT)) tx_frontend
+ (.clk(dsp_clk), .rst(dsp_rst),
+ .set_stb(set_stb_dsp),.set_addr(set_addr_dsp),.set_data(set_data_dsp),
+ .tx_i(tx_i), .tx_q(tx_q), .run(1'b1),
+ .dac_a(dac_a), .dac_b(dac_b));
+
// ///////////////////////////////////////////////////////////////////////////////////
// SERDES
diff --git a/usrp2/vrt/vita_tx_chain.v b/usrp2/vrt/vita_tx_chain.v
index 542968afa..ac9f08fc8 100644
--- a/usrp2/vrt/vita_tx_chain.v
+++ b/usrp2/vrt/vita_tx_chain.v
@@ -29,7 +29,7 @@ module vita_tx_chain
input [63:0] vita_time,
input [35:0] tx_data_i, input tx_src_rdy_i, output tx_dst_rdy_o,
output [35:0] err_data_o, output err_src_rdy_o, input err_dst_rdy_i,
- output [15:0] dac_a, output [15:0] dac_b,
+ output [23:0] tx_i, output [23:0] tx_q,
output underrun, output run,
output [31:0] debug);
@@ -84,7 +84,7 @@ module vita_tx_chain
(.clk(clk),.rst(reset),
.set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
.sample(sample_tx), .run(run), .strobe(strobe_tx),
- .dac_a(dac_a),.dac_b(dac_b),
+ .tx_i(tx_i),.tx_q(tx_q),
.debug(debug_tx_dsp) );
wire [35:0] flow_data, err_data_int;