Line 37... |
Line 37... |
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
//
|
//
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
//
|
//
|
|
// `define XULA25
|
|
|
`define INCLUDE_ZIPCPU
|
`define INCLUDE_ZIPCPU
|
// `define NO_ZIP_WBU_DELAY
|
// `define NO_ZIP_WBU_DELAY
|
`define IMPLEMENT_ONCHIP_RAM
|
`define IMPLEMENT_ONCHIP_RAM
|
|
`ifndef VERILATOR
|
|
`ifndef XULA25
|
`define FANCY_ICAP_ACCESS
|
`define FANCY_ICAP_ACCESS
|
|
`endif
|
|
`endif
|
`define FLASH_ACCESS
|
`define FLASH_ACCESS
|
// `define SDCARD_ACCESS // Not built yet ...
|
// `define SDCARD_ACCESS // Not built yet ...
|
//
|
//
|
//
|
//
|
// `define FLASH_SCOPE
|
// `define FLASH_SCOPE
|
`ifdef FANCY_ICAP_ACCESS
|
`ifdef FANCY_ICAP_ACCESS
|
`define CFG_SCOPE
|
`define CFG_SCOPE
|
`endif
|
`endif
|
// `define SDRAM_SCOPE
|
// `define SDRAM_SCOPE
|
|
`ifdef XULA25
|
`define ZIP_SCOPE
|
`define ZIP_SCOPE
|
|
`endif
|
|
|
module busmaster(i_clk, i_rst,
|
module busmaster(i_clk, i_rst,
|
i_rx_stb, i_rx_data, o_tx_stb, o_tx_data, i_tx_busy,
|
i_rx_stb, i_rx_data, o_tx_stb, o_tx_data, i_tx_busy,
|
// The SPI Flash lines
|
// The SPI Flash lines
|
o_sf_cs_n, o_sd_cs_n, o_spi_sck, o_spi_mosi, i_spi_miso,
|
o_sf_cs_n, o_sd_cs_n, o_spi_sck, o_spi_mosi, i_spi_miso,
|
// The SDRAM lines
|
// The SDRAM lines
|
Line 149... |
Line 158... |
wire zip_ack, zip_stall, zip_err;
|
wire zip_ack, zip_stall, zip_err;
|
wire dwb_we, dwb_stb, dwb_cyc, dwb_ack, dwb_stall, dwb_err;
|
wire dwb_we, dwb_stb, dwb_cyc, dwb_ack, dwb_stall, dwb_err;
|
wire [31:0] dwb_addr, dwb_odata;
|
wire [31:0] dwb_addr, dwb_odata;
|
wire [7:0] w_ints_to_zip_cpu;
|
wire [7:0] w_ints_to_zip_cpu;
|
`ifdef INCLUDE_ZIPCPU
|
`ifdef INCLUDE_ZIPCPU
|
|
`ifdef XULA25
|
wire [31:0] zip_debug;
|
wire [31:0] zip_debug;
|
zipsystem #(24'h2000,ZA,8,1,8)
|
zipsystem #(24'h2000,ZA,8,1,8)
|
zippy(i_clk, 1'b0,
|
zippy(i_clk, 1'b0,
|
// Zippys wishbone interface
|
// Zippys wishbone interface
|
zip_cyc, zip_stb, zip_we, w_zip_addr, zip_data,
|
zip_cyc, zip_stb, zip_we, w_zip_addr, zip_data,
|
Line 162... |
Line 172... |
((wbu_cyc)&&(wbu_zip_sel)),
|
((wbu_cyc)&&(wbu_zip_sel)),
|
((wbu_stb)&&(wbu_zip_sel)),wbu_we, wbu_addr[0],
|
((wbu_stb)&&(wbu_zip_sel)),wbu_we, wbu_addr[0],
|
wbu_data,
|
wbu_data,
|
zip_dbg_ack, zip_dbg_stall, zip_dbg_data,
|
zip_dbg_ack, zip_dbg_stall, zip_dbg_data,
|
zip_debug);
|
zip_debug);
|
|
`else
|
|
zipbones #(24'h2000,ZA,8,1)
|
|
zippy(i_clk, 1'b0,
|
|
// Zippys wishbone interface
|
|
zip_cyc, zip_stb, zip_we, w_zip_addr, zip_data,
|
|
zip_ack, zip_stall, dwb_idata, zip_err,
|
|
w_interrupt, zip_cpu_int,
|
|
// Debug wishbone interface
|
|
((wbu_cyc)&&(wbu_zip_sel)),
|
|
((wbu_stb)&&(wbu_zip_sel)),wbu_we, wbu_addr[0],
|
|
wbu_data,
|
|
zip_dbg_ack, zip_dbg_stall, zip_dbg_data);
|
|
`endif
|
generate
|
generate
|
if (ZA < 32)
|
if (ZA < 32)
|
assign zip_addr = { {(32-ZA){1'b0}}, w_zip_addr };
|
assign zip_addr = { {(32-ZA){1'b0}}, w_zip_addr };
|
else
|
else
|
assign zip_addr = w_zip_addr;
|
assign zip_addr = w_zip_addr;
|
Line 302... |
Line 325... |
// Addresses ...
|
// Addresses ...
|
// 0000 xxxx configuration/control registers
|
// 0000 xxxx configuration/control registers
|
// 001x xxxx Down-sampler taps (64 taps, 2 at a time)
|
// 001x xxxx Down-sampler taps (64 taps, 2 at a time)
|
// 1xxx xxxx Up-sampler taps
|
// 1xxx xxxx Up-sampler taps
|
// 1 xxxx xxxx xxxx xxxx xxxx Up-sampler taps
|
// 1 xxxx xxxx xxxx xxxx xxxx Up-sampler taps
|
|
|
|
`ifndef SPEEDY_IO
|
|
|
|
wire pre_io, pre_pwm, pre_uart, pre_flctl, pre_scop;
|
assign io_bank = (wb_cyc)&&(wb_addr[31:5] == 27'h8);
|
assign io_bank = (wb_cyc)&&(wb_addr[31:5] == 27'h8);
|
assign io_sel = (io_bank)&&(~flctl_sel)
|
assign pre_io = (~pre_flctl)&&(~pre_pwm)&&(~pre_uart)&&(~pre_scop);
|
&&(~pwm_sel)&&(~uart_sel)&&(~scop_sel);
|
assign io_sel = (io_bank)&&(pre_io);
|
assign pwm_sel =((io_bank)&&(wb_addr[4: 1]== 4'h4));
|
assign pre_pwm = (wb_addr[4: 1]== 4'h4);
|
assign uart_sel =((io_bank)&&((wb_addr[4:1]== 4'h5)||(wb_addr[4:0]==5'h7)));
|
assign pwm_sel = (io_bank)&&(pre_pwm);
|
assign flctl_sel=((io_bank)&&(wb_addr[4: 2]== 3'h3));
|
assign pre_uart = (wb_addr[4: 1]== 4'h5)||(wb_addr[4:0]==5'h7);
|
assign scop_sel =((io_bank)&&(wb_addr[4: 3]== 2'h3));
|
assign uart_sel = (io_bank)&&(pre_uart);
|
|
assign pre_flctl= (wb_addr[4: 2]== 3'h3);
|
|
assign flctl_sel= (io_bank)&&(pre_flctl);
|
|
assign pre_scop = (wb_addr[4: 3]== 2'h3);
|
|
assign scop_sel = (io_bank)&&(pre_scop);
|
assign cfg_sel =((wb_cyc)&&(wb_addr[31: 6]== 26'h05));
|
assign cfg_sel =((wb_cyc)&&(wb_addr[31: 6]== 26'h05));
|
// zip_sel is not on the bus at this point
|
// zip_sel is not on the bus at this point
|
assign mem_sel =((wb_cyc)&&(wb_addr[31:13]== 19'h01));
|
assign mem_sel =((wb_cyc)&&(wb_addr[31:13]== 19'h01));
|
assign flash_sel=((wb_cyc)&&(wb_addr[31:18]== 14'h01));
|
assign flash_sel=((wb_cyc)&&(wb_addr[31:18]== 14'h01));
|
assign sdcard_sel=1'b0;
|
assign sdcard_sel=1'b0;
|
assign sdram_sel=((wb_cyc)&&(wb_addr[31:23]== 9'h01));
|
assign sdram_sel=((wb_cyc)&&(wb_addr[31:23]== 9'h01));
|
assign none_sel =((wb_cyc)&&(wb_stb)&&(~(io_sel||flctl_sel||scop_sel||cfg_sel||mem_sel||sdram_sel||sdcard_sel||flash_sel)));
|
`else
|
|
assign iovec = { wb_addr[23],wb_addr[18],wb_addr[15:13] }
|
|
|
|
assign sdram_sel =((wb_cyc)&&(io_vec[4]));
|
|
assign flash_sel =((wb_cyc)&&(io_vec[4:3]==2'b01));
|
|
assign mem_sel =((wb_cyc)&&(io_vec[4:0]==5'h07));
|
|
assign cfg_sel =((wb_cyc)&&(io_vec[4:0]==5'h06));
|
|
assign sdcard_sel=((wb_cyc)&&(io_vec[4:0]==5'h05));
|
|
assign scop_sel =((wb_cyc)&&(io_vec[4:0]==5'h04));
|
|
assign rtc_sel =((wb_cyc)&&(io_vec[4:0]==5'h03));
|
|
assign rtc_sel =((wb_cyc)&&(io_vec[4:0]==5'h03));
|
|
assign puf_sel =((wb_cyc)&&(io_vec[4:0]==5'h02));
|
|
assign io_sel =((wb_cyc)&&(io_vec[4:0]==5'h01));
|
|
assign wb_err =((wb_cyc)&&(io_vec[4:0]==5'h00));
|
|
assign flctl_sel = (puf_sel)&&(wb_addr[2]);
|
|
assign pwm_sel = (puf_sel)&&(wb_addr[2:1]==2'b01);
|
|
assign sdcard_sel=1'b0;//((wb_cyc)&&({wb_addr[23],wb_addr[18]}==2'b01));
|
|
`endif
|
|
|
|
assign none_sel =((wb_cyc)&&(wb_stb)&&(~
|
|
(io_sel
|
|
||uart_sel
|
|
||pwm_sel
|
|
||flctl_sel
|
|
||scop_sel
|
|
||cfg_sel
|
|
||mem_sel
|
|
||sdram_sel
|
|
||sdcard_sel
|
|
||flash_sel)));
|
assign many_sel =((wb_cyc)&&(wb_stb)&&(
|
assign many_sel =((wb_cyc)&&(wb_stb)&&(
|
{3'h0, io_sel}
|
{3'h0, io_sel}
|
+{3'h0, uart_sel}
|
+{3'h0, uart_sel}
|
+{3'h0, pwm_sel}
|
+{3'h0, pwm_sel}
|
+{3'h0, flctl_sel}
|
+{3'h0, flctl_sel}
|
Line 333... |
Line 393... |
wire many_ack;
|
wire many_ack;
|
assign many_ack =((wb_cyc)&&(
|
assign many_ack =((wb_cyc)&&(
|
{3'h0, io_ack}
|
{3'h0, io_ack}
|
+{3'h0, uart_ack}
|
+{3'h0, uart_ack}
|
+{3'h0, pwm_ack}
|
+{3'h0, pwm_ack}
|
|
// FLCTL acks through the flash, so one less check here
|
+{3'h0, scop_ack}
|
+{3'h0, scop_ack}
|
+{3'h0, cfg_ack}
|
+{3'h0, cfg_ack}
|
+{3'h0, mem_ack}
|
+{3'h0, mem_ack}
|
+{3'h0, sdram_ack}
|
+{3'h0, sdram_ack}
|
+{3'h0, sdcard_ack}
|
+{3'h0, sdcard_ack}
|
Line 353... |
Line 414... |
wb_cyc, (io_sel)&&(wb_stb), wb_we, wb_addr[4:0],
|
wb_cyc, (io_sel)&&(wb_stb), wb_we, wb_addr[4:0],
|
wb_data, io_ack, io_stall, io_data,
|
wb_data, io_ack, io_stall, io_data,
|
i_gpio, o_gpio,
|
i_gpio, o_gpio,
|
bus_err_addr,
|
bus_err_addr,
|
{ uart_tx_int, uart_rx_int, pwm_int, scop_interrupt,
|
{ uart_tx_int, uart_rx_int, pwm_int, scop_interrupt,
|
flash_interrupt, zip_cpu_int },
|
flash_interrupt,
|
|
`ifdef XULA25
|
|
zip_cpu_int
|
|
`else
|
|
1'b0
|
|
`endif
|
|
},
|
w_ints_to_zip_cpu,
|
w_ints_to_zip_cpu,
|
w_interrupt);
|
w_interrupt);
|
// 8684
|
// 8684
|
// 1'bx, 4'h0, scop_sel, scop_ack, ~scop_stall,
|
// 1'bx, 4'h0, scop_sel, scop_ack, ~scop_stall,
|
// wb_err, ~vga_interrupt, 2'b00, flash_interrupt
|
// wb_err, ~vga_interrupt, 2'b00, flash_interrupt
|