forked from Github_Repos/cvw
moved fpu ieu write data mux to lsu
This commit is contained in:
parent
96a75d7749
commit
cd53ae67d9
@ -1 +1 @@
|
|||||||
vsim -c -do "do wally-pipelined-batch.do rv64gc imperas64f"
|
vsim -c -do "do wally-pipelined-batch.do rv32gc wally32d"
|
||||||
|
10
pipelined/src/cache/cache.sv
vendored
10
pipelined/src/cache/cache.sv
vendored
@ -42,10 +42,8 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, LOGWPL, WORDLEN, MUXINTER
|
|||||||
input logic [11:0] NextAdr, // virtual address, but we only use the lower 12 bits.
|
input logic [11:0] NextAdr, // virtual address, but we only use the lower 12 bits.
|
||||||
input logic [`PA_BITS-1:0] PAdr, // physical address
|
input logic [`PA_BITS-1:0] PAdr, // physical address
|
||||||
input logic [(`XLEN-1)/8:0] ByteMask,
|
input logic [(`XLEN-1)/8:0] ByteMask,
|
||||||
input logic [`XLEN-1:0] FinalWriteData,
|
input logic [WORDLEN-1:0] FinalWriteData,
|
||||||
input logic [`FLEN-1:0] FWriteDataM,
|
|
||||||
input logic FLoad2,
|
input logic FLoad2,
|
||||||
input logic FpLoadStoreM,
|
|
||||||
output logic CacheCommitted,
|
output logic CacheCommitted,
|
||||||
output logic CacheStall,
|
output logic CacheStall,
|
||||||
// to performance counters to cpu
|
// to performance counters to cpu
|
||||||
@ -72,7 +70,7 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, LOGWPL, WORDLEN, MUXINTER
|
|||||||
localparam SETLEN = $clog2(NUMLINES);
|
localparam SETLEN = $clog2(NUMLINES);
|
||||||
localparam SETTOP = SETLEN+OFFSETLEN;
|
localparam SETTOP = SETLEN+OFFSETLEN;
|
||||||
localparam TAGLEN = `PA_BITS - SETTOP;
|
localparam TAGLEN = `PA_BITS - SETTOP;
|
||||||
localparam WORDSPERLINE = LINELEN/`XLEN;
|
localparam WORDSPERLINE = LINELEN/WORDLEN;
|
||||||
localparam FlushAdrThreshold = NUMLINES - 1;
|
localparam FlushAdrThreshold = NUMLINES - 1;
|
||||||
|
|
||||||
logic SelAdr;
|
logic SelAdr;
|
||||||
@ -162,10 +160,6 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, LOGWPL, WORDLEN, MUXINTER
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Write Path: Write data and address. Muxes between writes from bus and writes from CPU.
|
// Write Path: Write data and address. Muxes between writes from bus and writes from CPU.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (`LLEN>`XLEN)
|
|
||||||
mux3 #(LINELEN) WriteDataMux(.d0({WORDSPERLINE{FinalWriteData}}),
|
|
||||||
.d1({WORDSPERLINE/2{FWriteDataM}}), .d2(CacheBusWriteData), .s({SetValid,FpLoadStoreM&~SetValid}), .y(CacheWriteData));
|
|
||||||
else
|
|
||||||
mux2 #(LINELEN) WriteDataMux(.d0({WORDSPERLINE{FinalWriteData}}),
|
mux2 #(LINELEN) WriteDataMux(.d0({WORDSPERLINE{FinalWriteData}}),
|
||||||
.d1(CacheBusWriteData), .s(SetValid), .y(CacheWriteData));
|
.d1(CacheBusWriteData), .s(SetValid), .y(CacheWriteData));
|
||||||
mux3 #(`PA_BITS) CacheBusAdrMux(.d0({PAdr[`PA_BITS-1:OFFSETLEN], {OFFSETLEN{1'b0}}}),
|
mux3 #(`PA_BITS) CacheBusAdrMux(.d0({PAdr[`PA_BITS-1:OFFSETLEN], {OFFSETLEN{1'b0}}}),
|
||||||
|
@ -226,7 +226,7 @@ module ifu (
|
|||||||
icache(.clk, .reset, .CPUBusy, .IgnoreRequestTLB(ITLBMissF), .TrapM(TrapM), .IgnoreRequestTrapM('0),
|
icache(.clk, .reset, .CPUBusy, .IgnoreRequestTLB(ITLBMissF), .TrapM(TrapM), .IgnoreRequestTrapM('0),
|
||||||
.CacheBusWriteData(ICacheBusWriteData), .CacheBusAck(ICacheBusAck),
|
.CacheBusWriteData(ICacheBusWriteData), .CacheBusAck(ICacheBusAck),
|
||||||
.CacheBusAdr(ICacheBusAdr), .CacheStall(ICacheStallF),
|
.CacheBusAdr(ICacheBusAdr), .CacheStall(ICacheStallF),
|
||||||
.CacheFetchLine(ICacheFetchLine), .FWriteDataM(), .FpLoadStoreM(), .FLoad2(),
|
.CacheFetchLine(ICacheFetchLine), .FLoad2(),
|
||||||
.CacheWriteLine(), .ReadDataWord(FinalInstrRawF),
|
.CacheWriteLine(), .ReadDataWord(FinalInstrRawF),
|
||||||
.Cacheable(CacheableF),
|
.Cacheable(CacheableF),
|
||||||
.CacheMiss(ICacheMiss), .CacheAccess(ICacheAccess),
|
.CacheMiss(ICacheMiss), .CacheAccess(ICacheAccess),
|
||||||
|
@ -192,7 +192,8 @@ module lsu (
|
|||||||
// Memory System
|
// Memory System
|
||||||
// Either Data Cache or Data Tightly Integrated Memory or just bus interface
|
// Either Data Cache or Data Tightly Integrated Memory or just bus interface
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
logic [`XLEN-1:0] AMOWriteDataM, FinalWriteDataM, LittleEndianWriteDataM;
|
logic [`XLEN-1:0] AMOWriteDataM, IEUWriteDataM, LittleEndianWriteDataM;
|
||||||
|
logic [`LLEN-1:0] FinalWriteDataM;
|
||||||
logic [`LLEN-1:0] ReadDataWordM, LittleEndianReadDataWordM;
|
logic [`LLEN-1:0] ReadDataWordM, LittleEndianReadDataWordM;
|
||||||
logic [`LLEN-1:0] ReadDataWordMuxM;
|
logic [`LLEN-1:0] ReadDataWordMuxM;
|
||||||
logic IgnoreRequest;
|
logic IgnoreRequest;
|
||||||
@ -202,7 +203,7 @@ module lsu (
|
|||||||
if (`DMEM == `MEM_TIM) begin : dtim
|
if (`DMEM == `MEM_TIM) begin : dtim
|
||||||
// *** directly instantiate RAM or ROM here. Instantiate SRAM1P1RW.
|
// *** directly instantiate RAM or ROM here. Instantiate SRAM1P1RW.
|
||||||
// Merge SimpleRAM and SRAM1p1rw into one that is good for synthesis and RAM libraries and flops
|
// Merge SimpleRAM and SRAM1p1rw into one that is good for synthesis and RAM libraries and flops
|
||||||
dtim dtim(.clk, .reset, .CPUBusy, .LSURWM, .IEUAdrM, .IEUAdrE, .TrapM, .FinalWriteDataM,
|
dtim dtim(.clk, .reset, .CPUBusy, .LSURWM, .IEUAdrM, .IEUAdrE, .TrapM, .FinalWriteDataM(IEUWriteDataM), //*** fix the dtim FinalWriteData
|
||||||
.ReadDataWordM(ReadDataWordM[`XLEN-1:0]), .BusStall, .LSUBusWrite,.LSUBusRead, .BusCommittedM,
|
.ReadDataWordM(ReadDataWordM[`XLEN-1:0]), .BusStall, .LSUBusWrite,.LSUBusRead, .BusCommittedM,
|
||||||
.DCacheStallM, .DCacheCommittedM, .ByteMaskM, .Cacheable(CacheableM),
|
.DCacheStallM, .DCacheCommittedM, .ByteMaskM, .Cacheable(CacheableM),
|
||||||
.DCacheMiss, .DCacheAccess);
|
.DCacheMiss, .DCacheAccess);
|
||||||
@ -230,15 +231,19 @@ module lsu (
|
|||||||
|
|
||||||
mux2 #(`LLEN) UnCachedDataMux(.d0(LittleEndianReadDataWordM), .d1({{`LLEN-`XLEN{1'b0}}, DCacheBusWriteData[`XLEN-1:0]}),
|
mux2 #(`LLEN) UnCachedDataMux(.d0(LittleEndianReadDataWordM), .d1({{`LLEN-`XLEN{1'b0}}, DCacheBusWriteData[`XLEN-1:0]}),
|
||||||
.s(SelUncachedAdr), .y(ReadDataWordMuxM));
|
.s(SelUncachedAdr), .y(ReadDataWordMuxM));
|
||||||
mux2 #(`XLEN) LsuBushwdataMux(.d0(ReadDataWordM[`XLEN-1:0]), .d1(FinalWriteDataM),
|
mux2 #(`XLEN) LsuBushwdataMux(.d0(ReadDataWordM[`XLEN-1:0]), .d1(IEUWriteDataM),
|
||||||
.s(SelUncachedAdr), .y(LSUBusHWDATA));
|
.s(SelUncachedAdr), .y(LSUBusHWDATA));
|
||||||
|
|
||||||
if(CACHE_ENABLED) begin : dcache
|
if(CACHE_ENABLED) begin : dcache
|
||||||
|
if (`LLEN>`FLEN)
|
||||||
|
mux2 #(`LLEN) datamux({(`LLEN-`XLEN)'(0), IEUWriteDataM}, FWriteDataM, FpLoadStoreM, FinalWriteDataM);
|
||||||
|
else
|
||||||
|
assign FinalWriteDataM[`XLEN-1:0] = IEUWriteDataM;
|
||||||
cache #(.LINELEN(`DCACHE_LINELENINBITS), .NUMLINES(`DCACHE_WAYSIZEINBYTES*8/LINELEN),
|
cache #(.LINELEN(`DCACHE_LINELENINBITS), .NUMLINES(`DCACHE_WAYSIZEINBYTES*8/LINELEN),
|
||||||
.NUMWAYS(`DCACHE_NUMWAYS), .LOGWPL(LOGWPL), .WORDLEN(`LLEN), .MUXINTERVAL(`XLEN), .DCACHE(1)) dcache(
|
.NUMWAYS(`DCACHE_NUMWAYS), .LOGWPL(LOGWPL), .WORDLEN(`LLEN), .MUXINTERVAL(`XLEN), .DCACHE(1)) dcache(
|
||||||
.clk, .reset, .CPUBusy, .LSUBusWriteCrit, .RW(LSURWM), .Atomic(LSUAtomicM),
|
.clk, .reset, .CPUBusy, .LSUBusWriteCrit, .RW(LSURWM), .Atomic(LSUAtomicM),
|
||||||
.FlushCache(FlushDCacheM), .NextAdr(LSUAdrE), .PAdr(LSUPAdrM),
|
.FlushCache(FlushDCacheM), .NextAdr(LSUAdrE), .PAdr(LSUPAdrM),
|
||||||
.ByteMask(ByteMaskM), .WordCount, .FpLoadStoreM, .FWriteDataM, .FLoad2,
|
.ByteMask(ByteMaskM), .WordCount, .FLoad2,
|
||||||
.FinalWriteData(FinalWriteDataM), .Cacheable(CacheableM),
|
.FinalWriteData(FinalWriteDataM), .Cacheable(CacheableM),
|
||||||
.CacheStall(DCacheStallM), .CacheMiss(DCacheMiss), .CacheAccess(DCacheAccess),
|
.CacheStall(DCacheStallM), .CacheMiss(DCacheMiss), .CacheAccess(DCacheAccess),
|
||||||
.IgnoreRequestTLB, .IgnoreRequestTrapM, .TrapM(1'b0), .CacheCommitted(DCacheCommittedM),
|
.IgnoreRequestTLB, .IgnoreRequestTrapM, .TrapM(1'b0), .CacheCommitted(DCacheCommittedM),
|
||||||
@ -286,10 +291,10 @@ module lsu (
|
|||||||
// swap the bytes when read from big-endian memory
|
// swap the bytes when read from big-endian memory
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (`BIGENDIAN_SUPPORTED) begin:endian
|
if (`BIGENDIAN_SUPPORTED) begin:endian
|
||||||
bigendianswap #(`XLEN) storeswap(.BigEndianM, .a(LittleEndianWriteDataM), .y(FinalWriteDataM));
|
bigendianswap #(`XLEN) storeswap(.BigEndianM, .a(LittleEndianWriteDataM), .y(IEUWriteDataM));
|
||||||
bigendianswap #(`LLEN) loadswap(.BigEndianM, .a(ReadDataWordM), .y(LittleEndianReadDataWordM));
|
bigendianswap #(`LLEN) loadswap(.BigEndianM, .a(ReadDataWordM), .y(LittleEndianReadDataWordM));
|
||||||
end else begin
|
end else begin
|
||||||
assign FinalWriteDataM = LittleEndianWriteDataM;
|
assign IEUWriteDataM = LittleEndianWriteDataM;
|
||||||
assign LittleEndianReadDataWordM = ReadDataWordM;
|
assign LittleEndianReadDataWordM = ReadDataWordM;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ logic [3:0] dummy;
|
|||||||
"arch32f": if (`F_SUPPORTED) tests = arch32f;
|
"arch32f": if (`F_SUPPORTED) tests = arch32f;
|
||||||
"imperas32i": tests = imperas32i;
|
"imperas32i": tests = imperas32i;
|
||||||
"imperas32f": if (`F_SUPPORTED) tests = imperas32f;
|
"imperas32f": if (`F_SUPPORTED) tests = imperas32f;
|
||||||
|
"wally32d": if (`D_SUPPORTED) tests = wally32d;
|
||||||
"imperas32m": if (`M_SUPPORTED) tests = imperas32m;
|
"imperas32m": if (`M_SUPPORTED) tests = imperas32m;
|
||||||
"wally32a": if (`A_SUPPORTED) tests = wally32a;
|
"wally32a": if (`A_SUPPORTED) tests = wally32a;
|
||||||
"imperas32c": if (`C_SUPPORTED) tests = imperas32c;
|
"imperas32c": if (`C_SUPPORTED) tests = imperas32c;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
string tvpaths[] = '{
|
string tvpaths[] = '{
|
||||||
"../../addins/imperas-riscv-tests/work/",
|
"../../addins/imperas-riscv-tests/work/",
|
||||||
"../../tests/riscof/work/riscv-arch-test/",
|
"../../tests/riscof/work/riscv-arch-test/",
|
||||||
"../../tests/wally-riscv-arch-test/work/", //"../../tests/riscof/work/wally-riscv-arch-test/",
|
"../../tests/riscof/work/wally-riscv-arch-test/", //"../../tests/wally-riscv-arch-test/work/", //
|
||||||
"../../tests/imperas-riscv-tests/work/",
|
"../../tests/imperas-riscv-tests/work/",
|
||||||
"../../benchmarks/coremark/work/",
|
"../../benchmarks/coremark/work/",
|
||||||
"../../addins/embench-iot/"
|
"../../addins/embench-iot/"
|
||||||
|
@ -8,7 +8,7 @@ wally_workdir = $(work)/wally-riscv-arch-test
|
|||||||
current_dir = $(shell pwd)
|
current_dir = $(shell pwd)
|
||||||
XLEN ?= 64
|
XLEN ?= 64
|
||||||
|
|
||||||
all: root build_arch # build_wally memfile
|
all: root build_arch build_wally memfile
|
||||||
|
|
||||||
root:
|
root:
|
||||||
mkdir -p $(work_dir)
|
mkdir -p $(work_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user