Line 373... |
Line 373... |
// 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;
|
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 pre_io = (~pre_flctl)&&(~pre_pwm)&&(~pre_uart)&&(~pre_scop);
|
assign pre_io = (~pre_flctl)&&(~pre_pwm)&&(~pre_uart)&&(~pre_scop);
|
assign io_sel = (io_bank)&&(pre_io);
|
assign io_sel = (io_bank)&&(pre_io);
|
assign pre_pwm = (wb_addr[4: 1]== 4'h4);
|
assign pre_pwm = (wb_addr[4: 1]== 4'h4);
|
Line 395... |
Line 398... |
assign sdcard_sel=((wb_cyc)&&(wb_addr[31:2]== 30'h48));
|
assign sdcard_sel=((wb_cyc)&&(wb_addr[31:2]== 30'h48));
|
`else
|
`else
|
assign sdcard_sel=1'b0;
|
assign sdcard_sel=1'b0;
|
`endif
|
`endif
|
assign sdram_sel=((wb_cyc)&&(wb_addr[31:23]== 9'h01));
|
assign sdram_sel=((wb_cyc)&&(wb_addr[31:23]== 9'h01));
|
|
`else
|
|
// While the following would make the bus infinitely easier to decode,
|
|
// it would also scramble where everything on the bus is located at,
|
|
// while also making it difficult to access these values via offsets
|
|
// of a register. Further, while simpler, everything would alias all
|
|
// over the place as well--that is, devices would show up at multiple
|
|
// locations on the bus. It's all a tradeoff.
|
|
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));
|
|
`ifdef SDCARD_ACCESS
|
|
assign sdcard_sel=((wb_cyc)&&(io_vec[4:0]==5'h05));
|
|
`else
|
|
assign sdcard_sel=1'b0;
|
|
`endif
|
|
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[3]);
|
|
assign pwm_sel = (puf_sel)&&(wb_addr[3:2]==2'b00);
|
|
// Note that in the following definition, the UART is given four words
|
|
// despite the fact that it can probably only use 3.
|
|
assign uart_sel = (puf_sel)&&(wb_addr[3:2]==2'b01);
|
|
|
|
`endif
|
|
|
assign none_sel =((wb_cyc)&&(wb_stb)&&(~
|
assign none_sel =((wb_cyc)&&(wb_stb)&&(~
|
(io_sel
|
(io_sel
|
||uart_sel
|
||uart_sel
|
||pwm_sel
|
||pwm_sel
|
Line 438... |
Line 472... |
if (wb_err)
|
if (wb_err)
|
bus_err_addr <= wb_addr;
|
bus_err_addr <= wb_addr;
|
|
|
wire flash_interrupt, sdcard_interrupt, scop_interrupt,
|
wire flash_interrupt, sdcard_interrupt, scop_interrupt,
|
uart_rx_int, uart_tx_int, pwm_int;
|
uart_rx_int, uart_tx_int, pwm_int;
|
|
wire [(NGPO-1):0] w_gpio;
|
// The I/O processor, herein called an ioslave
|
// The I/O processor, herein called an ioslave
|
ioslave #(NGPO, NGPI) runio(i_clk,
|
ioslave #(NGPO, NGPI) runio(i_clk,
|
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, w_gpio,
|
bus_err_addr,
|
bus_err_addr,
|
{
|
{
|
sdcard_interrupt,
|
sdcard_interrupt,
|
uart_tx_int, uart_rx_int, pwm_int, scop_interrupt,
|
uart_tx_int, uart_rx_int, pwm_int, scop_interrupt,
|
flash_interrupt,
|
flash_interrupt,
|
Line 482... |
Line 517... |
// sample rate to get the first parameter for the PWM device. The
|
// sample rate to get the first parameter for the PWM device. The
|
// second parameter is zero or one, indicating whether or not the
|
// second parameter is zero or one, indicating whether or not the
|
// audio rate can be adjusted (1), or whether it is fixed within the
|
// audio rate can be adjusted (1), or whether it is fixed within the
|
// build (0).
|
// build (0).
|
`ifdef XULA25
|
`ifdef XULA25
|
|
`define FMHACK
|
|
|
|
`ifdef FMHACK
|
|
wbfmtxhack #(16'd1813) // 44.1 kHz, user adjustable
|
|
`else
|
wbpwmaudio #(16'd1813,1) // 44.1 kHz, user adjustable
|
wbpwmaudio #(16'd1813,1) // 44.1 kHz, user adjustable
|
|
`endif
|
|
|
`else
|
`else
|
wbpwmaudio #(16'h270f,0,16) // 8 kHz, fixed audio rate
|
wbpwmaudio #(16'h270f,0,16) // 8 kHz, fixed audio rate
|
`endif
|
`endif
|
pwmdev(i_clk,
|
pwmdev(i_clk,
|
wb_cyc, (wb_stb)&&(pwm_sel), wb_we, wb_addr[0],
|
wb_cyc, (wb_stb)&&(pwm_sel), wb_we, wb_addr[0],
|
wb_data, pwm_ack, pwm_stall, pwm_data, o_pwm, pwm_int);
|
wb_data, pwm_ack, pwm_stall, pwm_data, o_pwm, pwm_int);
|
|
|
|
`ifdef FMHACK
|
|
assign o_gpio = {(NGPO){o_pwm}};
|
|
`else
|
|
assign o_gpio = w_gpio;
|
|
`endif
|
|
|
|
|
|
|
//
|
//
|
// FLASH MEMORY CONFIGURATION ACCESS
|
// FLASH MEMORY CONFIGURATION ACCESS
|
//
|
//
|
wire flash_cs_n, flash_sck, flash_mosi;
|
wire flash_cs_n, flash_sck, flash_mosi;
|