Line 1... |
Line 1... |
/* $Id: aeMB2_dwbif.v,v 1.4 2008-04-23 14:18:52 sybreon Exp $
|
/* $Id: aeMB2_dwbif.v,v 1.5 2008-04-26 01:09:05 sybreon Exp $
|
**
|
**
|
** AEMB2 EDK 6.2 COMPATIBLE CORE
|
** AEMB2 EDK 6.2 COMPATIBLE CORE
|
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
|
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
|
**
|
**
|
** This file is part of AEMB.
|
** This file is part of AEMB.
|
Line 16... |
Line 16... |
** Public License for more details.
|
** Public License for more details.
|
**
|
**
|
** You should have received a copy of the GNU Lesser General Public
|
** You should have received a copy of the GNU Lesser General Public
|
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>.
|
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>.
|
*/
|
*/
|
|
|
/**
|
/**
|
* Data Wishbone Interface
|
* Data Wishbone Interface
|
* @file aeMB2_dwbif.v
|
* @file aeMB2_dwbif.v
|
|
|
* This sets up the Wishbone control signals for the DATA bus
|
* This sets up the Wishbone control signals for the DATA bus
|
Line 58... |
Line 57... |
input [5:0] opc_of;
|
input [5:0] opc_of;
|
input [1:0] opa_of;
|
input [1:0] opa_of;
|
input [1:0] opb_of;
|
input [1:0] opb_of;
|
input [7:0] msr_ex;
|
input [7:0] msr_ex;
|
input [AEMB_DWB-1:2] mem_ex;
|
input [AEMB_DWB-1:2] mem_ex;
|
input [5:7] sfr_mx;
|
input [7:5] sfr_mx;
|
|
|
// SYS signals
|
// SYS signals
|
input gclk,
|
input gclk,
|
grst,
|
grst,
|
dena,
|
dena,
|
Line 77... |
Line 76... |
reg dwb_stb_o;
|
reg dwb_stb_o;
|
reg dwb_wre_o;
|
reg dwb_wre_o;
|
reg [3:0] sel_mx;
|
reg [3:0] sel_mx;
|
// End of automatics
|
// End of automatics
|
|
|
wire [1:0] wOFF = (opa_of[1:0] + opb_of[1:0]);
|
wire [1:0] wOFF = (opa_of[1:0] + opb_of[1:0]); // small adder
|
wire [3:0] wSEL = {opc_of[1:0], wOFF};
|
wire [3:0] wSEL = {opc_of[1:0], wOFF};
|
|
|
// ENABLE FEEDBACK
|
// ENABLE FEEDBACK
|
assign dwb_fb = (dwb_stb_o ~^ dwb_ack_i);
|
assign dwb_fb = (dwb_stb_o ~^ dwb_ack_i);
|
|
|
Line 90... |
Line 89... |
|
|
// STORE SIZER
|
// STORE SIZER
|
// TODO: Move the right words to the right place
|
// TODO: Move the right words to the right place
|
// TODO: Make this work with dwb_mx to for partial word loads.
|
// TODO: Make this work with dwb_mx to for partial word loads.
|
|
|
|
reg [31:0] dwb_lat;
|
reg [31:0] opd_ex;
|
reg [31:0] opd_ex;
|
|
|
always @(posedge gclk)
|
always @(posedge gclk)
|
if (grst) begin
|
if (grst) begin
|
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
dwb_dat_o <= 32'h0;
|
dwb_dat_o <= 32'h0;
|
opd_ex <= 32'h0;
|
|
// End of automatics
|
// End of automatics
|
end else if (dena) begin
|
end else if (dena) begin
|
opd_ex <= #1 opd_of;
|
//opd_ex <= #1 opd_of;
|
|
|
case (opc_of[1:0])
|
case (opc_of[1:0])
|
2'o0: dwb_dat_o <= #1 {(4){opd_of[7:0]}};
|
2'o0: dwb_dat_o <= #1 {(4){opd_of[7:0]}};
|
2'o1: dwb_dat_o <= #1 {(2){opd_of[15:0]}};
|
2'o1: dwb_dat_o <= #1 {(2){opd_of[15:0]}};
|
2'o2: dwb_dat_o <= #1 opd_of;
|
2'o2: dwb_dat_o <= #1 opd_of;
|
default: dwb_dat_o <= #1 32'hX;
|
default: dwb_dat_o <= #1 32'hX;
|
endcase // case (opc_of[1:0])
|
endcase // case (opc_of[1:0])
|
end // if (dena)
|
end
|
|
|
// WISHBONE PIPELINE
|
// WISHBONE PIPELINE
|
always @(posedge gclk)
|
always @(posedge gclk)
|
if (grst) begin
|
if (grst) begin
|
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
|
dwb_mx <= 32'h0;
|
dwb_sel_o <= 4'h0;
|
dwb_sel_o <= 4'h0;
|
dwb_wre_o <= 1'h0;
|
dwb_wre_o <= 1'h0;
|
sel_mx <= 4'h0;
|
sel_mx <= 4'h0;
|
// End of automatics
|
// End of automatics
|
end else if (dena) begin
|
end else if (dena) begin
|
Line 127... |
Line 127... |
// dwb_mx latch the correct bytes
|
// dwb_mx latch the correct bytes
|
// depending on dwb_sel_o.
|
// depending on dwb_sel_o.
|
|
|
dwb_wre_o <= #1 opc_of[2]; // SXX
|
dwb_wre_o <= #1 opc_of[2]; // SXX
|
|
|
// FIXME: May clash during cache refills
|
|
dwb_mx <= #1 (dwb_ack_i) ? dwb_dat_i : dwb_lat;
|
dwb_mx <= #1 (dwb_ack_i) ? dwb_dat_i : dwb_lat;
|
|
|
case (wSEL)
|
case (wSEL)
|
// 32'bit
|
// 32'bit
|
4'h8: dwb_sel_o <= #1 4'hF;
|
4'h8: dwb_sel_o <= #1 4'hF;
|
Line 148... |
Line 147... |
endcase // case (wSEL)
|
endcase // case (wSEL)
|
end // if (dena)
|
end // if (dena)
|
|
|
// Independent on pipeline
|
// Independent on pipeline
|
|
|
reg [31:0] dwb_lat;
|
|
always @(posedge gclk)
|
always @(posedge gclk)
|
if (grst) begin
|
if (grst) begin
|
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
dwb_lat <= 32'h0;
|
dwb_lat <= 32'h0;
|
dwb_mx <= 32'h0;
|
|
// End of automatics
|
// End of automatics
|
end else if (dwb_stb_o & dwb_ack_i) begin
|
end else if (dwb_ack_i) begin
|
// LATCH READS
|
// LATCH READS
|
dwb_lat <= #1 dwb_dat_i;
|
dwb_lat <= #1 dwb_dat_i;
|
end
|
end
|
|
|
always @(posedge gclk)
|
always @(posedge gclk)
|
Line 168... |
Line 165... |
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
dwb_cyc_o <= 1'h0;
|
dwb_cyc_o <= 1'h0;
|
dwb_stb_o <= 1'h0;
|
dwb_stb_o <= 1'h0;
|
// End of automatics
|
// End of automatics
|
end else if (dwb_fb) begin
|
//end else if (dwb_fb) begin
|
|
end else if (dena) begin
|
dwb_stb_o <= #1
|
dwb_stb_o <= #1
|
(dena) ? &opc_of[5:4] : // LXX/SSS
|
(dena) ? &opc_of[5:4] : // LXX/SSS
|
(dwb_stb_o & !dwb_ack_i); // LXX/SSS
|
(dwb_stb_o & !dwb_ack_i); // LXX/SSS
|
dwb_cyc_o <= #1
|
dwb_cyc_o <= #1
|
(dena) ? &opc_of[5:4] | msr_ex[0] :
|
(dena) ? &opc_of[5:4] | msr_ex[0] :
|
(dwb_stb_o & !dwb_ack_i) | msr_ex[0];
|
(dwb_stb_o & !dwb_ack_i) | msr_ex[0];
|
end
|
end
|
|
|
assign dwb_tag_o = msr_ex[7]; // MSR_DCE
|
assign dwb_tag_o = msr_ex[7]; // MSR_DCE
|
|
|
endmodule // aeMB2_memif
|
endmodule // aeMB2_dwbif
|
|
|
|
/*
|
|
$Log: not supported by cvs2svn $
|
|
Revision 1.4 2008/04/23 14:18:52 sybreon
|
|
Fixed pipelined latching of data bug.
|
|
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.3 2008/04/21 12:11:38 sybreon
|
|
// Passes arithmetic tests with single thread.
|
|
//
|
|
// Revision 1.2 2008/04/20 16:34:32 sybreon
|
|
// Basic version with some features left out.
|
|
//
|
|
// Revision 1.1 2008/04/18 00:21:52 sybreon
|
|
// Initial import.
|
|
//
|
|
No newline at end of file
|
No newline at end of file
|
|
Revision 1.3 2008/04/21 12:11:38 sybreon
|
|
Passes arithmetic tests with single thread.
|
|
|
|
Revision 1.2 2008/04/20 16:34:32 sybreon
|
|
Basic version with some features left out.
|
|
|
|
Revision 1.1 2008/04/18 00:21:52 sybreon
|
|
Initial import.
|
|
*/
|
No newline at end of file
|
No newline at end of file
|