Line 1... |
Line 1... |
// $Id: aeMB_regf.v,v 1.2 2007-11-09 20:51:52 sybreon Exp $
|
// $Id: aeMB_regf.v,v 1.3 2007-11-10 16:39:38 sybreon Exp $
|
//
|
//
|
// AEMB REGISTER FILE
|
// AEMB REGISTER FILE
|
//
|
//
|
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
//
|
//
|
// This library is free software; you can redistribute it and/or
|
// This file is part of AEMB.
|
// modify it under the terms of the GNU Lesser General Public License
|
//
|
// as published by the Free Software Foundation; either version 2.1 of
|
// AEMB is free software: you can redistribute it and/or modify it
|
// the License, or (at your option) any later version.
|
// under the terms of the GNU Lesser General Public License as
|
//
|
// published by the Free Software Foundation, either version 3 of the
|
// This library is distributed in the hope that it will be useful, but
|
// License, or (at your option) any later version.
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
//
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// AEMB is distributed in the hope that it will be useful, but WITHOUT
|
// Lesser General Public License for more details.
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
|
// 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 this library; if not, write to the Free Software
|
// License along with AEMB. If not, see <http://www.gnu.org/licenses/>.
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
// USA
|
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.2 2007/11/09 20:51:52 sybreon
|
|
// Added GET/PUT support through a FSL bus.
|
|
//
|
// Revision 1.1 2007/11/02 03:25:41 sybreon
|
// Revision 1.1 2007/11/02 03:25:41 sybreon
|
// New EDK 3.2 compatible design with optional barrel-shifter and multiplier.
|
// New EDK 3.2 compatible design with optional barrel-shifter and multiplier.
|
// Fixed various minor data hazard bugs.
|
// Fixed various minor data hazard bugs.
|
// Code compatible with -O0/1/2/3/s generated code.
|
// Code compatible with -O0/1/2/3/s generated code.
|
//
|
//
|
Line 61... |
Line 64... |
|
|
wire [31:0] wDWBDI = dwb_dat_i; // FIXME: Endian
|
wire [31:0] wDWBDI = dwb_dat_i; // FIXME: Endian
|
wire [31:0] wFSLDI = fsl_dat_i; // FIXME: Endian
|
wire [31:0] wFSLDI = fsl_dat_i; // FIXME: Endian
|
|
|
reg [31:0] rDWBDI;
|
reg [31:0] rDWBDI;
|
|
reg [1:0] rSIZ;
|
|
|
|
always @(/*AUTOSENSE*/rDWBSEL or wDWBDI or wFSLDI) begin
|
|
/* 51.2
|
|
case (rSIZ)
|
|
// FSL
|
|
2'o3: rDWBDI <= wFSLDI;
|
|
// 32'bit
|
|
2'o2: rDWBDI <= wDWBDI;
|
|
// 16'bit
|
|
2'o1: case (rRESULT[1])
|
|
1'b0: rDWBDI <= {16'd0, wDWBDI[31:16]};
|
|
1'b1: rDWBDI <= {16'd0, wDWBDI[15:0]};
|
|
endcase // case (rRESULT[1])
|
|
// 8'bit
|
|
2'o0: case (rRESULT[1:0])
|
|
2'o0: rDWBDI <= {24'd0, wDWBDI[31:24]};
|
|
2'o1: rDWBDI <= {24'd0, wDWBDI[23:16]};
|
|
2'o2: rDWBDI <= {24'd0, wDWBDI[15:8]};
|
|
2'o3: rDWBDI <= {24'd0, wDWBDI[7:0]};
|
|
endcase // case (rRESULT[1:0])
|
|
endcase // case (rSIZ)
|
|
*/
|
|
|
|
/* 50.6
|
|
case ({rSIZ, rRESULT[1:0]})
|
|
// FSL
|
|
4'hC, 4'hD, 4'hE, 4'hF: rDWBDI <= wFSLDI;
|
|
// 32'bit
|
|
4'h8: rDWBDI <= wDWBDI;
|
|
// 16'bit
|
|
4'h4: rDWBDI <= {16'd0, wDWBDI[31:16]};
|
|
4'h6: rDWBDI <= {16'd0, wDWBDI[15:0]};
|
|
// 8'bit
|
|
4'h0: rDWBDI <= {24'd0, wDWBDI[31:24]};
|
|
4'h1: rDWBDI <= {24'd0, wDWBDI[23:16]};
|
|
4'h2: rDWBDI <= {24'd0, wDWBDI[15:8]};
|
|
4'h3: rDWBDI <= {24'd0, wDWBDI[7:0]};
|
|
default: rDWBDI <= 32'hX;
|
|
endcase // case (rSIZ)
|
|
*/
|
|
|
always @(/*AUTOSENSE*/rDWBSEL or wDWBDI or wFSLDI)
|
// 52.0
|
case (rDWBSEL)
|
case (rDWBSEL)
|
// 8'bit
|
// 8'bit
|
4'h8: rDWBDI <= {24'd0, wDWBDI[31:24]};
|
4'h8: rDWBDI <= {24'd0, wDWBDI[31:24]};
|
4'h4: rDWBDI <= {24'd0, wDWBDI[23:16]};
|
4'h4: rDWBDI <= {24'd0, wDWBDI[23:16]};
|
4'h2: rDWBDI <= {24'd0, wDWBDI[15:8]};
|
4'h2: rDWBDI <= {24'd0, wDWBDI[15:8]};
|
Line 80... |
Line 124... |
4'h0: rDWBDI <= wFSLDI;
|
4'h0: rDWBDI <= wFSLDI;
|
// Undefined
|
// Undefined
|
default: rDWBDI <= 32'hX;
|
default: rDWBDI <= 32'hX;
|
endcase
|
endcase
|
|
|
|
end
|
|
|
|
always @(posedge gclk)
|
|
if (grst) begin
|
|
/*AUTORESET*/
|
|
// Beginning of autoreset for uninitialized flops
|
|
rSIZ <= 2'h0;
|
|
// End of automatics
|
|
end else if (gena) begin
|
|
rSIZ <= rOPC[1:0];
|
|
end
|
|
|
// --- GENERAL PURPOSE REGISTERS (R0-R31) -----------------------
|
// --- GENERAL PURPOSE REGISTERS (R0-R31) -----------------------
|
// LUT RAM implementation is smaller and faster. R0 gets written
|
// LUT RAM implementation is smaller and faster. R0 gets written
|
// during reset with 0x00 and doesn't change after.
|
// during reset with 0x00 and doesn't change after.
|
|
|
reg [31:0] mARAM[0:31],
|
reg [31:0] mARAM[0:31],
|
Line 117... |
Line 173... |
|
|
// --- STORE SIZER ---------------------------------------------
|
// --- STORE SIZER ---------------------------------------------
|
// Replicates the data bytes across depending on the size of the
|
// Replicates the data bytes across depending on the size of the
|
// operation.
|
// operation.
|
|
|
|
reg [31:0] rDWBDO, xDWBDO;
|
|
|
wire [31:0] xFSL;
|
wire [31:0] xFSL;
|
wire fFFWD_M = (rRA == rRW) & (rMXDST == 2'o2) & fRDWE;
|
wire fFFWD_M = (rRA == rRW) & (rMXDST == 2'o2) & fRDWE;
|
wire fFFWD_R = (rRA == rRW) & (rMXDST == 2'o0) & fRDWE;
|
wire fFFWD_R = (rRA == rRW) & (rMXDST == 2'o0) & fRDWE;
|
|
|
assign fsl_dat_o = rDWBDO;
|
assign fsl_dat_o = rDWBDO;
|
Line 129... |
Line 187... |
rREGA;
|
rREGA;
|
|
|
wire [31:0] xDST;
|
wire [31:0] xDST;
|
wire fDFWD_M = (rRW == rRD) & (rMXDST == 2'o2) & fRDWE;
|
wire fDFWD_M = (rRW == rRD) & (rMXDST == 2'o2) & fRDWE;
|
wire fDFWD_R = (rRW == rRD) & (rMXDST == 2'o0) & fRDWE;
|
wire fDFWD_R = (rRW == rRD) & (rMXDST == 2'o0) & fRDWE;
|
reg [31:0] rDWBDO, xDWBDO;
|
|
|
|
assign dwb_dat_o = rDWBDO;
|
assign dwb_dat_o = rDWBDO;
|
assign xDST = (fDFWD_M) ? rDWBDI :
|
assign xDST = (fDFWD_M) ? rDWBDI :
|
(fDFWD_R) ? rRESULT :
|
(fDFWD_R) ? rRESULT :
|
rREGD;
|
rREGD;
|