Line 24... |
Line 24... |
*/
|
*/
|
|
|
`include "s1_defs.h"
|
`include "s1_defs.h"
|
|
|
module spc2wbm (
|
module spc2wbm (
|
sys_clock_i, sys_reset_i, sys_interrupt_source_i,
|
|
spc_req_i, spc_atom_i, spc_packetout_i,
|
|
spc_grant_o, spc_ready_o, spc_packetin_o, spc_stallreq_o,
|
|
wbm_ack_i, wbm_data_i,
|
|
wbm_cycle_o, wbm_strobe_o, wbm_we_o, wbm_addr_o, wbm_data_o, wbm_sel_o
|
|
);
|
|
|
|
/*
|
/*
|
* Inputs
|
* Inputs
|
*/
|
*/
|
|
|
// System inputs
|
// System inputs
|
input sys_clock_i; // System Clock
|
input sys_clock_i, // System Clock
|
input sys_reset_i; // System Reset
|
input sys_reset_i, // System Reset
|
input[5:0] sys_interrupt_source_i; // Encoded Interrupt Source
|
input[5:0] sys_interrupt_source_i, // Encoded Interrupt Source
|
|
|
// SPARC-side inputs connected to the PCX (Processor-to-Cache Xbar) outputs of the SPARC Core
|
// SPARC-side inputs connected to the PCX (Processor-to-Cache Xbar) outputs of the SPARC Core
|
input[4:0] spc_req_i; // Request
|
input[4:0] spc_req_i, // Request
|
input spc_atom_i; // Atomic Request
|
input spc_atom_i, // Atomic Request
|
input[(`PCX_WIDTH-1):0] spc_packetout_i; // Outgoing Packet
|
input[(`PCX_WIDTH-1):0] spc_packetout_i, // Outgoing Packet
|
|
|
// Wishbone Master interface inputs
|
// Wishbone Master interface inputs
|
input wbm_ack_i; // Ack
|
input wbm_ack_i, // Ack
|
input[(`WB_DATA_WIDTH-1):0] wbm_data_i; // Data In
|
input[(`WB_DATA_WIDTH-1):0] wbm_data_i, // Data In
|
|
|
/*
|
/*
|
* Registered Outputs
|
* Outputs
|
*/
|
*/
|
|
|
// SPARC-side outputs connected to the CPX (Cache-to-Processor Xbar) inputs of the SPARC Core
|
// SPARC-side outputs connected to the CPX (Cache-to-Processor Xbar) inputs of the SPARC Core
|
output[4:0] spc_grant_o; // Grant
|
output reg[4:0] spc_grant_o, // Grant
|
reg[4:0] spc_grant_o; // Grant
|
output reg spc_ready_o, // Ready
|
output spc_ready_o; // Ready
|
output reg[`CPX_WIDTH-1:0] spc_packetin_o, // Incoming Packet
|
reg spc_ready_o; // Ready
|
output reg spc_stall_o, // Stall Requests
|
output[`CPX_WIDTH-1:0] spc_packetin_o; // Incoming Packet
|
output reg spc_resume_o, // Resume Requests
|
reg[`CPX_WIDTH-1:0] spc_packetin_o; // Incoming Packet
|
|
output spc_stallreq_o; // Stall Request
|
|
reg spc_stallreq_o; // Stall Request
|
|
|
|
// Wishbone Master interface outputs
|
// Wishbone Master interface outputs
|
output wbm_cycle_o; // Cycle Start
|
output reg wbm_cycle_o, // Cycle Start
|
reg wbm_cycle_o; // Cycle Start
|
output reg wbm_strobe_o, // Strobe Request
|
output wbm_strobe_o; // Strobe Request
|
output reg wbm_we_o, // Write Enable
|
reg wbm_strobe_o; // Strobe Request
|
output reg[`WB_ADDR_WIDTH-1:0] wbm_addr_o, // Address Bus
|
output wbm_we_o; // Write Enable
|
output reg[`WB_DATA_WIDTH-1:0] wbm_data_o, // Data Out
|
reg wbm_we_o; // Write Enable
|
output reg[`WB_DATA_WIDTH/8-1:0] wbm_sel_o // Select Output
|
output[`WB_ADDR_WIDTH-1:0] wbm_addr_o; // Address Bus
|
|
reg[`WB_ADDR_WIDTH-1:0] wbm_addr_o; // Address Bus
|
);
|
output[`WB_DATA_WIDTH-1:0] wbm_data_o; // Data Out
|
|
reg[`WB_DATA_WIDTH-1:0] wbm_data_o; // Data Out
|
|
output[`WB_DATA_WIDTH/8-1:0] wbm_sel_o; // Select Output
|
|
reg[`WB_DATA_WIDTH/8-1:0] wbm_sel_o; // Select Output
|
|
|
|
/*
|
/*
|
* Registers
|
* Registers
|
*/
|
*/
|
|
|
Line 175... |
Line 163... |
|
|
// Clear outputs going to SPARC Core inputs
|
// Clear outputs going to SPARC Core inputs
|
spc_grant_o <= 5'b00000;
|
spc_grant_o <= 5'b00000;
|
spc_ready_o <= 0;
|
spc_ready_o <= 0;
|
spc_packetin_o <= 0;
|
spc_packetin_o <= 0;
|
spc_stallreq_o <= 0;
|
spc_stall_o <= 0;
|
|
spc_resume_o <= 0;
|
|
|
// Clear Wishbone Master interface outputs
|
// Clear Wishbone Master interface outputs
|
wbm_cycle_o <= 0;
|
wbm_cycle_o <= 0;
|
wbm_strobe_o <= 0;
|
wbm_strobe_o <= 0;
|
wbm_we_o <= 0;
|
wbm_we_o <= 0;
|
Line 239... |
Line 228... |
// Clear previously modified outputs
|
// Clear previously modified outputs
|
spc_ready_o <= 0;
|
spc_ready_o <= 0;
|
spc_packetin_o <= 0;
|
spc_packetin_o <= 0;
|
|
|
// Stall other requests from the SPARC Core
|
// Stall other requests from the SPARC Core
|
spc_stallreq_o <= 1;
|
spc_stall_o <= 1;
|
|
|
// Latch target region and atomicity
|
// Latch target region and atomicity
|
spc2wbm_region <= spc_req_i;
|
spc2wbm_region <= spc_req_i;
|
spc2wbm_atomic <= spc_atom_i;
|
spc2wbm_atomic <= spc_atom_i;
|
|
|
Line 267... |
Line 256... |
wbm2spc_way <= 0;
|
wbm2spc_way <= 0;
|
wbm2spc_boot_fetch <= 0;
|
wbm2spc_boot_fetch <= 0;
|
wbm2spc_atomic <= 0;
|
wbm2spc_atomic <= 0;
|
wbm2spc_pfl <= 0;
|
wbm2spc_pfl <= 0;
|
|
|
// Stall other requests from the SPARC Core
|
|
spc_stallreq_o <= 1;
|
|
|
|
// Next cycle see if there's an int to be forwarded to the Core
|
// Next cycle see if there's an int to be forwarded to the Core
|
end else if(wbm2spc_interrupt_source!=6'b000000 && wbm2spc_interrupt_new) begin
|
end else if(wbm2spc_interrupt_source!=6'b000000 && wbm2spc_interrupt_new) begin
|
|
|
// Clean the flag
|
// Clean the flag
|
wbm2spc_interrupt_new <= 0;
|
wbm2spc_interrupt_new <= 0;
|
|
|
// Send the interrupt packet to the Core
|
// Send the interrupt packet to the Core
|
spc_ready_o <= 1;
|
spc_ready_o <= 1;
|
spc_packetin_o <= wbm2spc_packet;
|
spc_packetin_o <= wbm2spc_packet;
|
|
|
// Stall other requests from the SPARC Core
|
|
spc_stallreq_o <= 1;
|
|
|
|
// Stay in this state
|
// Stay in this state
|
state <= `STATE_IDLE;
|
state <= `STATE_IDLE;
|
|
|
// Nothing to do, stay idle
|
// Nothing to do, stay idle
|
end else begin
|
end else begin
|
|
|
// Clear previously modified outputs
|
// Clear previously modified outputs
|
spc_ready_o <= 0;
|
spc_ready_o <= 0;
|
spc_packetin_o <= 0;
|
spc_packetin_o <= 0;
|
spc_stallreq_o <= 0;
|
|
|
// Clear stall/resume signals
|
|
spc_stall_o <= 0;
|
|
spc_resume_o <= 0;
|
|
|
// Stay in this state
|
// Stay in this state
|
state <= `STATE_IDLE;
|
state <= `STATE_IDLE;
|
|
|
end
|
end
|
Line 311... |
Line 297... |
spc2wbm_packet <= spc_packetout_i;
|
spc2wbm_packet <= spc_packetout_i;
|
|
|
// Grant the request to the SPARC Core
|
// Grant the request to the SPARC Core
|
spc_grant_o <= spc2wbm_region;
|
spc_grant_o <= spc2wbm_region;
|
|
|
|
// Clear the stall signal
|
|
spc_stall_o <= 0;
|
|
|
// synopsys translate_off
|
// synopsys translate_off
|
// Print details of SPARC Core request
|
// Print details of SPARC Core request
|
`ifdef DEBUG
|
`ifdef DEBUG
|
$display("INFO: SPC2WBM: *** NEW REQUEST FROM SPARC CORE ***");
|
$display("INFO: SPC2WBM: *** NEW REQUEST FROM SPARC CORE ***");
|
if(spc2wbm_region[0]==1) $display("INFO: SPC2WBM: Request to RAM Bank 0");
|
if(spc2wbm_region[0]==1) $display("INFO: SPC2WBM: Request to RAM Bank 0");
|
Line 644... |
Line 633... |
|
|
// Return the packet to the SPARC Core
|
// Return the packet to the SPARC Core
|
spc_ready_o <= 1;
|
spc_ready_o <= 1;
|
spc_packetin_o <= wbm2spc_packet;
|
spc_packetin_o <= wbm2spc_packet;
|
|
|
|
// Resume requests
|
|
spc_resume_o <= 1;
|
|
|
// Unconditional state change
|
// Unconditional state change
|
state <= `STATE_IDLE;
|
state <= `STATE_IDLE;
|
|
|
// synopsys translate_off
|
// synopsys translate_off
|
// Print details of return packet
|
// Print details of return packet
|