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
|
//
|
//
|
|
`ifdef FLASH_ACCESS
|
`define FLASH_SCOPE // Position zero
|
`define FLASH_SCOPE // Position zero
|
|
`else
|
|
`ifdef ZIPCPU
|
// `define CPU_SCOPE // Position zero
|
// `define CPU_SCOPE // Position zero
|
|
`endif
|
|
`endif
|
// `define GPS_SCOPE // Position one
|
// `define GPS_SCOPE // Position one
|
|
`ifdef ICAPE_ACCESS
|
|
`define CFG_SCOPE // Position one
|
|
`endif
|
|
`ifdef SDRAM_ACCESS
|
// `define SDRAM_SCOPE // Position two
|
// `define SDRAM_SCOPE // Position two
|
|
`endif
|
// `define ENET_SCOPE
|
// `define ENET_SCOPE
|
//
|
//
|
//
|
//
|
module fastmaster(i_clk, i_rst,
|
module fastmaster(i_clk, i_rst,
|
// CNC
|
// CNC
|
Line 375... |
Line 385... |
rtc_ack, sdcard_ack,
|
rtc_ack, sdcard_ack,
|
netp_ack, gps_ack, mio_ack, cfg_ack, netb_ack,
|
netp_ack, gps_ack, mio_ack, cfg_ack, netb_ack,
|
mem_ack, flash_ack, ram_ack;
|
mem_ack, flash_ack, ram_ack;
|
reg many_ack, slow_many_ack;
|
reg many_ack, slow_many_ack;
|
reg slow_ack, scop_ack;
|
reg slow_ack, scop_ack;
|
wire [4:0] ack_list;
|
wire [5:0] ack_list;
|
assign ack_list = { ram_ack, flash_ack, mem_ack, netb_ack, cfg_ack };
|
assign ack_list = { ram_ack, flash_ack, mem_ack, netb_ack, netp_ack, slow_ack };
|
initial many_ack = 1'b0;
|
initial many_ack = 1'b0;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
many_ack <= ((ack_list != 5'h10)
|
many_ack <= ((ack_list != 6'h20)
|
&&(ack_list != 5'h8)
|
&&(ack_list != 6'h10)
|
&&(ack_list != 5'h4)
|
&&(ack_list != 6'h8)
|
&&(ack_list != 5'h2)
|
&&(ack_list != 6'h4)
|
&&(ack_list != 5'h1)
|
&&(ack_list != 6'h2)
|
&&(ack_list != 5'h0));
|
&&(ack_list != 6'h1)
|
|
&&(ack_list != 6'h0));
|
/*
|
/*
|
assign many_ack = ( { 2'h0, ram_ack}
|
assign many_ack = ( { 2'h0, ram_ack}
|
+{2'h0, flash_ack }
|
+{2'h0, flash_ack }
|
+{2'h0, mem_ack }
|
+{2'h0, mem_ack }
|
+{2'h0, netb_ack }
|
+{2'h0, netb_ack }
|
+{2'h0, slow_ack } > 3'h1 );
|
+{2'h0, slow_ack } > 3'h1 );
|
*/
|
*/
|
|
|
wire [7:0] slow_ack_list;
|
wire [7:0] slow_ack_list;
|
assign slow_ack_list = { mio_ack, gps_ack, netp_ack,
|
assign slow_ack_list = { cfg_ack, mio_ack, gps_ack,
|
sdcard_ack, rtc_ack, scop_ack, oled_ack, io_ack };
|
sdcard_ack, rtc_ack, scop_ack, oled_ack, io_ack };
|
initial slow_many_ack = 1'b0;
|
initial slow_many_ack = 1'b0;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
slow_many_ack <= ((slow_ack_list != 8'h80)
|
slow_many_ack <= ((slow_ack_list != 8'h80)
|
&&(slow_ack_list != 8'h40)
|
&&(slow_ack_list != 8'h40)
|
Line 409... |
Line 420... |
&&(slow_ack_list != 8'h02)
|
&&(slow_ack_list != 8'h02)
|
&&(slow_ack_list != 8'h01)
|
&&(slow_ack_list != 8'h01)
|
&&(slow_ack_list != 8'h00));
|
&&(slow_ack_list != 8'h00));
|
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
wb_ack <= (wb_cyc)&&(|{ ram_ack, flash_ack, mem_ack,
|
wb_ack <= (wb_cyc)&&(|ack_list);
|
netb_ack, cfg_ack, slow_ack });
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
slow_ack <= (wb_cyc)&&(|{oled_ack, mio_ack, gps_ack,
|
slow_ack <= (wb_cyc)&&(|slow_ack_list);
|
netp_ack, sdcard_ack, rtc_ack, scop_ack,
|
|
oled_ack, io_ack});
|
|
|
|
//
|
//
|
// Peripheral data lines
|
// Peripheral data lines
|
//
|
//
|
wire [31:0] io_data, oled_data,
|
wire [31:0] io_data, oled_data,
|
Line 432... |
Line 440... |
if ((ram_ack)||(flash_ack))
|
if ((ram_ack)||(flash_ack))
|
wb_idata <= (ram_ack)?ram_data:flash_data;
|
wb_idata <= (ram_ack)?ram_data:flash_data;
|
else if ((mem_ack)||(netb_ack))
|
else if ((mem_ack)||(netb_ack))
|
wb_idata <= (mem_ack)?mem_data:netb_data;
|
wb_idata <= (mem_ack)?mem_data:netb_data;
|
else
|
else
|
wb_idata <= slow_data;
|
wb_idata <= (netp_ack)?netp_data: slow_data;
|
|
|
// 7 control lines, 8x32 data lines
|
// 7 control lines, 8x32 data lines
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if ((cfg_ack)||(mio_ack))
|
if ((cfg_ack)||(mio_ack))
|
slow_data <= (cfg_ack) ? cfg_data : mio_data;
|
slow_data <= (cfg_ack) ? cfg_data : mio_data;
|
else if ((gps_ack)||(netp_ack))
|
|
slow_data <= (gps_ack) ? gps_data : netp_data;
|
|
else if ((sdcard_ack)||(rtc_ack))
|
else if ((sdcard_ack)||(rtc_ack))
|
slow_data <= (sdcard_ack)?sdcard_data : rtc_data;
|
slow_data <= (sdcard_ack)?sdcard_data : rtc_data;
|
else if ((scop_ack)|(oled_ack))
|
else if ((scop_ack)|(oled_ack))
|
slow_data <= (scop_ack)?scop_data:oled_data;
|
slow_data <= (scop_ack)?scop_data:oled_data;
|
else
|
else
|
slow_data <= io_data;
|
slow_data <= (gps_ack) ? gps_data : io_data;
|
|
|
//
|
//
|
// Peripheral stall lines
|
// Peripheral stall lines
|
//
|
//
|
// As per the wishbone spec, these cannot be clocked or delayed. They
|
// As per the wishbone spec, these cannot be clocked or delayed. They
|
Line 465... |
Line 471... |
||((scop_sel)&&(scop_stall)) // Never stalls
|
||((scop_sel)&&(scop_stall)) // Never stalls
|
||((rtc_sel)&&(rtc_stall)) // Never stalls
|
||((rtc_sel)&&(rtc_stall)) // Never stalls
|
||((sdcard_sel)&&(sdcard_stall))// Never stalls
|
||((sdcard_sel)&&(sdcard_stall))// Never stalls
|
||((netp_sel)&&(netp_stall))
|
||((netp_sel)&&(netp_stall))
|
||((gps_sel)&&(gps_stall)) //(maybe? never stalls?)
|
||((gps_sel)&&(gps_stall)) //(maybe? never stalls?)
|
||((oled_sel)&&(oled_stall))
|
||((oled_sel)&&(oled_stall)) // Never stalls
|
||((mio_sel)&&(mio_stall))
|
||((mio_sel)&&(mio_stall))
|
||((cfg_sel)&&(cfg_stall))
|
||((cfg_sel)&&(cfg_stall))
|
||((netb_sel)&&(netb_stall)) // Never stalls
|
||((netb_sel)&&(netb_stall)) // Never stalls
|
||((mem_sel)&&(mem_stall)) // Never stalls
|
||((mem_sel)&&(mem_stall)) // Never stalls
|
||((flash_sel|flctl_sel)&&(flash_stall))
|
||((flash_sel|flctl_sel)&&(flash_stall))
|
Line 845... |
Line 851... |
|
|
//
|
//
|
// MULTIBOOT/ICAPE2 CONFIGURATION ACCESS
|
// MULTIBOOT/ICAPE2 CONFIGURATION ACCESS
|
//
|
//
|
`ifdef ICAPE_ACCESS
|
`ifdef ICAPE_ACCESS
|
|
wire [31:0] cfg_debug;
|
wbicapetwo fpga_cfg(i_clk, wb_cyc,(cfg_sel)&&(wb_stb), wb_we,
|
wbicapetwo fpga_cfg(i_clk, wb_cyc,(cfg_sel)&&(wb_stb), wb_we,
|
wb_addr[4:0], wb_data,
|
wb_addr[4:0], wb_data,
|
cfg_ack, cfg_stall, cfg_data);
|
cfg_ack, cfg_stall, cfg_data, cfg_debug);
|
`else
|
`else
|
reg r_cfg_ack;
|
reg r_cfg_ack;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_cfg_ack <= (cfg_sel)&&(wb_stb);
|
r_cfg_ack <= (cfg_sel)&&(wb_stb);
|
assign cfg_ack = r_cfg_ack;
|
assign cfg_ack = r_cfg_ack;
|
Line 1016... |
Line 1023... |
// Wishbone interface
|
// Wishbone interface
|
i_clk, wb_cyc, ((wb_stb)&&(scop_sel)&&(wb_addr[2:1]==2'b01)),
|
i_clk, wb_cyc, ((wb_stb)&&(scop_sel)&&(wb_addr[2:1]==2'b01)),
|
wb_we, wb_addr[0], wb_data,
|
wb_we, wb_addr[0], wb_data,
|
scop_gps_ack, scop_gps_stall, scop_gps_data,
|
scop_gps_ack, scop_gps_stall, scop_gps_data,
|
scop_gps_interrupt);
|
scop_gps_interrupt);
|
|
|
|
assign scop_b_ack = scop_gps_ack;
|
|
assign scop_b_stall = scop_gps_stall;
|
|
assign scop_b_data = scop_gps_data;
|
|
assign scop_b_interrupt = scop_gps_interrupt;
|
|
`else
|
|
`ifdef CFG_SCOPE
|
|
wire [31:0] scop_cfg_data;
|
|
wire scop_cfg_ack, scop_cfg_stall, scop_cfg_interrupt;
|
|
wire [31:0] cfg_debug_2;
|
|
assign cfg_debug_2 = {
|
|
wb_ack, cfg_debug[30:17], slow_ack,
|
|
slow_data[7:0], wb_data[7:0]
|
|
};
|
|
wbscope #(5'd8,32,1) cfgscope(i_clk, 1'b1, (cfg_sel)&&(wb_stb),
|
|
cfg_debug_2,
|
|
// Wishbone interface
|
|
i_clk, wb_cyc, ((wb_stb)&&(scop_sel)&&(wb_addr[2:1]==2'b01)),
|
|
wb_we, wb_addr[0], wb_data,
|
|
scop_cfg_ack, scop_cfg_stall, scop_cfg_data,
|
|
scop_cfg_interrupt);
|
|
|
|
assign scop_b_data = scop_cfg_data;
|
|
assign scop_b_stall = scop_cfg_stall;
|
|
assign scop_b_ack = scop_cfg_ack;
|
|
assign scop_b_interrupt = scop_cfg_interrupt;
|
`else
|
`else
|
assign scop_b_data = 32'h00;
|
assign scop_b_data = 32'h00;
|
assign scop_b_stall = 1'b0;
|
assign scop_b_stall = 1'b0;
|
assign scop_b_interrupt = 1'b0;
|
assign scop_b_interrupt = 1'b0;
|
|
|
reg r_scop_b_ack;
|
reg r_scop_b_ack;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_scop_b_ack <= (wb_stb)&&(scop_sel)&&(wb_addr[2:1] == 2'b01);
|
r_scop_b_ack <= (wb_stb)&&(scop_sel)&&(wb_addr[2:1] == 2'b01);
|
assign scop_b_ack = r_scop_b_ack;
|
assign scop_b_ack = r_scop_b_ack;
|
`endif
|
`endif
|
|
`endif
|
|
|
//
|
//
|
// SCOPE C
|
// SCOPE C
|
//
|
//
|
wire [31:0] scop_c_data;
|
wire [31:0] scop_c_data;
|
Line 1086... |
Line 1120... |
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_scop_d_ack <= (wb_stb)&&(scop_sel)&&(wb_addr[2:1] == 2'b11);
|
r_scop_d_ack <= (wb_stb)&&(scop_sel)&&(wb_addr[2:1] == 2'b11);
|
assign scop_d_ack = r_scop_d_ack;
|
assign scop_d_ack = r_scop_d_ack;
|
//`endif
|
//`endif
|
|
|
assign scop_int = scop_a_interrupt
|
reg all_scope_interrupts;
|
|| scop_b_interrupt
|
always @(posedge i_clk)
|
|| scop_c_interrupt
|
all_scope_interrupts <= (scop_a_interrupt)
|
|| scop_d_interrupt;
|
|| (scop_b_interrupt)
|
|
|| (scop_c_interrupt)
|
|
|| (scop_d_interrupt);
|
|
assign scop_int = all_scope_interrupts;
|
|
|
|
// Scopes don't stall, so this line is more formality than anything
|
|
// else.
|
assign scop_stall = ((wb_addr[2:1]==2'b0)?scop_a_stall
|
assign scop_stall = ((wb_addr[2:1]==2'b0)?scop_a_stall
|
: ((wb_addr[2:1]==2'b01)?scop_b_stall
|
: ((wb_addr[2:1]==2'b01)?scop_b_stall
|
: ((wb_addr[2:1]==2'b11)?scop_c_stall
|
: ((wb_addr[2:1]==2'b11)?scop_c_stall
|
: scop_d_stall))); // Will always be 1'b0;
|
: scop_d_stall))); // Will always be 1'b0;
|
initial scop_ack = 1'b0;
|
initial scop_ack = 1'b0;
|