`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
//=============================================================================
|
//=============================================================================
|
// __
|
// __
|
// \\__/ o\ (C) 2011,2012 Robert Finch
|
// \\__/ o\ (C) 2011,2012 Robert Finch
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch<remove>@opencores.org
|
// \/_// robfinch<remove>@opencores.org
|
// ||
|
// ||
|
//
|
//
|
// Raptor64_regfile.v
|
// Raptor64_regfile.v
|
// - register file and bypass muxes
|
// - register file and bypass muxes
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
// it under the terms of the GNU Lesser General Public License as published
|
// it under the terms of the GNU Lesser General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or
|
// by the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
// (at your option) any later version.
|
//
|
//
|
// This source file is distributed in the hope that it will be useful,
|
// This source file is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//
|
//
|
//
|
//
|
//=============================================================================
|
//=============================================================================
|
|
|
module Raptor64_regfile(clk, advanceR, advanceW, dRa, dRb, dRc, dpc,
|
module Raptor64_regfile(clk, advanceR, advanceW, wIRvalid, dRa, dRb, dRc, dpc,
|
xRt, m1Rt, m2Rt, wRt, tRt, xData, m1Data, m2Data, wData, tData, nxt_a, nxt_b, nxt_c);
|
xRt, m1Rt, m2Rt, wRt, tRt, xData, m1Data, m2Data, wData, tData, nxt_a, nxt_b, nxt_c);
|
input clk;
|
input clk;
|
input advanceR;
|
input advanceR;
|
input advanceW;
|
input advanceW;
|
|
input wIRvalid;
|
input [8:0] dRa;
|
input [8:0] dRa;
|
input [8:0] dRb;
|
input [8:0] dRb;
|
input [8:0] dRc;
|
input [8:0] dRc;
|
input [63:0] dpc;
|
input [63:0] dpc;
|
input [8:0] xRt;
|
input [8:0] xRt;
|
input [8:0] m1Rt;
|
input [8:0] m1Rt;
|
input [8:0] m2Rt;
|
input [8:0] m2Rt;
|
input [8:0] wRt;
|
input [8:0] wRt;
|
input [8:0] tRt;
|
input [8:0] tRt;
|
input [63:0] xData;
|
input [63:0] xData;
|
input [63:0] m1Data;
|
input [63:0] m1Data;
|
input [63:0] m2Data;
|
input [63:0] m2Data;
|
input [63:0] wData;
|
input [63:0] wData;
|
input [63:0] tData;
|
input [63:0] tData;
|
output [63:0] nxt_a;
|
output [63:0] nxt_a;
|
output [63:0] nxt_b;
|
output [63:0] nxt_b;
|
output [63:0] nxt_c;
|
output [63:0] nxt_c;
|
|
|
wire [63:0] rfoa, rfob, rfoc;
|
wire [63:0] rfoa, rfob, rfoc;
|
|
|
syncRam512x64_1rw3r u1
|
syncRam512x64_1rw3r u1
|
(
|
(
|
.wrst(1'b0),
|
.wrst(1'b0),
|
.wclk(clk),
|
.wclk(clk),
|
.wce(advanceW),
|
.wce(advanceW),
|
.we(1'b1),
|
.we(wIRvalid),
|
.wadr(wRt),
|
.wadr(wRt),
|
.i(wData),
|
.i(wData),
|
.wo(),
|
.wo(),
|
|
|
.rrsta(1'b0),
|
.rrsta(1'b0),
|
.rclka(~clk),
|
.rclka(~clk),
|
.rcea(advanceR),
|
.rcea(advanceR),
|
.radra(dRa),
|
.radra(dRa),
|
.roa(rfoa),
|
.roa(rfoa),
|
|
|
.rrstb(1'b0),
|
.rrstb(1'b0),
|
.rclkb(~clk),
|
.rclkb(~clk),
|
.rceb(advanceR),
|
.rceb(advanceR),
|
.radrb(dRb),
|
.radrb(dRb),
|
.rob(rfob),
|
.rob(rfob),
|
|
|
.rrstc(1'b0),
|
.rrstc(1'b0),
|
.rclkc(~clk),
|
.rclkc(~clk),
|
.rcec(advanceR),
|
.rcec(advanceR),
|
.radrc(dRc),
|
.radrc(dRc),
|
.roc(rfoc)
|
.roc(rfoc)
|
);
|
);
|
|
|
|
|
reg [63:0] nxt_a;
|
reg [63:0] nxt_a;
|
always @(dRa or xData or m1Data or m2Data or wData or tData or rfoa or dpc or xRt or m1Rt or m2Rt or wRt or tRt)
|
always @(dRa or xData or m1Data or m2Data or wData or tData or rfoa or dpc or xRt or m1Rt or m2Rt or wRt or tRt)
|
casex(dRa)
|
casex(dRa)
|
9'bxxxx00000: nxt_a <= 64'd0;
|
9'bxxxx00000: nxt_a <= 64'd0;
|
9'bxxxx11101: nxt_a <= dpc;
|
9'bxxxx11101: nxt_a <= dpc;
|
xRt: nxt_a <= xData;
|
xRt: nxt_a <= xData;
|
m1Rt: nxt_a <= m1Data;
|
m1Rt: nxt_a <= m1Data;
|
m2Rt: nxt_a <= m2Data;
|
m2Rt: nxt_a <= m2Data;
|
wRt: nxt_a <= wData;
|
wRt: nxt_a <= wData;
|
tRt: nxt_a <= tData;
|
tRt: nxt_a <= tData;
|
default: nxt_a <= rfoa;
|
default: nxt_a <= rfoa;
|
endcase
|
endcase
|
|
|
reg [63:0] nxt_b;
|
reg [63:0] nxt_b;
|
always @(dRb or xData or m1Data or m2Data or wData or tData or rfob or dpc or xRt or m1Rt or m2Rt or wRt or tRt)
|
always @(dRb or xData or m1Data or m2Data or wData or tData or rfob or dpc or xRt or m1Rt or m2Rt or wRt or tRt)
|
casex(dRb)
|
casex(dRb)
|
9'bxxxx00000: nxt_b <= 64'd0;
|
9'bxxxx00000: nxt_b <= 64'd0;
|
9'bxxxx11101: nxt_b <= dpc;
|
9'bxxxx11101: nxt_b <= dpc;
|
xRt: nxt_b <= xData;
|
xRt: nxt_b <= xData;
|
m1Rt: nxt_b <= m1Data;
|
m1Rt: nxt_b <= m1Data;
|
m2Rt: nxt_b <= m2Data;
|
m2Rt: nxt_b <= m2Data;
|
wRt: nxt_b <= wData;
|
wRt: nxt_b <= wData;
|
tRt: nxt_b <= tData;
|
tRt: nxt_b <= tData;
|
default: nxt_b <= rfob;
|
default: nxt_b <= rfob;
|
endcase
|
endcase
|
|
|
reg [63:0] nxt_c;
|
reg [63:0] nxt_c;
|
always @(dRc or xData or m1Data or m2Data or wData or tData or rfoc or dpc or xRt or m1Rt or m2Rt or wRt or tRt)
|
always @(dRc or xData or m1Data or m2Data or wData or tData or rfoc or dpc or xRt or m1Rt or m2Rt or wRt or tRt)
|
casex(dRc)
|
casex(dRc)
|
9'bxxxx00000: nxt_c <= 64'd0;
|
9'bxxxx00000: nxt_c <= 64'd0;
|
9'bxxxx11101: nxt_c <= dpc;
|
9'bxxxx11101: nxt_c <= dpc;
|
xRt: nxt_c <= xData;
|
xRt: nxt_c <= xData;
|
m1Rt: nxt_c <= m1Data;
|
m1Rt: nxt_c <= m1Data;
|
m2Rt: nxt_c <= m2Data;
|
m2Rt: nxt_c <= m2Data;
|
wRt: nxt_c <= wData;
|
wRt: nxt_c <= wData;
|
tRt: nxt_c <= tData;
|
tRt: nxt_c <= tData;
|
default: nxt_c <= rfoc;
|
default: nxt_c <= rfoc;
|
endcase
|
endcase
|
|
|
|
|
endmodule
|
endmodule
|
|
|