Line 42... |
Line 42... |
`define IMPLEMENT_ONCHIP_RAM // 2804 w/o after synthesis
|
`define IMPLEMENT_ONCHIP_RAM // 2804 w/o after synthesis
|
`ifndef VERILATOR
|
`ifndef VERILATOR
|
`define FANCY_ICAP_ACCESS
|
`define FANCY_ICAP_ACCESS
|
`endif
|
`endif
|
`define FLASH_ACCESS
|
`define FLASH_ACCESS
|
// `define CFG_SCOPE // About 204 LUTs, at 2^6 addresses
|
`define DBG_SCOPE // About 204 LUTs, at 2^6 addresses
|
`define INCLUDE_RTC // About 90 LUTs
|
// `define INCLUDE_RTC // About 90 LUTs
|
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,
|
o_uart_rts,
|
o_uart_rts,
|
// The SPI Flash lines
|
// The SPI Flash lines
|
o_qspi_cs_n, o_qspi_sck, o_qspi_dat, i_qspi_dat, o_qspi_mod,
|
o_qspi_cs_n, o_qspi_sck, o_qspi_dat, i_qspi_dat, o_qspi_mod,
|
Line 288... |
Line 288... |
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_rtc_ack <= ((wb_stb)&&(rtc_sel));
|
r_rtc_ack <= ((wb_stb)&&(rtc_sel));
|
assign rtc_ack = r_rtc_ack;
|
assign rtc_ack = r_rtc_ack;
|
|
|
rtclight
|
rtclight
|
#(32'h35afe5,23) // 80 MHz clock
|
#(32'h35afe5,23,0,0) // 80 MHz clock
|
thetime(i_clk, wb_cyc,
|
thetime(i_clk, wb_cyc,
|
((wb_stb)&&(rtc_sel)), wb_we,
|
((wb_stb)&&(rtc_sel)), wb_we,
|
{ 1'b0, wb_addr[1:0] }, wb_data, rtc_data,
|
{ 1'b0, wb_addr[1:0] }, wb_data, rtc_data,
|
rtc_interrupt, ppd);
|
rtc_interrupt, ppd);
|
`else
|
`else
|
Line 350... |
Line 350... |
// = 694.4, or about 0x2b6.
|
// = 694.4, or about 0x2b6.
|
// although the CPU might struggle to keep up at this speed without a
|
// although the CPU might struggle to keep up at this speed without a
|
// hardware buffer.
|
// hardware buffer.
|
//
|
//
|
// We'll add the flag for two stop bits.
|
// We'll add the flag for two stop bits.
|
assign o_uart_setup = 30'h080002b6; // 115200 MBaud @ an 80MHz clock
|
// assign o_uart_setup = 30'h080002b6; // 115200 MBaud @ an 80MHz clock
|
|
assign o_uart_setup = 30'h0000208d; // 9600 MBaud, 8N1
|
|
|
initial o_tx_stb = 1'b0;
|
initial o_tx_stb = 1'b0;
|
initial o_tx_data = 8'h00;
|
initial o_tx_data = 8'h00;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if ((wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h7)&&(wb_we))
|
if ((wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h7)&&(wb_we))
|
Line 439... |
Line 440... |
//
|
//
|
//
|
//
|
//
|
//
|
wire [31:0] scop_cfg_data;
|
wire [31:0] scop_cfg_data;
|
wire scop_cfg_ack, scop_cfg_stall, scop_cfg_interrupt;
|
wire scop_cfg_ack, scop_cfg_stall, scop_cfg_interrupt;
|
`ifdef CFG_SCOPE
|
`ifdef DBG_SCOPE
|
wire scop_cfg_trigger;
|
wire scop_cfg_trigger;
|
assign scop_cfg_trigger = (wb_cyc)&&(wb_stb)&&(cfg_sel);
|
assign scop_cfg_trigger = (wb_cyc)&&(wb_stb)&&(cfg_sel);
|
wbscope #(5'h6) wbcfgscope(i_clk, 1'b1, scop_cfg_trigger, cfg_scope,
|
wbscope #(5'ha) wbcfgscope(i_clk, 1'b1, scop_cfg_trigger, cfg_scope,
|
// Wishbone interface
|
// Wishbone interface
|
i_clk, wb_cyc, (wb_stb)&&(scop_sel),
|
i_clk, wb_cyc, (wb_stb)&&(scop_sel),
|
wb_we, wb_addr[0], wb_data,
|
wb_we, wb_addr[0], wb_data,
|
scop_cfg_ack, scop_cfg_stall, scop_cfg_data,
|
scop_cfg_ack, scop_cfg_stall, scop_cfg_data,
|
scop_cfg_interrupt);
|
scop_cfg_interrupt);
|