summaryrefslogtreecommitdiffstats
path: root/fpga/usrp2/top
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-07 17:09:07 -0800
committerJosh Blum <josh@joshknows.com>2011-11-07 17:09:07 -0800
commit11f1390bbde65c60f45962acb128cac1ce21e474 (patch)
tree372f2e426781de9885889bec6aa98697006268ec /fpga/usrp2/top
parent902818f50bbd486138a7d4cd2ce9ba3661f4a732 (diff)
parentbcb80c5cf9a2117f9d6d22b8e793ea2ecb68ed1f (diff)
downloaduhd-11f1390bbde65c60f45962acb128cac1ce21e474.tar.gz
uhd-11f1390bbde65c60f45962acb128cac1ce21e474.tar.bz2
uhd-11f1390bbde65c60f45962acb128cac1ce21e474.zip
Merge branch 'fpga_master' into uhd_next
Diffstat (limited to 'fpga/usrp2/top')
-rw-r--r--fpga/usrp2/top/B100/Makefile14
-rw-r--r--fpga/usrp2/top/B100/u1plus_core.v102
-rw-r--r--fpga/usrp2/top/E1x0/Makefile17
-rw-r--r--fpga/usrp2/top/E1x0/u1e_core.v85
-rw-r--r--fpga/usrp2/top/N2x0/u2plus_core.v113
-rw-r--r--fpga/usrp2/top/USRP2/u2_core.v124
6 files changed, 182 insertions, 273 deletions
diff --git a/fpga/usrp2/top/B100/Makefile b/fpga/usrp2/top/B100/Makefile
new file mode 100644
index 000000000..3ddef1024
--- /dev/null
+++ b/fpga/usrp2/top/B100/Makefile
@@ -0,0 +1,14 @@
+#
+# Copyright 2011 Ettus Research LLC
+#
+
+all: B100
+ find -name "*.twr" | xargs grep constraint | grep met
+
+clean:
+ rm -rf build*
+
+B100:
+ make -f Makefile.$@ bin
+
+.PHONY: all clean
diff --git a/fpga/usrp2/top/B100/u1plus_core.v b/fpga/usrp2/top/B100/u1plus_core.v
index e11a4c37e..86bf747a0 100644
--- a/fpga/usrp2/top/B100/u1plus_core.v
+++ b/fpga/usrp2/top/B100/u1plus_core.v
@@ -56,17 +56,14 @@ module u1plus_core
localparam SR_CLEAR_TX_FIFO = 62; // 1 reg
localparam SR_GLOBAL_RESET = 63; // 1 reg
- wire [7:0] COMPAT_NUM = 8'd5;
+ localparam SR_GPIO = 128; // 5 regs
wire wb_clk = clk_fpga;
wire wb_rst, global_reset;
wire pps_int;
wire [63:0] vita_time, vita_time_pps;
- reg [15:0] reg_leds, reg_cgen_ctrl, reg_test;
- wire [15:0] xfer_rate = 0;
- wire [7:0] test_rate;
- wire [3:0] test_ctrl;
+ reg [15:0] reg_cgen_ctrl, reg_test;
wire [7:0] set_addr;
wire [31:0] set_data;
@@ -90,7 +87,6 @@ module u1plus_core
reset_sync reset_sync_wb(.clk(wb_clk), .reset_in(rst_fpga | global_reset), .reset_out(wb_rst));
reset_sync reset_sync_gp(.clk(gpif_clk), .reset_in(rst_fpga | global_reset), .reset_out(gpif_rst));
- wire [15:0] test_len;
// /////////////////////////////////////////////////////////////////////////////////////
// GPIF Slave to Wishbone Master
@@ -135,7 +131,7 @@ module u1plus_core
.tx_underrun(tx_underrun_gpif), .rx_overrun(rx_overrun_gpif),
- .frames_per_packet(frames_per_packet), .test_len(test_len), .test_rate(test_rate), .test_ctrl(test_ctrl),
+ .frames_per_packet(frames_per_packet),
.debug0(debug0), .debug1(debug1));
// /////////////////////////////////////////////////////////////////////////
@@ -166,7 +162,7 @@ module u1plus_core
.sample(sample_rx0), .run(run_rx0), .strobe(strobe_rx0),
.debug() );
- vita_rx_chain #(.BASE(SR_RX_CTRL0), .UNIT(0), .FIFOSIZE(9), .PROT_ENG_FLAGS(0)) vita_rx_chain0
+ vita_rx_chain #(.BASE(SR_RX_CTRL0), .UNIT(0), .FIFOSIZE(10), .PROT_ENG_FLAGS(0)) vita_rx_chain0
(.clk(wb_clk),.reset(wb_rst),.clear(clear_rx),
.set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
.vita_time(vita_time), .overrun(rx_overrun_dsp0),
@@ -189,7 +185,7 @@ module u1plus_core
.sample(sample_rx1), .run(run_rx1), .strobe(strobe_rx1),
.debug() );
- vita_rx_chain #(.BASE(SR_RX_CTRL1), .UNIT(1), .FIFOSIZE(9), .PROT_ENG_FLAGS(0)) vita_rx_chain1
+ vita_rx_chain #(.BASE(SR_RX_CTRL1), .UNIT(1), .FIFOSIZE(10), .PROT_ENG_FLAGS(0)) vita_rx_chain1
(.clk(wb_clk),.reset(wb_rst),.clear(clear_rx),
.set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
.vita_time(vita_time), .overrun(rx_overrun_dsp1),
@@ -252,14 +248,20 @@ module u1plus_core
wire s8_we,s9_we,sa_we,sb_we,sc_we,sd_we, se_we, sf_we;
wb_1master #(.dw(dw), .aw(aw), .sw(sw), .decode_w(4),
- .s0_addr(4'h0), .s0_mask(4'hF), .s1_addr(4'h1), .s1_mask(4'hF),
- .s2_addr(4'h2), .s2_mask(4'hF), .s3_addr(4'h3), .s3_mask(4'hF),
- .s4_addr(4'h4), .s4_mask(4'hF), .s5_addr(4'h5), .s5_mask(4'hF),
- .s6_addr(4'h6), .s6_mask(4'hF), .s7_addr(4'h7), .s7_mask(4'hF),
- .s8_addr(4'h8), .s8_mask(4'hE), .s9_addr(4'hf), .s9_mask(4'hF), // slave 8 is double wide
- .sa_addr(4'ha), .sa_mask(4'hF), .sb_addr(4'hb), .sb_mask(4'hF),
- .sc_addr(4'hc), .sc_mask(4'hF), .sd_addr(4'hd), .sd_mask(4'hF),
- .se_addr(4'he), .se_mask(4'hF), .sf_addr(4'hf), .sf_mask(4'hF))
+ .s0_addr(4'h0), .s0_mask(4'hF), // Misc Regs
+ .s1_addr(4'h1), .s1_mask(4'hF), // Unused
+ .s2_addr(4'h2), .s2_mask(4'hF), // SPI
+ .s3_addr(4'h3), .s3_mask(4'hF), // I2C
+ .s4_addr(4'h4), .s4_mask(4'hF), // Unused
+ .s5_addr(4'h5), .s5_mask(4'hF), // Unused on B1x0, Async Msg on E1x0
+ .s6_addr(4'h6), .s6_mask(4'hF), // Unused
+ .s7_addr(4'h7), .s7_mask(4'hF), // Readback MUX
+ .s8_addr(4'h8), .s8_mask(4'h8), // Setting Regs -- slave 8 is 8 slaves wide
+ // slaves 9-f alias to slave 1, all are unused
+ .s9_addr(4'h1), .s9_mask(4'hF),
+ .sa_addr(4'h1), .sa_mask(4'hF), .sb_addr(4'h1), .sb_mask(4'hF),
+ .sc_addr(4'h1), .sc_mask(4'hF), .sd_addr(4'h1), .sd_mask(4'hF),
+ .se_addr(4'h1), .se_mask(4'hF), .sf_addr(4'h1), .sf_mask(4'hF))
wb_1master
(.clk_i(wb_clk),.rst_i(wb_rst),
.m0_dat_o(m0_dat_miso),.m0_ack_o(m0_ack),.m0_err_o(m0_err),.m0_rty_o(m0_rty),.m0_dat_i(m0_dat_mosi),
@@ -297,76 +299,48 @@ module u1plus_core
.sf_dat_o(sf_dat_mosi),.sf_adr_o(sf_adr),.sf_sel_o(sf_sel),.sf_we_o(sf_we),.sf_cyc_o(sf_cyc),.sf_stb_o(sf_stb),
.sf_dat_i(sf_dat_miso),.sf_ack_i(sf_ack),.sf_err_i(0),.sf_rty_i(0) );
- assign s5_ack = 0;
+ assign s1_ack = 0; assign s4_ack = 0; assign s5_ack = 0; assign s6_ack = 0;
assign s9_ack = 0; assign sa_ack = 0; assign sb_ack = 0;
assign sc_ack = 0; assign sd_ack = 0; assign se_ack = 0; assign sf_ack = 0;
// /////////////////////////////////////////////////////////////////////////////////////
// Slave 0, Misc LEDs, Switches, controls
- localparam REG_LEDS = 7'd0; // out
localparam REG_CGEN_CTRL = 7'd4; // out
localparam REG_CGEN_ST = 7'd6; // in
localparam REG_TEST = 7'd8; // out
localparam REG_RX_FRAMELEN = 7'd10; // in
localparam REG_TX_FRAMELEN = 7'd12; // out
- localparam REG_XFER_RATE = 7'd14; // out
- localparam REG_COMPAT = 7'd16; // in
always @(posedge wb_clk)
if(wb_rst)
begin
- reg_leds <= 0;
reg_cgen_ctrl <= 2'b11;
reg_test <= 0;
- //xfer_rate <= 0;
frames_per_packet <= 0;
end
else
if(s0_cyc & s0_stb & s0_we)
case(s0_adr[6:0])
- REG_LEDS :
- reg_leds <= s0_dat_mosi;
REG_CGEN_CTRL :
reg_cgen_ctrl <= s0_dat_mosi;
REG_TEST :
reg_test <= s0_dat_mosi;
REG_RX_FRAMELEN :
frames_per_packet <= s0_dat_mosi[7:0];
- //REG_XFER_RATE :
- //xfer_rate <= s0_dat_mosi;
endcase // case (s0_adr[6:0])
- assign test_ctrl = xfer_rate[11:8];
- assign test_rate = xfer_rate[7:0];
- assign test_len = reg_test[15:0];
-
assign debug_led = {run_tx, (run_rx0 | run_rx1), cgen_st_ld};
assign { cgen_sync_b, cgen_ref_sel } = reg_cgen_ctrl;
- assign s0_dat_miso = (s0_adr[6:0] == REG_LEDS) ? reg_leds :
- (s0_adr[6:0] == REG_CGEN_CTRL) ? reg_cgen_ctrl :
+ assign s0_dat_miso = (s0_adr[6:0] == REG_CGEN_CTRL) ? reg_cgen_ctrl :
(s0_adr[6:0] == REG_CGEN_ST) ? {13'b0,cgen_st_status,cgen_st_ld,cgen_st_refmon} :
(s0_adr[6:0] == REG_TEST) ? reg_test :
- (s0_adr[6:0] == REG_COMPAT) ? { 8'd0, COMPAT_NUM } :
16'hBEEF;
assign s0_ack = s0_stb & s0_cyc;
// /////////////////////////////////////////////////////////////////////////////////////
- // Slave 1, UART
- // depth of 3 is 128 entries, clkdiv of 278 gives 230.4k with a 64 MHz system clock
-
-/*
- simple_uart #(.TXDEPTH(3),.RXDEPTH(3), .CLKDIV_DEFAULT(278)) uart
- (.clk_i(wb_clk),.rst_i(wb_rst),
- .we_i(s1_we),.stb_i(s1_stb),.cyc_i(s1_cyc),.ack_o(s1_ack),
- .adr_i(s1_adr[3:1]),.dat_i({16'd0,s1_dat_mosi}),.dat_o(s1_dat_miso),
- .rx_int_o(),.tx_int_o(),
- .tx_o(debug_txd),.rx_i(debug_rxd),.baud_o());
-*/
-
- // /////////////////////////////////////////////////////////////////////////////////////
// Slave 2, SPI
spi_top16 shared_spi
@@ -394,39 +368,31 @@ module u1plus_core
IOBUF sda_pin(.O(sda_pad_i), .IO(db_sda), .I(sda_pad_o), .T(sda_pad_oen_o));
// /////////////////////////////////////////////////////////////////////////
- // GPIOs -- Slave #4
+ // GPIOs
- wire [31:0] atr_lines;
- wire [31:0] debug_gpio_0, debug_gpio_1;
+ wire [31:0] gpio_readback;
- nsgpio16LE
- nsgpio16LE(.clk_i(wb_clk),.rst_i(wb_rst),
- .cyc_i(s4_cyc),.stb_i(s4_stb),.adr_i(s4_adr[3:0]),.we_i(s4_we),
- .dat_i(s4_dat_mosi),.dat_o(s4_dat_miso),.ack_o(s4_ack),
- .atr(atr_lines),.debug_0(debug_gpio_0),.debug_1(debug_gpio_1),
- .gpio( {io_tx,io_rx} ) );
+ gpio_atr #(.BASE(SR_GPIO), .WIDTH(32))
+ gpio_atr(.clk(wb_clk),.reset(wb_rst),
+ .set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
+ .rx(run_rx0 | run_rx1), .tx(run_tx),
+ .gpio({io_tx,io_rx}), .gpio_readback(gpio_readback) );
// /////////////////////////////////////////////////////////////////////////
// Settings Bus -- Slave #8 + 9
// only have 64 regs, 32 bits each with current setup...
- settings_bus_16LE #(.AWIDTH(11),.RWIDTH(6)) settings_bus_16LE
+ settings_bus_16LE #(.AWIDTH(11),.RWIDTH(8)) settings_bus_16LE
(.wb_clk(wb_clk),.wb_rst(wb_rst),.wb_adr_i(s8_adr),.wb_dat_i(s8_dat_mosi),
.wb_stb_i(s8_stb),.wb_we_i(s8_we),.wb_ack_o(s8_ack),
.strobe(set_stb),.addr(set_addr),.data(set_data) );
// /////////////////////////////////////////////////////////////////////////
- // ATR Controller -- Slave #6
-
- atr_controller16 atr_controller16
- (.clk_i(wb_clk), .rst_i(wb_rst),
- .adr_i(s6_adr[5:0]), .sel_i(s6_sel), .dat_i(s6_dat_mosi), .dat_o(s6_dat_miso),
- .we_i(s6_we), .stb_i(s6_stb), .cyc_i(s6_cyc), .ack_o(s6_ack),
- .run_rx(run_rx0 | run_rx1), .run_tx(run_tx), .ctrl_lines(atr_lines));
-
- // /////////////////////////////////////////////////////////////////////////
// Readback mux 32 -- Slave #7
+ //compatibility number -> increment when the fpga has been sufficiently altered
+ localparam compat_num = {16'd8, 16'd0}; //major, minor
+
wire [31:0] reg_test32;
setting_reg #(.my_addr(SR_REG_TEST32)) sr_reg_test32
@@ -440,7 +406,7 @@ module u1plus_core
.word00(vita_time[63:32]), .word01(vita_time[31:0]),
.word02(vita_time_pps[63:32]), .word03(vita_time_pps[31:0]),
.word04(reg_test32), .word05(32'b0),
- .word06(32'b0), .word07(32'b0),
+ .word06(compat_num), .word07(gpio_readback),
.word08(32'b0), .word09(32'b0),
.word10(32'b0), .word11(32'b0),
.word12(32'b0), .word13(32'b0),
@@ -460,7 +426,5 @@ module u1plus_core
assign debug_clk = 2'b00; // { gpif_clk, clk_fpga };
assign debug = 0;
- assign debug_gpio_0 = 0;
- assign debug_gpio_1 = 0;
endmodule // u1plus_core
diff --git a/fpga/usrp2/top/E1x0/Makefile b/fpga/usrp2/top/E1x0/Makefile
new file mode 100644
index 000000000..0ca8ed2dd
--- /dev/null
+++ b/fpga/usrp2/top/E1x0/Makefile
@@ -0,0 +1,17 @@
+#
+# Copyright 2011 Ettus Research LLC
+#
+
+all: E100 E110
+ find -name "*.twr" | xargs grep constraint | grep met
+
+clean:
+ rm -rf build*
+
+E100:
+ make -f Makefile.$@ bin
+
+E110:
+ make -f Makefile.$@ bin
+
+.PHONY: all clean
diff --git a/fpga/usrp2/top/E1x0/u1e_core.v b/fpga/usrp2/top/E1x0/u1e_core.v
index adc3c5aab..496a7ef4c 100644
--- a/fpga/usrp2/top/E1x0/u1e_core.v
+++ b/fpga/usrp2/top/E1x0/u1e_core.v
@@ -60,14 +60,14 @@ module u1e_core
localparam SR_CLEAR_TX_FIFO = 62; // 1 reg
localparam SR_GLOBAL_RESET = 63; // 1 reg
- wire [7:0] COMPAT_NUM = 8'd6;
+ localparam SR_GPIO = 128; // 5 regs
wire wb_clk = clk_fpga;
wire wb_rst, global_reset;
wire pps_int;
wire [63:0] vita_time, vita_time_pps;
- reg [15:0] reg_leds, reg_cgen_ctrl, reg_test, xfer_rate;
+ reg [15:0] reg_cgen_ctrl, reg_test, xfer_rate;
wire [7:0] test_rate;
wire [3:0] test_ctrl;
@@ -167,7 +167,7 @@ module u1e_core
.sample(sample_rx0), .run(run_rx0), .strobe(strobe_rx0),
.debug() );
- vita_rx_chain #(.BASE(SR_RX_CTRL0), .UNIT(0), .FIFOSIZE(9), .PROT_ENG_FLAGS(0)) vita_rx_chain0
+ vita_rx_chain #(.BASE(SR_RX_CTRL0), .UNIT(0), .FIFOSIZE(10), .PROT_ENG_FLAGS(0)) vita_rx_chain0
(.clk(wb_clk),.reset(wb_rst),.clear(clear_rx),
.set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
.vita_time(vita_time), .overrun(rx_overrun_dsp0),
@@ -190,7 +190,7 @@ module u1e_core
.sample(sample_rx1), .run(run_rx1), .strobe(strobe_rx1),
.debug() );
- vita_rx_chain #(.BASE(SR_RX_CTRL1), .UNIT(1), .FIFOSIZE(9), .PROT_ENG_FLAGS(0)) vita_rx_chain1
+ vita_rx_chain #(.BASE(SR_RX_CTRL1), .UNIT(1), .FIFOSIZE(10), .PROT_ENG_FLAGS(0)) vita_rx_chain1
(.clk(wb_clk),.reset(wb_rst),.clear(clear_rx),
.set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
.vita_time(vita_time), .overrun(rx_overrun_dsp1),
@@ -253,14 +253,20 @@ module u1e_core
wire s8_we,s9_we,sa_we,sb_we,sc_we,sd_we, se_we, sf_we;
wb_1master #(.dw(dw), .aw(aw), .sw(sw), .decode_w(4),
- .s0_addr(4'h0), .s0_mask(4'hF), .s1_addr(4'h1), .s1_mask(4'hF),
- .s2_addr(4'h2), .s2_mask(4'hF), .s3_addr(4'h3), .s3_mask(4'hF),
- .s4_addr(4'h4), .s4_mask(4'hF), .s5_addr(4'h5), .s5_mask(4'hF),
- .s6_addr(4'h6), .s6_mask(4'hF), .s7_addr(4'h7), .s7_mask(4'hF),
- .s8_addr(4'h8), .s8_mask(4'hE), .s9_addr(4'hf), .s9_mask(4'hF), // slave 8 is double wide
- .sa_addr(4'ha), .sa_mask(4'hF), .sb_addr(4'hb), .sb_mask(4'hF),
- .sc_addr(4'hc), .sc_mask(4'hF), .sd_addr(4'hd), .sd_mask(4'hF),
- .se_addr(4'he), .se_mask(4'hF), .sf_addr(4'hf), .sf_mask(4'hF))
+ .s0_addr(4'h0), .s0_mask(4'hF), // Misc Regs
+ .s1_addr(4'h1), .s1_mask(4'hF), // Unused
+ .s2_addr(4'h2), .s2_mask(4'hF), // SPI
+ .s3_addr(4'h3), .s3_mask(4'hF), // I2C
+ .s4_addr(4'h4), .s4_mask(4'hF), // Unused
+ .s5_addr(4'h5), .s5_mask(4'hF), // Unused on B1x0, Async Msg on E1x0
+ .s6_addr(4'h6), .s6_mask(4'hF), // Unused
+ .s7_addr(4'h7), .s7_mask(4'hF), // Readback MUX
+ .s8_addr(4'h8), .s8_mask(4'h8), // Setting Regs -- slave 8 is 8 slaves wide
+ // slaves 9-f alias to slave 1, all are unused
+ .s9_addr(4'h1), .s9_mask(4'hF),
+ .sa_addr(4'h1), .sa_mask(4'hF), .sb_addr(4'h1), .sb_mask(4'hF),
+ .sc_addr(4'h1), .sc_mask(4'hF), .sd_addr(4'h1), .sd_mask(4'hF),
+ .se_addr(4'h1), .se_mask(4'hF), .sf_addr(4'h1), .sf_mask(4'hF))
wb_1master
(.clk_i(wb_clk),.rst_i(wb_rst),
.m0_dat_o(m0_dat_miso),.m0_ack_o(m0_ack),.m0_err_o(m0_err),.m0_rty_o(m0_rty),.m0_dat_i(m0_dat_mosi),
@@ -298,23 +304,21 @@ module u1e_core
.sf_dat_o(sf_dat_mosi),.sf_adr_o(sf_adr),.sf_sel_o(sf_sel),.sf_we_o(sf_we),.sf_cyc_o(sf_cyc),.sf_stb_o(sf_stb),
.sf_dat_i(sf_dat_miso),.sf_ack_i(sf_ack),.sf_err_i(0),.sf_rty_i(0) );
+ assign s1_ack = 0; assign s4_ack = 0; assign s6_ack = 0;
assign s9_ack = 0; assign sa_ack = 0; assign sb_ack = 0;
assign sc_ack = 0; assign sd_ack = 0; assign se_ack = 0; assign sf_ack = 0;
// /////////////////////////////////////////////////////////////////////////////////////
// Slave 0, Misc LEDs, Switches, controls
- localparam REG_LEDS = 7'd0; // out
localparam REG_CGEN_CTRL = 7'd4; // out
localparam REG_CGEN_ST = 7'd6; // in
localparam REG_TEST = 7'd8; // out
localparam REG_XFER_RATE = 7'd14; // out
- localparam REG_COMPAT = 7'd16; // in
always @(posedge wb_clk)
if(wb_rst)
begin
- reg_leds <= 0;
reg_cgen_ctrl <= 2'b11;
reg_test <= 0;
xfer_rate <= 0;
@@ -322,8 +326,6 @@ module u1e_core
else
if(s0_cyc & s0_stb & s0_we)
case(s0_adr[6:0])
- REG_LEDS :
- reg_leds <= s0_dat_mosi;
REG_CGEN_CTRL :
reg_cgen_ctrl <= s0_dat_mosi;
REG_TEST :
@@ -338,27 +340,14 @@ module u1e_core
assign { debug_led[3:0] } = ~{1'b1, run_tx, run_rx0 | run_rx1, cgen_st_ld};
assign { cgen_sync_b, cgen_ref_sel } = reg_cgen_ctrl;
- assign s0_dat_miso = (s0_adr[6:0] == REG_LEDS) ? reg_leds :
- (s0_adr[6:0] == REG_CGEN_CTRL) ? reg_cgen_ctrl :
+ assign s0_dat_miso = (s0_adr[6:0] == REG_CGEN_CTRL) ? reg_cgen_ctrl :
(s0_adr[6:0] == REG_CGEN_ST) ? {13'b0,cgen_st_status,cgen_st_ld,cgen_st_refmon} :
(s0_adr[6:0] == REG_TEST) ? reg_test :
- (s0_adr[6:0] == REG_COMPAT) ? { 8'd0, COMPAT_NUM } :
16'hBEEF;
assign s0_ack = s0_stb & s0_cyc;
// /////////////////////////////////////////////////////////////////////////////////////
- // Slave 1, UART
- // depth of 3 is 128 entries, clkdiv of 278 gives 230.4k with a 64 MHz system clock
-
- simple_uart #(.TXDEPTH(3),.RXDEPTH(3), .CLKDIV_DEFAULT(278)) uart
- (.clk_i(wb_clk),.rst_i(wb_rst),
- .we_i(s1_we),.stb_i(s1_stb),.cyc_i(s1_cyc),.ack_o(s1_ack),
- .adr_i(s1_adr[3:1]),.dat_i({16'd0,s1_dat_mosi}),.dat_o(s1_dat_miso),
- .rx_int_o(),.tx_int_o(),
- .tx_o(debug_txd),.rx_i(debug_rxd),.baud_o());
-
- // /////////////////////////////////////////////////////////////////////////////////////
// Slave 2, SPI
spi_top16 shared_spi
@@ -386,17 +375,15 @@ module u1e_core
IOBUF sda_pin(.O(sda_pad_i), .IO(db_sda), .I(sda_pad_o), .T(sda_pad_oen_o));
// /////////////////////////////////////////////////////////////////////////
- // GPIOs -- Slave #4
+ // GPIOs
- wire [31:0] atr_lines;
- wire [31:0] debug_gpio_0, debug_gpio_1;
+ wire [31:0] gpio_readback;
- nsgpio16LE
- nsgpio16LE(.clk_i(wb_clk),.rst_i(wb_rst),
- .cyc_i(s4_cyc),.stb_i(s4_stb),.adr_i(s4_adr[3:0]),.we_i(s4_we),
- .dat_i(s4_dat_mosi),.dat_o(s4_dat_miso),.ack_o(s4_ack),
- .atr(atr_lines),.debug_0(debug_gpio_0),.debug_1(debug_gpio_1),
- .gpio( {io_tx,io_rx} ) );
+ gpio_atr #(.BASE(SR_GPIO), .WIDTH(32))
+ gpio_atr(.clk(wb_clk),.reset(wb_rst),
+ .set_stb(set_stb),.set_addr(set_addr),.set_data(set_data),
+ .rx(run_rx0 | run_rx1), .tx(run_tx),
+ .gpio({io_tx,io_rx}), .gpio_readback(gpio_readback) );
////////////////////////////////////////////////////////////////////////////
// FIFO to WB slave for async messages - Slave #5
@@ -440,23 +427,17 @@ module u1e_core
// Settings Bus -- Slave #8 + 9
// only have 64 regs, 32 bits each with current setup...
- settings_bus_16LE #(.AWIDTH(11),.RWIDTH(6)) settings_bus_16LE
+ settings_bus_16LE #(.AWIDTH(11),.RWIDTH(8)) settings_bus_16LE
(.wb_clk(wb_clk),.wb_rst(wb_rst),.wb_adr_i(s8_adr),.wb_dat_i(s8_dat_mosi),
.wb_stb_i(s8_stb),.wb_we_i(s8_we),.wb_ack_o(s8_ack),
.strobe(set_stb),.addr(set_addr),.data(set_data) );
// /////////////////////////////////////////////////////////////////////////
- // ATR Controller -- Slave #6
-
- atr_controller16 atr_controller16
- (.clk_i(wb_clk), .rst_i(wb_rst),
- .adr_i(s6_adr[5:0]), .sel_i(s6_sel), .dat_i(s6_dat_mosi), .dat_o(s6_dat_miso),
- .we_i(s6_we), .stb_i(s6_stb), .cyc_i(s6_cyc), .ack_o(s6_ack),
- .run_rx(run_rx0 | run_rx1), .run_tx(run_tx), .ctrl_lines(atr_lines));
-
- // /////////////////////////////////////////////////////////////////////////
// Readback mux 32 -- Slave #7
+ //compatibility number -> increment when the fpga has been sufficiently altered
+ localparam compat_num = {16'd8, 16'd0}; //major, minor
+
wire [31:0] reg_test32;
//this setting reg is persistent across resets, to check for fpga loaded
@@ -471,7 +452,7 @@ module u1e_core
.word00(vita_time[63:32]), .word01(vita_time[31:0]),
.word02(vita_time_pps[63:32]), .word03(vita_time_pps[31:0]),
.word04(reg_test32), .word05(err_status),
- .word06(32'b0), .word07(32'b0),
+ .word06(compat_num), .word07(gpio_readback),
.word08(32'b0), .word09(32'b0),
.word10(32'b0), .word11(32'b0),
.word12(32'b0), .word13(32'b0),
@@ -491,7 +472,5 @@ module u1e_core
assign debug_clk = 2'b00; //{ EM_CLK, clk_fpga };
assign debug = 0;
- assign debug_gpio_0 = 0;
- assign debug_gpio_1 = 0;
endmodule // u1e_core
diff --git a/fpga/usrp2/top/N2x0/u2plus_core.v b/fpga/usrp2/top/N2x0/u2plus_core.v
index 4d612bfab..dd3d33b37 100644
--- a/fpga/usrp2/top/N2x0/u2plus_core.v
+++ b/fpga/usrp2/top/N2x0/u2plus_core.v
@@ -129,7 +129,7 @@ module u2plus_core
// External RAM
input [35:0] RAM_D_pi,
output [35:0] RAM_D_po,
- output RAM_D_poe,
+ output RAM_D_poe,
output [20:0] RAM_A,
output RAM_CE1n,
output RAM_CENn,
@@ -163,6 +163,7 @@ module u2plus_core
localparam SR_TX_CTRL = 144; // 6
localparam SR_TX_DSP = 160; // 5
+ localparam SR_GPIO = 184; // 5
localparam SR_UDP_SM = 192; // 64
// FIFO Sizes, 9 = 512 lines, 10 = 1024, 11 = 2048
@@ -227,14 +228,14 @@ module u2plus_core
.s1_addr(8'b0100_0000),.s1_mask(8'b1111_0000), // Packet Router (16-20K)
.s2_addr(8'b0101_0000),.s2_mask(8'b1111_1100), // SPI
.s3_addr(8'b0101_0100),.s3_mask(8'b1111_1100), // I2C
- .s4_addr(8'b0101_1000),.s4_mask(8'b1111_1100), // GPIO
+ .s4_addr(8'b0101_1000),.s4_mask(8'b1111_1100), // Unused
.s5_addr(8'b0101_1100),.s5_mask(8'b1111_1100), // Readback
.s6_addr(8'b0110_0000),.s6_mask(8'b1111_0000), // Ethernet MAC
- .s7_addr(8'b0111_0000),.s7_mask(8'b1111_0000), // 20K-24K, Settings Bus (only uses 1K)
+ .s7_addr(8'b0111_0000),.s7_mask(8'b1111_0000), // Settings Bus (only uses 1K)
.s8_addr(8'b1000_0000),.s8_mask(8'b1111_1100), // PIC
.s9_addr(8'b1000_0100),.s9_mask(8'b1111_1100), // Unused
.sa_addr(8'b1000_1000),.sa_mask(8'b1111_1100), // UART
- .sb_addr(8'b1000_1100),.sb_mask(8'b1111_1100), // ATR
+ .sb_addr(8'b1000_1100),.sb_mask(8'b1111_1100), // Unused
.sc_addr(8'b1001_0000),.sc_mask(8'b1111_0000), // Unused
.sd_addr(8'b1010_0000),.sd_mask(8'b1111_0000), // ICAP
.se_addr(8'b1011_0000),.se_mask(8'b1111_0000), // SPI Flash
@@ -275,7 +276,11 @@ module u2plus_core
.se_dat_i(se_dat_i),.se_ack_i(se_ack),.se_err_i(0),.se_rty_i(0),
.sf_dat_o(sf_dat_o),.sf_adr_o(sf_adr),.sf_sel_o(sf_sel),.sf_we_o(sf_we),.sf_cyc_o(sf_cyc),.sf_stb_o(sf_stb),
.sf_dat_i(sf_dat_i),.sf_ack_i(sf_ack),.sf_err_i(0),.sf_rty_i(0));
-
+
+ // Unused Slaves 9, b, c
+ assign s4_ack = 0;
+ assign s9_ack = 0; assign sb_ack = 0; assign sc_ack = 0;
+
// ////////////////////////////////////////////////////////////////////////////////////////
// Reset Controller
@@ -416,18 +421,21 @@ module u2plus_core
assign s3_dat_i[31:8] = 24'd0;
// /////////////////////////////////////////////////////////////////////////
- // GPIOs -- Slave #4
+ // GPIOs
- nsgpio nsgpio(.clk_i(wb_clk),.rst_i(wb_rst),
- .cyc_i(s4_cyc),.stb_i(s4_stb),.adr_i(s4_adr[4:0]),.we_i(s4_we),
- .dat_i(s4_dat_o),.dat_o(s4_dat_i),.ack_o(s4_ack),
- .rx(run_rx0_d1 | rx_rx1_d1), .tx(run_tx), .gpio({io_tx,io_rx}) );
+ wire [31:0] gpio_readback;
+
+ gpio_atr #(.BASE(SR_GPIO), .WIDTH(32))
+ gpio_atr(.clk(dsp_clk),.reset(dsp_rst),
+ .set_stb(set_stb_dsp),.set_addr(set_addr_dsp),.set_data(set_data_dsp),
+ .rx(run_rx0_d1 | run_rx1_d1), .tx(run_tx),
+ .gpio({io_tx,io_rx}), .gpio_readback(gpio_readback) );
// /////////////////////////////////////////////////////////////////////////
// Buffer Pool Status -- Slave #5
//compatibility number -> increment when the fpga has been sufficiently altered
- localparam compat_num = {16'd7, 16'd3}; //major, minor
+ localparam compat_num = {16'd8, 16'd0}; //major, minor
wb_readback_mux buff_pool_status
(.wb_clk_i(wb_clk), .wb_rst_i(wb_rst), .wb_stb_i(s5_stb),
@@ -435,8 +443,8 @@ module u2plus_core
.word00(32'b0),.word01(32'b0),.word02(32'b0),.word03(32'b0),
.word04(32'b0),.word05(32'b0),.word06(32'b0),.word07(32'b0),
- .word08(status),.word09(32'b0),.word10(vita_time[63:32]),
- .word11(vita_time[31:0]),.word12(compat_num),.word13(irq),
+ .word08(status),.word09(gpio_readback),.word10(vita_time[63:32]),
+ .word11(vita_time[31:0]),.word12(compat_num),.word13({18'b0, button, 13'b0}),
.word14(vita_time_pps[63:32]),.word15(vita_time_pps[31:0])
);
@@ -480,16 +488,20 @@ module u2plus_core
wire phy_reset;
assign PHY_RESETn = ~phy_reset;
- setting_reg #(.my_addr(SR_MISC+0),.width(8)) sr_clk (.clk(wb_clk),.rst(wb_rst),.strobe(s7_ack),.addr(set_addr),
- .in(set_data),.out(clock_outs),.changed());
- setting_reg #(.my_addr(SR_MISC+1),.width(8)) sr_ser (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(serdes_outs),.changed());
- setting_reg #(.my_addr(SR_MISC+2),.width(8)) sr_adc (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(adc_outs),.changed());
- setting_reg #(.my_addr(SR_MISC+4),.width(1)) sr_phy (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(phy_reset),.changed());
- setting_reg #(.my_addr(SR_MISC+5),.width(1)) sr_bld (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(bldr_done),.changed());
+ setting_reg #(.my_addr(SR_MISC+0),.width(8)) sr_clk
+ (.clk(wb_clk),.rst(wb_rst),.strobe(s7_ack),.addr(set_addr),.in(set_data),.out(clock_outs),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+1),.width(8)) sr_ser
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(serdes_outs),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+2),.width(8)) sr_adc
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(adc_outs),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+4),.width(1)) sr_phy
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(phy_reset),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+5),.width(1)) sr_bld
+ (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),.in(set_data),.out(bldr_done),.changed());
// /////////////////////////////////////////////////////////////////////////
// LEDS
@@ -500,48 +512,27 @@ module u2plus_core
wire [7:0] led_src, led_sw;
wire [7:0] led_hw = {run_tx, (run_rx0_d1 | run_rx1_d1), clk_status, serdes_link_up & good_sync, 1'b0};
- setting_reg #(.my_addr(SR_MISC+3),.width(8)) sr_led (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(led_sw),.changed());
+ setting_reg #(.my_addr(SR_MISC+3),.width(8)) sr_led
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(led_sw),.changed());
- setting_reg #(.my_addr(SR_MISC+6),.width(8), .at_reset(8'b0001_1110))
- sr_led_src (.clk(wb_clk),.rst(wb_rst), .strobe(set_stb),.addr(set_addr), .in(set_data),.out(led_src),.changed());
+ setting_reg #(.my_addr(SR_MISC+6),.width(8), .at_reset(8'b0001_1110)) sr_led_src
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp), .in(set_data_dsp),.out(led_src),.changed());
assign leds = (led_src & led_hw) | (~led_src & led_sw);
// /////////////////////////////////////////////////////////////////////////
// Interrupt Controller, Slave #8
- // Pass interrupts on dsp_clk to wb_clk. These need edge triggering in the pic
- wire underrun_wb, overrun_wb, pps_wb;
-
- oneshot_2clk underrun_1s (.clk_in(dsp_clk), .in(underrun), .clk_out(wb_clk), .out(underrun_wb));
- oneshot_2clk overrun_1s (.clk_in(dsp_clk), .in(overrun0 | overrun1), .clk_out(wb_clk), .out(overrun_wb));
- oneshot_2clk pps_1s (.clk_in(dsp_clk), .in(pps_int), .clk_out(wb_clk), .out(pps_wb));
-
assign irq= {{8'b0},
{uart_tx_int[3:0], uart_rx_int[3:0]},
- {2'b0, button, periodic_int, clk_status, serdes_link_up, 2'b00},
- {pps_wb,overrun_wb,underrun_wb,PHY_INTn,i2c_int,spi_int,onetime_int,buffer_int}};
+ {4'b0, clk_status, 3'b0},
+ {3'b0, PHY_INTn,i2c_int,spi_int,2'b00}};
pic pic(.clk_i(wb_clk),.rst_i(wb_rst),.cyc_i(s8_cyc),.stb_i(s8_stb),.adr_i(s8_adr[4:2]),
.we_i(s8_we),.dat_i(s8_dat_o),.dat_o(s8_dat_i),.ack_o(s8_ack),.int_o(proc_int),
.irq(irq) );
// /////////////////////////////////////////////////////////////////////////
- // Master Timer, Slave #9
-
- // No longer used, replaced with simple_timer below
- assign s9_ack = 0;
-
- // /////////////////////////////////////////////////////////////////////////
- // Simple Timer interrupts
- /*
- simple_timer #(.BASE(SR_SIMTIMER)) simple_timer
- (.clk(wb_clk), .reset(wb_rst),
- .set_stb(set_stb), .set_addr(set_addr), .set_data(set_data),
- .onetime_int(onetime_int), .periodic_int(periodic_int));
- */
- // /////////////////////////////////////////////////////////////////////////
// UART, Slave #10
quad_uart #(.TXDEPTH(3),.RXDEPTH(3)) uart // depth of 3 is 128 entries
@@ -550,24 +541,6 @@ module u2plus_core
.adr_i(sa_adr[6:2]),.dat_i(sa_dat_o),.dat_o(sa_dat_i),
.rx_int_o(uart_rx_int),.tx_int_o(uart_tx_int),
.tx_o(uart_tx_o),.rx_i(uart_rx_i),.baud_o(uart_baud_o));
-
- // /////////////////////////////////////////////////////////////////////////
- // ATR Controller, Slave #11
-
- /*
- atr_controller atr_controller
- (.clk_i(wb_clk),.rst_i(wb_rst),
- .adr_i(sb_adr[5:0]),.sel_i(sb_sel),.dat_i(sb_dat_o),.dat_o(sb_dat_i),
- .we_i(sb_we),.stb_i(sb_stb),.cyc_i(sb_cyc),.ack_o(sb_ack),
- .run_rx(run_rx0_d1 | run_rx1_d1),.run_tx(run_tx),.ctrl_lines(atr_lines) );
- */
-
- // //////////////////////////////////////////////////////////////////////////
- // Time Sync, Slave #12
-
- // No longer used, see time_64bit. Still need to handle mimo time, though
- assign sc_ack = 0;
-
// /////////////////////////////////////////////////////////////////////////
// ICAP for reprogramming the FPGA, Slave #13 (D)
@@ -660,8 +633,8 @@ module u2plus_core
wire clear_tx;
setting_reg #(.my_addr(SR_TX_CTRL+1)) sr_clear_tx
- (.clk(clk),.rst(rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(),.changed(clear_tx));
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),
+ .in(set_data_dsp),.out(),.changed(clear_tx));
assign RAM_A[20:18] = 3'b0;
diff --git a/fpga/usrp2/top/USRP2/u2_core.v b/fpga/usrp2/top/USRP2/u2_core.v
index 7415f68e5..d3524c304 100644
--- a/fpga/usrp2/top/USRP2/u2_core.v
+++ b/fpga/usrp2/top/USRP2/u2_core.v
@@ -136,7 +136,7 @@ module u2_core
// External RAM
input [17:0] RAM_D_pi,
- output [17:0] RAM_D_po,
+ output [17:0] RAM_D_po,
output RAM_D_poe,
output [18:0] RAM_A,
output RAM_CE1n,
@@ -168,6 +168,7 @@ module u2_core
localparam SR_TX_CTRL = 144; // 6
localparam SR_TX_DSP = 160; // 5
+ localparam SR_GPIO = 184; // 5
localparam SR_UDP_SM = 192; // 64
// FIFO Sizes, 9 = 512 lines, 10 = 1024, 11 = 2048
@@ -233,16 +234,16 @@ module u2_core
.s1_addr(8'b0100_0000),.s1_mask(8'b1111_0000), // Packet Router (16-20K)
.s2_addr(8'b0101_0000),.s2_mask(8'b1111_1100), // SPI
.s3_addr(8'b0101_0100),.s3_mask(8'b1111_1100), // I2C
- .s4_addr(8'b0101_1000),.s4_mask(8'b1111_1100), // GPIO
+ .s4_addr(8'b0101_1000),.s4_mask(8'b1111_1100), // Unused
.s5_addr(8'b0101_1100),.s5_mask(8'b1111_1100), // Readback
.s6_addr(8'b0110_0000),.s6_mask(8'b1111_0000), // Ethernet MAC
- .s7_addr(8'b0111_0000),.s7_mask(8'b1111_0000), // 20K-24K, Settings Bus (only uses 1K)
+ .s7_addr(8'b0111_0000),.s7_mask(8'b1111_0000), // Settings Bus (only uses 1K)
.s8_addr(8'b1000_0000),.s8_mask(8'b1111_1100), // PIC
.s9_addr(8'b1000_0100),.s9_mask(8'b1111_1100), // Unused
.sa_addr(8'b1000_1000),.sa_mask(8'b1111_1100), // UART
- .sb_addr(8'b1000_1100),.sb_mask(8'b1111_1100), // ATR
+ .sb_addr(8'b1000_1100),.sb_mask(8'b1111_1100), // Unused
.sc_addr(8'b1001_0000),.sc_mask(8'b1111_0000), // Unused
- .sd_addr(8'b1010_0000),.sd_mask(8'b1111_0000), // SD Card access
+ .sd_addr(8'b1010_0000),.sd_mask(8'b1111_0000), // Unused
.se_addr(8'b1011_0000),.se_mask(8'b1111_0000), // Unused
.sf_addr(8'b1100_0000),.sf_mask(8'b1100_0000), // Unused
.dw(dw),.aw(aw),.sw(sw)) wb_1master
@@ -281,7 +282,12 @@ module u2_core
.se_dat_i(se_dat_i),.se_ack_i(se_ack),.se_err_i(0),.se_rty_i(0),
.sf_dat_o(sf_dat_o),.sf_adr_o(sf_adr),.sf_sel_o(sf_sel),.sf_we_o(sf_we),.sf_cyc_o(sf_cyc),.sf_stb_o(sf_stb),
.sf_dat_i(sf_dat_i),.sf_ack_i(sf_ack),.sf_err_i(0),.sf_rty_i(0));
-
+
+ // Unused Slaves 4, 9 and b-f
+ assign s4_ack = 0;
+ assign s9_ack = 0; assign sb_ack = 0; assign sc_ack = 0;
+ assign sd_ack = 0; assign se_ack = 0; assign fc_ack = 0;
+
// ////////////////////////////////////////////////////////////////////////////////////////
// Reset Controller
system_control sysctrl (.wb_clk_i(wb_clk), // .por_i(por),
@@ -421,18 +427,21 @@ module u2_core
assign s3_dat_i[31:8] = 24'd0;
// /////////////////////////////////////////////////////////////////////////
- // GPIOs -- Slave #4
+ // GPIOs
- nsgpio nsgpio(.clk_i(wb_clk),.rst_i(wb_rst),
- .cyc_i(s4_cyc),.stb_i(s4_stb),.adr_i(s4_adr[4:0]),.we_i(s4_we),
- .dat_i(s4_dat_o),.dat_o(s4_dat_i),.ack_o(s4_ack),
- .rx(run_rx0_d1 | rx_rx1_d1), .tx(run_tx), .gpio({io_tx,io_rx}) );
+ wire [31:0] gpio_readback;
+
+ gpio_atr #(.BASE(SR_GPIO), .WIDTH(32))
+ gpio_atr(.clk(dsp_clk),.reset(dsp_rst),
+ .set_stb(set_stb_dsp),.set_addr(set_addr_dsp),.set_data(set_data_dsp),
+ .rx(run_rx0_d1 | run_rx1_d1), .tx(run_tx),
+ .gpio({io_tx,io_rx}), .gpio_readback(gpio_readback) );
// /////////////////////////////////////////////////////////////////////////
// Buffer Pool Status -- Slave #5
//compatibility number -> increment when the fpga has been sufficiently altered
- localparam compat_num = {16'd7, 16'd3}; //major, minor
+ localparam compat_num = {16'd8, 16'd0}; //major, minor
wb_readback_mux buff_pool_status
(.wb_clk_i(wb_clk), .wb_rst_i(wb_rst), .wb_stb_i(s5_stb),
@@ -440,8 +449,8 @@ module u2_core
.word00(32'b0),.word01(32'b0),.word02(32'b0),.word03(32'b0),
.word04(32'b0),.word05(32'b0),.word06(32'b0),.word07(32'b0),
- .word08(status),.word09(32'b0),.word10(vita_time[63:32]),
- .word11(vita_time[31:0]),.word12(compat_num),.word13(irq),
+ .word08(status),.word09(gpio_readback),.word10(vita_time[63:32]),
+ .word11(vita_time[31:0]),.word12(compat_num),.word13(32'b0),
.word14(vita_time_pps[63:32]),.word15(vita_time_pps[31:0])
);
@@ -485,14 +494,17 @@ module u2_core
wire phy_reset;
assign PHY_RESETn = ~phy_reset;
- setting_reg #(.my_addr(SR_MISC+0),.width(8)) sr_clk (.clk(wb_clk),.rst(wb_rst),.strobe(s7_ack),.addr(set_addr),
- .in(set_data),.out(clock_outs),.changed());
- setting_reg #(.my_addr(SR_MISC+1),.width(8)) sr_ser (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(serdes_outs),.changed());
- setting_reg #(.my_addr(SR_MISC+2),.width(8)) sr_adc (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(adc_outs),.changed());
- setting_reg #(.my_addr(SR_MISC+4),.width(1)) sr_phy (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(phy_reset),.changed());
+ setting_reg #(.my_addr(SR_MISC+0),.width(8)) sr_clk
+ (.clk(wb_clk),.rst(wb_rst),.strobe(s7_ack),.addr(set_addr),.in(set_data),.out(clock_outs),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+1),.width(8)) sr_ser
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(serdes_outs),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+2),.width(8)) sr_adc
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(adc_outs),.changed());
+
+ setting_reg #(.my_addr(SR_MISC+4),.width(1)) sr_phy
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(phy_reset),.changed());
// /////////////////////////////////////////////////////////////////////////
// LEDS
@@ -503,48 +515,27 @@ module u2_core
wire [7:0] led_src, led_sw;
wire [7:0] led_hw = {run_tx, (run_rx0_d1 | run_rx1_d1), clk_status, serdes_link_up & good_sync, 1'b0};
- setting_reg #(.my_addr(SR_MISC+3),.width(8)) sr_led (.clk(wb_clk),.rst(wb_rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(led_sw),.changed());
+ setting_reg #(.my_addr(SR_MISC+3),.width(8)) sr_led
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),.in(set_data_dsp),.out(led_sw),.changed());
- setting_reg #(.my_addr(SR_MISC+6),.width(8), .at_reset(8'b0001_1110))
- sr_led_src (.clk(wb_clk),.rst(wb_rst), .strobe(set_stb),.addr(set_addr), .in(set_data),.out(led_src),.changed());
+ setting_reg #(.my_addr(SR_MISC+6),.width(8), .at_reset(8'b0001_1110)) sr_led_src
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp), .in(set_data_dsp),.out(led_src),.changed());
assign leds = (led_src & led_hw) | (~led_src & led_sw);
// /////////////////////////////////////////////////////////////////////////
// Interrupt Controller, Slave #8
- // Pass interrupts on dsp_clk to wb_clk. These need edge triggering in the pic
- wire underrun_wb, overrun_wb, pps_wb;
-
- oneshot_2clk underrun_1s (.clk_in(dsp_clk), .in(underrun), .clk_out(wb_clk), .out(underrun_wb));
- oneshot_2clk overrun_1s (.clk_in(dsp_clk), .in(overrun0 | overrun1), .clk_out(wb_clk), .out(overrun_wb));
- oneshot_2clk pps_1s (.clk_in(dsp_clk), .in(pps_int), .clk_out(wb_clk), .out(pps_wb));
-
assign irq= {{8'b0},
- {8'b0},
- {2'b0, good_sync, periodic_int, clk_status, serdes_link_up, uart_tx_int, uart_rx_int},
- {pps_wb,overrun_wb,underrun_wb,PHY_INTn,i2c_int,spi_int,onetime_int,buffer_int}};
+ {3'b0, uart_tx_int, 2'b0, uart_rx_int},
+ {4'b0, clk_status, 3'b0},
+ {3'b0, PHY_INTn,i2c_int,spi_int,2'b00}};
pic pic(.clk_i(wb_clk),.rst_i(wb_rst),.cyc_i(s8_cyc),.stb_i(s8_stb),.adr_i(s8_adr[4:2]),
.we_i(s8_we),.dat_i(s8_dat_o),.dat_o(s8_dat_i),.ack_o(s8_ack),.int_o(proc_int),
.irq(irq) );
// /////////////////////////////////////////////////////////////////////////
- // Master Timer, Slave #9
-
- // No longer used, replaced with simple_timer below
- assign s9_ack = 0;
-
- // /////////////////////////////////////////////////////////////////////////
- // Simple Timer interrupts
- /*
- simple_timer #(.BASE(SR_SIMTIMER)) simple_timer
- (.clk(wb_clk), .reset(wb_rst),
- .set_stb(set_stb), .set_addr(set_addr), .set_data(set_data),
- .onetime_int(onetime_int), .periodic_int(periodic_int));
- */
- // /////////////////////////////////////////////////////////////////////////
// UART, Slave #10
simple_uart #(.TXDEPTH(3),.RXDEPTH(3)) uart // depth of 3 is 128 entries
@@ -553,36 +544,7 @@ module u2_core
.adr_i(sa_adr[4:2]),.dat_i(sa_dat_o),.dat_o(sa_dat_i),
.rx_int_o(uart_rx_int),.tx_int_o(uart_tx_int),
.tx_o(uart_tx_o),.rx_i(uart_rx_i),.baud_o(uart_baud_o));
-
- // /////////////////////////////////////////////////////////////////////////
- // ATR Controller, Slave #11
- /*
- atr_controller atr_controller
- (.clk_i(wb_clk),.rst_i(wb_rst),
- .adr_i(sb_adr[5:0]),.sel_i(sb_sel),.dat_i(sb_dat_o),.dat_o(sb_dat_i),
- .we_i(sb_we),.stb_i(sb_stb),.cyc_i(sb_cyc),.ack_o(sb_ack),
- .run_rx(run_rx0_d1 | run_rx1_d1),.run_tx(run_tx),.ctrl_lines(atr_lines) );
- */
-
- // //////////////////////////////////////////////////////////////////////////
- // Time Sync, Slave #12
-
- // No longer used, see time_64bit. Still need to handle mimo time, though
- assign sc_ack = 0;
-
- // /////////////////////////////////////////////////////////////////////////
- // SD Card Reader / Writer, Slave #13
- /*
- sd_spi_wb sd_spi_wb
- (.clk(wb_clk),.rst(wb_rst),
- .sd_clk(sd_clk),.sd_csn(sd_csn),.sd_mosi(sd_mosi),.sd_miso(sd_miso),
- .wb_cyc_i(sd_cyc),.wb_stb_i(sd_stb),.wb_we_i(sd_we),
- .wb_adr_i(sd_adr[3:2]),.wb_dat_i(sd_dat_o[7:0]),.wb_dat_o(sd_dat_i[7:0]),
- .wb_ack_o(sd_ack) );
-
- assign sd_dat_i[31:8] = 0;
- */
// /////////////////////////////////////////////////////////////////////////
// ADC Frontend
wire [23:0] adc_i, adc_q;
@@ -659,8 +621,8 @@ module u2_core
wire clear_tx;
setting_reg #(.my_addr(SR_TX_CTRL+1)) sr_clear_tx
- (.clk(clk),.rst(rst),.strobe(set_stb),.addr(set_addr),
- .in(set_data),.out(),.changed(clear_tx));
+ (.clk(dsp_clk),.rst(dsp_rst),.strobe(set_stb_dsp),.addr(set_addr_dsp),
+ .in(set_data_dsp),.out(),.changed(clear_tx));
ext_fifo #(.EXT_WIDTH(18),.INT_WIDTH(36),.RAM_DEPTH(19),.FIFO_DEPTH(19))
ext_fifo_i1