mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Finished FPU-LSU interface cleanup
This commit is contained in:
parent
7151befd04
commit
34eece10b8
@ -44,8 +44,7 @@ module fpu (
|
|||||||
output logic FpLoadStoreM, // Fp load instruction? (to LSU)
|
output logic FpLoadStoreM, // Fp load instruction? (to LSU)
|
||||||
output logic FStallD, // Stall the decode stage (To HZU)
|
output logic FStallD, // Stall the decode stage (To HZU)
|
||||||
output logic FWriteIntE, // integer register write enable (to IEU)
|
output logic FWriteIntE, // integer register write enable (to IEU)
|
||||||
output logic [`XLEN-1:0] FWriteDataE, // Data to be written to memory (to IEU) - only used if `XLEN >`FLEN *** delete this
|
output logic [`FLEN-1:0] FWriteDataM, // Data to be written to memory (to LSU)
|
||||||
output logic [`FLEN-1:0] FWriteDataM, // Data to be written to memory (to IEU) - only used if `XLEN <`FLEN
|
|
||||||
output logic [`XLEN-1:0] FIntResM, // data to be written to integer register (to IEU)
|
output logic [`XLEN-1:0] FIntResM, // data to be written to integer register (to IEU)
|
||||||
output logic [`XLEN-1:0] FCvtIntResW, // convert result to to be written to integer register (to IEU)
|
output logic [`XLEN-1:0] FCvtIntResW, // convert result to to be written to integer register (to IEU)
|
||||||
output logic [1:0] FResSelW, // final result selection (to IEU)
|
output logic [1:0] FResSelW, // final result selection (to IEU)
|
||||||
@ -60,6 +59,9 @@ module fpu (
|
|||||||
// single stored in a double: | 32 1s | single precision value |
|
// single stored in a double: | 32 1s | single precision value |
|
||||||
// - sets the underflow after rounding
|
// - sets the underflow after rounding
|
||||||
|
|
||||||
|
// LSU interface
|
||||||
|
logic [`FLEN-1:0] FWriteDataE;
|
||||||
|
|
||||||
// control signals
|
// control signals
|
||||||
logic FRegWriteW; // FP register write enable
|
logic FRegWriteW; // FP register write enable
|
||||||
logic [2:0] FrmM; // FP rounding mode
|
logic [2:0] FrmM; // FP rounding mode
|
||||||
@ -289,18 +291,17 @@ module fpu (
|
|||||||
// - FP uses NaN-blocking format
|
// - FP uses NaN-blocking format
|
||||||
// - if there are any unsused bits the most significant bits are filled with 1s
|
// - if there are any unsused bits the most significant bits are filled with 1s
|
||||||
|
|
||||||
logic [`FLEN-1:0] WriteDataE;
|
if(`FPSIZES == 1) assign FWriteDataE = YE;
|
||||||
if(`FPSIZES == 1) assign WriteDataE = YE;
|
else if(`FPSIZES == 2) assign FWriteDataE = FmtE ? YE : {`FLEN/`LEN1{YE[`LEN1-1:0]}};
|
||||||
else if(`FPSIZES == 2) assign WriteDataE = FmtE ? YE : {`FLEN/`LEN1{YE[`LEN1-1:0]}};
|
|
||||||
else
|
else
|
||||||
always_comb
|
always_comb
|
||||||
case(FmtE)
|
case(FmtE)
|
||||||
`Q_FMT: WriteDataE = YE;
|
`Q_FMT: FWriteDataE = YE;
|
||||||
`D_FMT: WriteDataE = {`FLEN/`D_LEN{YE[`D_LEN-1:0]}};
|
`D_FMT: FWriteDataE = {`FLEN/`D_LEN{YE[`D_LEN-1:0]}};
|
||||||
`S_FMT: WriteDataE = {`FLEN/`S_LEN{YE[`S_LEN-1:0]}};
|
`S_FMT: FWriteDataE = {`FLEN/`S_LEN{YE[`S_LEN-1:0]}};
|
||||||
`H_FMT: WriteDataE = {`FLEN/`H_LEN{YE[`H_LEN-1:0]}};
|
`H_FMT: FWriteDataE = {`FLEN/`H_LEN{YE[`H_LEN-1:0]}};
|
||||||
endcase
|
endcase
|
||||||
flopenrc #(`FLEN) EMWriteDataReg (clk, reset, FlushM, ~StallM, WriteDataE, FWriteDataM);
|
flopenrc #(`FLEN) FWriteDataMReg (clk, reset, FlushM, ~StallM, FWriteDataE, FWriteDataM);
|
||||||
|
|
||||||
// NaN Block SrcA
|
// NaN Block SrcA
|
||||||
generate
|
generate
|
||||||
|
@ -45,7 +45,6 @@ module datapath (
|
|||||||
input logic JumpE,
|
input logic JumpE,
|
||||||
input logic BranchSignedE,
|
input logic BranchSignedE,
|
||||||
input logic IllegalFPUInstrE,
|
input logic IllegalFPUInstrE,
|
||||||
input logic [`XLEN-1:0] FWriteDataE,
|
|
||||||
input logic [`XLEN-1:0] PCE,
|
input logic [`XLEN-1:0] PCE,
|
||||||
input logic [`XLEN-1:0] PCLinkE,
|
input logic [`XLEN-1:0] PCLinkE,
|
||||||
output logic [1:0] FlagsE,
|
output logic [1:0] FlagsE,
|
||||||
@ -56,7 +55,7 @@ module datapath (
|
|||||||
input logic FWriteIntM,
|
input logic FWriteIntM,
|
||||||
input logic [`XLEN-1:0] FIntResM,
|
input logic [`XLEN-1:0] FIntResM,
|
||||||
output logic [`XLEN-1:0] SrcAM,
|
output logic [`XLEN-1:0] SrcAM,
|
||||||
output logic [`XLEN-1:0] WriteDataE,
|
output logic [`XLEN-1:0] WriteDataM,
|
||||||
// Writeback stage signals
|
// Writeback stage signals
|
||||||
input logic StallW, FlushW,
|
input logic StallW, FlushW,
|
||||||
(* mark_debug = "true" *) input logic RegWriteW,
|
(* mark_debug = "true" *) input logic RegWriteW,
|
||||||
@ -118,6 +117,7 @@ module datapath (
|
|||||||
flopenrc #(`XLEN) SrcAMReg(clk, reset, FlushM, ~StallM, SrcAE, SrcAM);
|
flopenrc #(`XLEN) SrcAMReg(clk, reset, FlushM, ~StallM, SrcAE, SrcAM);
|
||||||
flopenrc #(`XLEN) IEUResultMReg(clk, reset, FlushM, ~StallM, IEUResultE, IEUResultM);
|
flopenrc #(`XLEN) IEUResultMReg(clk, reset, FlushM, ~StallM, IEUResultE, IEUResultM);
|
||||||
flopenrc #(5) RdMReg(clk, reset, FlushM, ~StallM, RdE, RdM);
|
flopenrc #(5) RdMReg(clk, reset, FlushM, ~StallM, RdE, RdM);
|
||||||
|
flopenrc #(`XLEN) WriteDataMReg(clk, reset, FlushM, ~StallM, ForwardedSrcBE, WriteDataM);
|
||||||
|
|
||||||
// Writeback stage pipeline register and logic
|
// Writeback stage pipeline register and logic
|
||||||
flopenrc #(`XLEN) IFResultWReg(clk, reset, FlushW, ~StallW, IFResultM, IFResultW);
|
flopenrc #(`XLEN) IFResultWReg(clk, reset, FlushW, ~StallW, IFResultM, IFResultW);
|
||||||
@ -133,7 +133,6 @@ module datapath (
|
|||||||
assign IFResultM = IEUResultM;
|
assign IFResultM = IEUResultM;
|
||||||
mux5 #(`XLEN) resultmuxW(IFResultW, ReadDataW, CSRReadValW, MDUResultW, SCResultW, ResultSrcW, ResultW);
|
mux5 #(`XLEN) resultmuxW(IFResultW, ReadDataW, CSRReadValW, MDUResultW, SCResultW, ResultSrcW, ResultW);
|
||||||
end
|
end
|
||||||
assign WriteDataE = ForwardedSrcBE;
|
|
||||||
|
|
||||||
// handle Store Conditional result if atomic extension supported
|
// handle Store Conditional result if atomic extension supported
|
||||||
if (`A_SUPPORTED) assign SCResultW = {{(`XLEN-1){1'b0}}, SquashSCW};
|
if (`A_SUPPORTED) assign SCResultW = {{(`XLEN-1){1'b0}}, SquashSCW};
|
||||||
|
@ -41,7 +41,6 @@ module ieu (
|
|||||||
input logic [`XLEN-1:0] PCLinkE,
|
input logic [`XLEN-1:0] PCLinkE,
|
||||||
input logic FWriteIntE,
|
input logic FWriteIntE,
|
||||||
input logic IllegalFPUInstrE,
|
input logic IllegalFPUInstrE,
|
||||||
input logic [`XLEN-1:0] FWriteDataE,
|
|
||||||
output logic [`XLEN-1:0] IEUAdrE,
|
output logic [`XLEN-1:0] IEUAdrE,
|
||||||
output logic MDUE, W64E,
|
output logic MDUE, W64E,
|
||||||
output logic [2:0] Funct3E,
|
output logic [2:0] Funct3E,
|
||||||
@ -51,7 +50,7 @@ module ieu (
|
|||||||
input logic SquashSCW, // from LSU
|
input logic SquashSCW, // from LSU
|
||||||
output logic [1:0] MemRWM, // read/write control goes to LSU
|
output logic [1:0] MemRWM, // read/write control goes to LSU
|
||||||
output logic [1:0] AtomicM, // atomic control goes to LSU
|
output logic [1:0] AtomicM, // atomic control goes to LSU
|
||||||
output logic [`XLEN-1:0] WriteDataE, // Address and write data to LSU
|
output logic [`XLEN-1:0] WriteDataM, // write data to LSU
|
||||||
|
|
||||||
output logic [2:0] Funct3M, // size and signedness to LSU
|
output logic [2:0] Funct3M, // size and signedness to LSU
|
||||||
output logic [`XLEN-1:0] SrcAM, // to privilege and fpu
|
output logic [`XLEN-1:0] SrcAM, // to privilege and fpu
|
||||||
@ -107,8 +106,8 @@ module ieu (
|
|||||||
datapath dp(
|
datapath dp(
|
||||||
.clk, .reset, .ImmSrcD, .InstrD, .StallE, .FlushE, .ForwardAE, .ForwardBE,
|
.clk, .reset, .ImmSrcD, .InstrD, .StallE, .FlushE, .ForwardAE, .ForwardBE,
|
||||||
.ALUControlE, .Funct3E, .ALUSrcAE, .ALUSrcBE, .ALUResultSrcE, .JumpE, .BranchSignedE, .IllegalFPUInstrE,
|
.ALUControlE, .Funct3E, .ALUSrcAE, .ALUSrcBE, .ALUResultSrcE, .JumpE, .BranchSignedE, .IllegalFPUInstrE,
|
||||||
.FWriteDataE, .PCE, .PCLinkE, .FlagsE, .IEUAdrE, .ForwardedSrcAE, .ForwardedSrcBE,
|
.PCE, .PCLinkE, .FlagsE, .IEUAdrE, .ForwardedSrcAE, .ForwardedSrcBE,
|
||||||
.StallM, .FlushM, .FWriteIntM, .FIntResM, .SrcAM, .WriteDataE, .FResSelW,
|
.StallM, .FlushM, .FWriteIntM, .FIntResM, .SrcAM, .WriteDataM, .FResSelW,
|
||||||
.StallW, .FlushW, .RegWriteW, .SquashSCW, .ResultSrcW, .ReadDataW, .FCvtIntResW,
|
.StallW, .FlushW, .RegWriteW, .SquashSCW, .ResultSrcW, .ReadDataW, .FCvtIntResW,
|
||||||
.CSRReadValW, .MDUResultW, .Rs1D, .Rs2D, .Rs1E, .Rs2E, .RdE, .RdM, .RdW);
|
.CSRReadValW, .MDUResultW, .Rs1D, .Rs2D, .Rs1E, .Rs2E, .RdE, .RdM, .RdW);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ module lsu (
|
|||||||
// address and write data
|
// address and write data
|
||||||
input logic [`XLEN-1:0] IEUAdrE,
|
input logic [`XLEN-1:0] IEUAdrE,
|
||||||
(* mark_debug = "true" *)output logic [`XLEN-1:0] IEUAdrM,
|
(* mark_debug = "true" *)output logic [`XLEN-1:0] IEUAdrM,
|
||||||
input logic [`XLEN-1:0] WriteDataE,
|
(* mark_debug = "true" *)input logic [`XLEN-1:0] WriteDataM,
|
||||||
output logic [`LLEN-1:0] ReadDataW,
|
output logic [`LLEN-1:0] ReadDataW,
|
||||||
// cpu privilege
|
// cpu privilege
|
||||||
input logic [1:0] PrivilegeModeW,
|
input logic [1:0] PrivilegeModeW,
|
||||||
@ -111,14 +111,12 @@ module lsu (
|
|||||||
logic SelLSUBusWord;
|
logic SelLSUBusWord;
|
||||||
logic DataDAPageFaultM;
|
logic DataDAPageFaultM;
|
||||||
logic [`XLEN-1:0] LSUWriteDataM;
|
logic [`XLEN-1:0] LSUWriteDataM;
|
||||||
logic [`XLEN-1:0] WriteDataM;
|
|
||||||
logic [`LLEN-1:0] ReadDataM;
|
logic [`LLEN-1:0] ReadDataM;
|
||||||
logic [(`LLEN-1)/8:0] ByteMaskM, FinalByteMaskM;
|
logic [(`LLEN-1)/8:0] ByteMaskM, FinalByteMaskM;
|
||||||
|
|
||||||
// *** TO DO: Burst mode
|
// *** TO DO: Burst mode
|
||||||
|
|
||||||
flopenrc #(`XLEN) AddressMReg(clk, reset, FlushM, ~StallM, IEUAdrE, IEUAdrM);
|
flopenrc #(`XLEN) AddressMReg(clk, reset, FlushM, ~StallM, IEUAdrE, IEUAdrM);
|
||||||
flopenrc #(`XLEN) WriteDataMReg(clk, reset, FlushM, ~StallM, WriteDataE, WriteDataM); // *** move this flop to IEU
|
|
||||||
assign IEUAdrExtM = {2'b00, IEUAdrM};
|
assign IEUAdrExtM = {2'b00, IEUAdrM};
|
||||||
assign LSUStallM = DCacheStallM | InterlockStall | BusStall;
|
assign LSUStallM = DCacheStallM | InterlockStall | BusStall;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user