aboutsummaryrefslogtreecommitdiffstats
path: root/usrp2/sdr_lib/tx_frontend.v
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/sdr_lib/tx_frontend.v
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/sdr_lib/tx_frontend.v')
-rw-r--r--usrp2/sdr_lib/tx_frontend.v54
1 files changed, 54 insertions, 0 deletions
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