Line 39... |
Line 39... |
//
|
//
|
//
|
//
|
`define NO_ZIP_WBU_DELAY
|
`define NO_ZIP_WBU_DELAY
|
// `define ZIPCPU
|
// `define ZIPCPU
|
`ifdef ZIPCPU
|
`ifdef ZIPCPU
|
//`define ZIP_SYSTEM
|
`define ZIP_SYSTEM
|
`ifndef ZIP_SYSTEM
|
`ifndef ZIP_SYSTEM
|
`define ZIP_BONES
|
`define ZIP_BONES
|
`endif // ZIP_SYSTEM
|
`endif // ZIP_SYSTEM
|
`endif // ZipCPU
|
`endif // ZipCPU
|
//
|
//
|
Line 60... |
Line 60... |
// `define UART_ACCESS
|
// `define UART_ACCESS
|
// `define GPS_UART
|
// `define GPS_UART
|
`define RTC_ACCESS
|
`define RTC_ACCESS
|
`define OLEDRGB_ACCESS
|
`define OLEDRGB_ACCESS
|
//
|
//
|
// `define CPU_SCOPE
|
`define FLASH_SCOPE // Position zero
|
// `define GPS_SCOPE
|
// `define CPU_SCOPE // Position zero
|
`define FLASH_SCOPE
|
// `define GPS_SCOPE // Position one
|
// `define SDRAM_SCOPE
|
// `define SDRAM_SCOPE // Position two
|
// `define ENET_SCOPE
|
// `define ENET_SCOPE
|
//
|
//
|
//
|
//
|
module fastmaster(i_clk, i_rst,
|
module fastmaster(i_clk, i_rst,
|
// CNC
|
// CNC
|
Line 80... |
Line 80... |
// The Quad SPI Flash
|
// The Quad SPI Flash
|
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,
|
// The DDR3 SDRAM
|
// The DDR3 SDRAM
|
o_ddr_reset_n, o_ddr_cke,
|
o_ddr_reset_n, o_ddr_cke,
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
o_ddr_dqs, o_ddr_addr, o_ddr_ba, o_ddr_data, i_ddr_data,
|
o_ddr_dqs, o_ddr_dm, o_ddr_odt, o_ddr_bus_oe,
|
|
o_ddr_addr, o_ddr_ba, o_ddr_data, i_ddr_data,
|
// The SD Card
|
// The SD Card
|
o_sd_sck, o_sd_cmd, o_sd_data, i_sd_cmd, i_sd_data, i_sd_detect,
|
o_sd_sck, o_sd_cmd, o_sd_data, i_sd_cmd, i_sd_data, i_sd_detect,
|
// Ethernet control (MDIO) lines
|
// Ethernet control (MDIO) lines
|
o_mdclk, o_mdio, o_mdwe, i_mdio,
|
o_mdclk, o_mdio, o_mdwe, i_mdio,
|
// OLED Control interface (roughly SPI)
|
// OLED Control interface (roughly SPI)
|
Line 117... |
Line 118... |
input [3:0] i_qspi_dat;
|
input [3:0] i_qspi_dat;
|
output wire [1:0] o_qspi_mod;
|
output wire [1:0] o_qspi_mod;
|
// DDR3 RAM controller
|
// DDR3 RAM controller
|
output wire o_ddr_reset_n, o_ddr_cke,
|
output wire o_ddr_reset_n, o_ddr_cke,
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n,o_ddr_we_n;
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n,o_ddr_we_n;
|
output wire [2:0] o_ddr_dqs;
|
output wire o_ddr_dqs;
|
|
output wire o_ddr_dm, o_ddr_odt, o_ddr_bus_oe;
|
output wire [13:0] o_ddr_addr;
|
output wire [13:0] o_ddr_addr;
|
output wire [2:0] o_ddr_ba;
|
output wire [2:0] o_ddr_ba;
|
output wire [31:0] o_ddr_data;
|
output wire [31:0] o_ddr_data;
|
input [31:0] i_ddr_data;
|
input [31:0] i_ddr_data;
|
// The SD Card
|
// The SD Card
|
Line 619... |
Line 621... |
(!dbg_counter_many[25])|w_led[3],
|
(!dbg_counter_many[25])|w_led[3],
|
(!dbg_counter_sel[25])|w_led[2],
|
(!dbg_counter_sel[25])|w_led[2],
|
(!dbg_counter_cyc[25])|w_led[1],
|
(!dbg_counter_cyc[25])|w_led[1],
|
(!dbg_counter_err[25])|w_led[0] };
|
(!dbg_counter_err[25])|w_led[0] };
|
*/
|
*/
|
assign o_led = w_led;
|
|
|
reg [25:0] dbg_counter_sdram;
|
|
always @(posedge i_clk)
|
|
if ((ram_sel)&&(wb_stb))
|
|
dbg_counter_sdram <= 0;
|
|
else if (wb_stb)
|
|
dbg_counter_sdram[25] <= 1'b1;
|
|
else if (!dbg_counter_sdram[25])
|
|
dbg_counter_sdram <= dbg_counter_sdram+26'h1;
|
|
assign o_led = { w_led[3:1], w_led[0] | (!dbg_counter_sdram[25]) };
|
|
|
|
|
//
|
//
|
//
|
//
|
// Real Time Clock (RTC) device level access
|
// Real Time Clock (RTC) device level access
|
Line 895... |
Line 906... |
//
|
//
|
// DDR3-SDRAM
|
// DDR3-SDRAM
|
//
|
//
|
//
|
//
|
`ifdef SDRAM_ACCESS
|
`ifdef SDRAM_ACCESS
|
wbddrsdram rami(i_clk,
|
wbddrsdram #(13,13'd1520) rami(i_clk, i_rst,
|
wb_cyc, (wb_stb)&&(ram_sel), wb_we, wb_addr[25:0], wb_data,
|
wb_cyc, (wb_stb)&&(ram_sel), wb_we, wb_addr[25:0], wb_data,
|
ram_ack, ram_stall, ram_data,
|
ram_ack, ram_stall, ram_data,
|
o_ddr_reset_n, o_ddr_cke,
|
o_ddr_reset_n, o_ddr_cke,
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
o_ddr_dqs,
|
o_ddr_dqs, o_ddr_dm, o_ddr_odt, o_ddr_bus_oe,
|
o_ddr_addr, o_ddr_ba, o_ddr_data, i_ddr_data);
|
o_ddr_addr, o_ddr_ba, o_ddr_data, i_ddr_data);
|
`else
|
`else
|
assign ram_data = 32'h00;
|
assign ram_data = 32'h00;
|
assign ram_stall = 1'b0;
|
assign ram_stall = 1'b0;
|
reg r_ram_ack;
|
reg r_ram_ack;
|
Line 914... |
Line 925... |
|
|
// And idle the DDR3 SDRAM
|
// And idle the DDR3 SDRAM
|
assign o_ddr_reset_n = 1'b0; // Leave the SDRAM in reset
|
assign o_ddr_reset_n = 1'b0; // Leave the SDRAM in reset
|
assign o_ddr_cke = 1'b0; // Disable the SDRAM clock
|
assign o_ddr_cke = 1'b0; // Disable the SDRAM clock
|
// DQS
|
// DQS
|
assign o_ddr_dqs = 3'b100; // Leave DQS pins in high impedence
|
assign o_ddr_dqs = 1'b0; // Leave DQS pins in high impedence
|
// DDR3 control wires (not enabled if CKE=0)
|
// DDR3 control wires (not enabled if CKE=0)
|
assign o_ddr_cs_n = 1'b0; // NOOP command
|
assign o_ddr_cs_n = 1'b1; // Deselect command
|
assign o_ddr_ras_n = 1'b1;
|
assign o_ddr_ras_n = 1'b1;
|
assign o_ddr_cas_n = 1'b1;
|
assign o_ddr_cas_n = 1'b1;
|
assign o_ddr_we_n = 1'b1;
|
assign o_ddr_we_n = 1'b1;
|
// (Unused) data wires
|
// (Unused) data wires
|
assign o_ddr_addr = 14'h00;
|
assign o_ddr_addr = 14'h00;
|
Line 1022... |
Line 1033... |
// SCOPE C
|
// SCOPE C
|
//
|
//
|
wire [31:0] scop_c_data;
|
wire [31:0] scop_c_data;
|
wire scop_c_ack, scop_c_stall, scop_c_interrupt;
|
wire scop_c_ack, scop_c_stall, scop_c_interrupt;
|
//
|
//
|
//`else
|
`ifdef SDRAM_SCOPE
|
|
wire [31:0] scop_sdram_data;
|
|
wire scop_sdram_ack, scop_sdram_stall, scop_sdram_interrupt;
|
|
wire sdram_trigger;
|
|
wire [31:0] sdram_debug;
|
|
assign sdram_trigger = (ram_sel)&&(wb_stb);
|
|
assign sdram_debug= {
|
|
o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
|
(wb_stb)&&(ram_sel), wb_we, ram_stall, ram_ack,
|
|
o_ddr_dqs, o_ddr_dm, o_ddr_bus_oe,
|
|
o_ddr_addr[10], o_ddr_addr[3],
|
|
o_ddr_data[5:0], i_ddr_data[5:0], 8'h00
|
|
};
|
|
|
|
wbscope #(5'd12,32,1) ramscope(i_clk, 1'b1, sdram_trigger, sdram_debug,
|
|
// Wishbone interface
|
|
i_clk, wb_cyc, ((wb_stb)&&(scop_sel)&&(wb_addr[2:1]==2'b10)),
|
|
wb_we, wb_addr[0], wb_data,
|
|
scop_sdram_ack, scop_sdram_stall, scop_sdram_data,
|
|
scop_sdram_interrupt);
|
|
|
|
assign scop_c_ack = scop_sdram_ack;
|
|
assign scop_c_stall = scop_sdram_stall;
|
|
assign scop_c_data = scop_sdram_data;
|
|
assign scop_c_interrupt = scop_sdram_interrupt;
|
|
`else
|
assign scop_c_data = 32'h00;
|
assign scop_c_data = 32'h00;
|
assign scop_c_stall = 1'b0;
|
assign scop_c_stall = 1'b0;
|
assign scop_c_interrupt = 1'b0;
|
assign scop_c_interrupt = 1'b0;
|
|
|
reg r_scop_c_ack;
|
reg r_scop_c_ack;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_scop_c_ack <= (wb_stb)&&(scop_sel)&&(wb_addr[2:1] == 2'b10);
|
r_scop_c_ack <= (wb_stb)&&(scop_sel)&&(wb_addr[2:1] == 2'b10);
|
assign scop_c_ack = r_scop_c_ack;
|
assign scop_c_ack = r_scop_c_ack;
|
//`endif
|
`endif
|
|
|
//
|
//
|
// SCOPE D
|
// SCOPE D
|
//
|
//
|
wire [31:0] scop_d_data;
|
wire [31:0] scop_d_data;
|