Two stage datacache now pass dhrystone benchmark without error

This commit is contained in:
Charles Papon 2017-04-23 23:15:38 +02:00
parent 9040326273
commit ba2ca77114
7 changed files with 176169 additions and 133 deletions

View File

@ -612,18 +612,22 @@ class DataCache(p : DataCacheConfig) extends Component{
// } // }
is(MEMORY) { is(MEMORY) {
when(request.bypass) { when(request.bypass) {
val memCmdSent = RegInit(False)
when(!victim.request.valid) { //Avoid mixing memory request while victim is pending when(!victim.request.valid) { //Avoid mixing memory request while victim is pending
//Can't+rite burst
val memCmdValid = RegInit(False) clearWhen(io.mem.cmd.ready) setWhen(!io.cpu.writeBack.isStuck)
io.mem.cmd.valid := memCmdValid
io.mem.cmd.wr := request.wr io.mem.cmd.wr := request.wr
io.mem.cmd.address := request.address(tagRange.high downto wordRange.low) @@ U(0,wordRange.low bit) io.mem.cmd.address := request.address(tagRange.high downto wordRange.low) @@ U(0,wordRange.low bit)
io.mem.cmd.mask := request.mask io.mem.cmd.mask := request.mask
io.mem.cmd.data := request.data io.mem.cmd.data := request.data
io.mem.cmd.length := 1 io.mem.cmd.length := 1
io.cpu.writeBack.haltIt.clearWhen(io.mem.rsp.fire || (!memCmdValid && request.wr)) //Cut mem.cmd.ready path but insert one cycle stall when write when(!memCmdSent) {
io.mem.cmd.valid := True
memCmdSent setWhen(io.mem.cmd.ready)
}
io.cpu.writeBack.haltIt.clearWhen(memCmdSent && (io.mem.rsp.fire || request.wr)) //Cut mem.cmd.ready path but insert one cycle stall when write
} }
memCmdSent clearWhen(!io.cpu.writeBack.isStuck)
} otherwise { } otherwise {
when(waysHit || !loadingNotDone){ when(waysHit || !loadingNotDone){
io.cpu.writeBack.haltIt := False io.cpu.writeBack.haltIt := False

View File

@ -79,39 +79,39 @@ object TopLevel {
configFull.plugins ++= List( configFull.plugins ++= List(
new PcManagerSimplePlugin(0x00000000l, false), new PcManagerSimplePlugin(0x00000000l, false),
// new IBusSimplePlugin( new IBusSimplePlugin(
// interfaceKeepData = true, interfaceKeepData = true,
// catchAccessFault = true
// ),
new IBusCachedPlugin(
config = InstructionCacheConfig(
cacheSize = 4096,
bytePerLine =32,
wayCount = 1,
wrappedMemAccess = true,
addressWidth = 32,
cpuDataWidth = 32,
memDataWidth = 32,
catchAccessFault = true,
asyncTagMemory = false,
twoStageLogic = true
)
),
new DBusSimplePlugin(
catchAddressMisaligned = true,
catchAccessFault = true catchAccessFault = true
), ),
// new DBusCachedPlugin( // new IBusCachedPlugin(
// config = new DataCacheConfig( // config = InstructionCacheConfig(
// cacheSize = 4096, // cacheSize = 4096,
// bytePerLine = 32, // bytePerLine =32,
// wayCount = 1, // wayCount = 1,
// addressWidth = 32, // wrappedMemAccess = true,
// cpuDataWidth = 32, // addressWidth = 32,
// memDataWidth = 32, // cpuDataWidth = 32,
// catchAccessFault = false // memDataWidth = 32,
// catchAccessFault = true,
// asyncTagMemory = false,
// twoStageLogic = true
// ) // )
// ), // ),
// new DBusSimplePlugin(
// catchAddressMisaligned = true,
// catchAccessFault = true
// ),
new DBusCachedPlugin(
config = new DataCacheConfig(
cacheSize = 4096,
bytePerLine = 32,
wayCount = 1,
addressWidth = 32,
cpuDataWidth = 32,
memDataWidth = 32,
catchAccessFault = false
)
),
new DecoderSimplePlugin( new DecoderSimplePlugin(
catchIllegalInstruction = true catchIllegalInstruction = true
), ),
@ -176,15 +176,16 @@ object TopLevel {
new LightShifterPlugin, new LightShifterPlugin,
// new HazardSimplePlugin(true, true, true, true), // new HazardSimplePlugin(true, true, true, true),
// new HazardSimplePlugin(false, true, false, true), // new HazardSimplePlugin(false, true, false, true),
new HazardSimplePlugin( // new HazardSimplePlugin(
bypassExecute = false, // bypassExecute = false,
bypassMemory = false, // bypassMemory = false,
bypassWriteBack = false, // bypassWriteBack = false,
bypassWriteBackBuffer = false, // bypassWriteBackBuffer = false,
pessimisticUseSrc = false, // pessimisticUseSrc = false,
pessimisticWriteRegFile = false, // pessimisticWriteRegFile = false,
pessimisticAddressMatch = false // pessimisticAddressMatch = false
), // ),
new HazardPessimisticPlugin,
// new MulPlugin, // new MulPlugin,
// new DivPlugin, // new DivPlugin,
// new MachineCsr(csrConfig), // new MachineCsr(csrConfig),
@ -202,29 +203,29 @@ object TopLevel {
configTest.plugins ++= List( configTest.plugins ++= List(
new PcManagerSimplePlugin(0x00000000l, true), new PcManagerSimplePlugin(0x00000000l, true),
// new IBusSimplePlugin( new IBusSimplePlugin(
// interfaceKeepData = true, interfaceKeepData = true,
// catchAccessFault = false
// ),
new IBusCachedPlugin(
config = InstructionCacheConfig(
cacheSize = 4096,
bytePerLine =32,
wayCount = 1,
wrappedMemAccess = true,
addressWidth = 32,
cpuDataWidth = 32,
memDataWidth = 32,
catchAccessFault = false,
asyncTagMemory = false,
twoStageLogic = true
)
),
new DBusSimplePlugin(
catchAddressMisaligned = false,
catchAccessFault = false catchAccessFault = false
), ),
// new IBusCachedPlugin(
// config = InstructionCacheConfig(
// cacheSize = 4096,
// bytePerLine =32,
// wayCount = 1,
// wrappedMemAccess = true,
// addressWidth = 32,
// cpuDataWidth = 32,
// memDataWidth = 32,
// catchAccessFault = false,
// asyncTagMemory = false,
// twoStageLogic = true
// )
// ),
// new DBusSimplePlugin(
// catchAddressMisaligned = false,
// catchAccessFault = false
// ),
// new DBusCachedPlugin( // new DBusCachedPlugin(
// config = new DataCacheConfig( // config = new DataCacheConfig(
// cacheSize = 2048, // cacheSize = 2048,
@ -236,13 +237,23 @@ object TopLevel {
// catchAccessFault = false // catchAccessFault = false
// ) // )
// ), // ),
new DBusCachedPlugin(
config = new DataCacheConfig(
cacheSize = 128,
bytePerLine = 32,
wayCount = 1,
addressWidth = 32,
cpuDataWidth = 32,
memDataWidth = 32,
catchAccessFault = false
)
),
new DecoderSimplePlugin( new DecoderSimplePlugin(
catchIllegalInstruction = false catchIllegalInstruction = false
), ),
new RegFilePlugin( new RegFilePlugin(
regFileReadyKind = Plugin.SYNC, regFileReadyKind = Plugin.SYNC,
zeroBoot = false zeroBoot = true
), ),
new IntAluPlugin, new IntAluPlugin,
new SrcPlugin( new SrcPlugin(
@ -291,3 +302,4 @@ object TopLevel {
//TODO MulPlugin doesn't fit well on Artix (FMAX) //TODO MulPlugin doesn't fit well on Artix (FMAX)
//TODO PcReg design is unoptimized by Artix synthesis //TODO PcReg design is unoptimized by Artix synthesis
//TODO FMAX SRC mux + bipass mux prioriti //TODO FMAX SRC mux + bipass mux prioriti
//TODO FMAX, isFiring is to pesimisstinc in some cases(include removeIt flushed ..)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +1,110 @@
[*] [*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI [*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Wed Apr 12 17:13:59 2017 [*] Sun Apr 23 20:40:44 2017
[*] [*]
[dumpfile] "/home/spinalvm/Spinal/VexRiscv/src/test/cpp/testA/dhrystoneO3.vcd" [dumpfile] "/home/spinalvm/Spinal/VexRiscv/src/test/cpp/testA/dhrystoneO3_Stall.vcd"
[dumpfile_mtime] "Wed Apr 12 17:05:50 2017" [dumpfile_mtime] "Sun Apr 23 20:39:06 2017"
[dumpfile_size] 476292557 [dumpfile_size] 524533821
[savefile] "/home/spinalvm/Spinal/VexRiscv/src/test/cpp/testA/fail.gtkw" [savefile] "/home/spinalvm/Spinal/VexRiscv/src/test/cpp/testA/fail.gtkw"
[timestart] 602234 [timestart] 122461
[size] 1776 953 [size] 1776 953
[pos] -775 -1 [pos] -775 -353
*-3.626630 602285 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 *-7.000000 122712 59602 124439 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[treeopen] TOP. [treeopen] TOP.
[treeopen] TOP.VexRiscv. [treeopen] TOP.VexRiscv.
[sst_width] 201 [sst_width] 201
[signals_width] 518 [signals_width] 565
[sst_expanded] 1 [sst_expanded] 1
[sst_vpaned_height] 279 [sst_vpaned_height] 253
@22
TOP.VexRiscv.instructionCache_1.io_cpu_prefetch_address[31:0]
@28 @28
TOP.VexRiscv.instructionCache_1.io_cpu_prefetch_haltIt TOP.VexRiscv.writeBack_arbitration_isValid
TOP.VexRiscv.writeBack_arbitration_isFiring
@22
TOP.VexRiscv.writeBack_PC[31:0]
TOP.VexRiscv.writeBack_INSTRUCTION[31:0]
@28
TOP.VexRiscv.writeBack_RegFilePlugin_regFileWrite_valid
@22
TOP.VexRiscv.writeBack_RegFilePlugin_regFileWrite_payload_address[4:0]
TOP.VexRiscv.writeBack_RegFilePlugin_regFileWrite_payload_data[31:0]
@28
TOP.VexRiscv.execute_arbitration_isValid
TOP.VexRiscv.execute_arbitration_isStuck
@22
TOP.VexRiscv.execute_PC[31:0]
@28
TOP.VexRiscv.dataCache_1.io_cpu_execute_isValid
@22
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_address[31:0]
@28
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_wr
@800200 @800200
-Fetch -execute
@22
TOP.VexRiscv.instructionCache_1.io_cpu_fetch_address[31:0]
@28
TOP.VexRiscv.instructionCache_1.io_cpu_fetch_isStuck
TOP.VexRiscv.instructionCache_1.io_cpu_fetch_isValid
@1000200
-Fetch
@800200
-Decode
@22
TOP.VexRiscv.instructionCache_1.io_cpu_decode_address[31:0]
TOP.VexRiscv.instructionCache_1.io_cpu_decode_data[31:0]
@28
TOP.VexRiscv.instructionCache_1.io_cpu_decode_haltIt
TOP.VexRiscv.instructionCache_1.io_cpu_decode_isStuck
TOP.VexRiscv.instructionCache_1.io_cpu_decode_isValid
@1000200
-Decode
@800200
-Task
@22
TOP.VexRiscv.instructionCache_1.task_memRead_data[31:0]
TOP.VexRiscv.instructionCache_1.task_memRead_tag_address[19:0]
@28
TOP.VexRiscv.instructionCache_1.task_memRead_tag_valid
@22
TOP.VexRiscv.instructionCache_1.task_tag_address[19:0]
@28
TOP.VexRiscv.instructionCache_1.task_tag_valid
@22
TOP.VexRiscv.instructionCache_1.task_dataRegIn[31:0]
TOP.VexRiscv.instructionCache_1.task_data[31:0]
@29 @29
TOP.VexRiscv.instructionCache_1.task_cacheHit TOP.VexRiscv.dataCache_1.io_cpu_execute_isValid
@22
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_address[31:0]
@28 @28
TOP.VexRiscv.instructionCache_1.task_hit TOP.VexRiscv.dataCache_1.io_cpu_execute_args_all
TOP.VexRiscv.instructionCache_1.task_loaderHit @29
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_bypass
@22
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_data[31:0]
@28
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_kind[1:0]
@22
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_mask[3:0]
@28
TOP.VexRiscv.dataCache_1.io_cpu_execute_args_wr
TOP.VexRiscv.dataCache_1.io_cpu_execute_isStuck
@1000200 @1000200
-Task -execute
@22
TOP.VexRiscv.instructionCache_1.io_mem_cmd_payload_address[31:0]
@28 @28
TOP.VexRiscv.instructionCache_1.io_mem_cmd_ready TOP.VexRiscv.dataCache_1.io_cpu_memory_isStuck
TOP.VexRiscv.instructionCache_1.io_mem_cmd_valid @800200
-writeBack
@22 @22
TOP.VexRiscv.instructionCache_1.io_mem_rsp_payload_data[31:0] TOP.VexRiscv.dataCache_1.io_cpu_writeBack_data[31:0]
@28 @28
TOP.VexRiscv.instructionCache_1.io_mem_rsp_valid TOP.VexRiscv.dataCache_1.io_cpu_writeBack_haltIt
TOP.VexRiscv.dataCache_1.io_cpu_writeBack_isStuck
TOP.VexRiscv.dataCache_1.io_cpu_writeBack_isValid
@1000200
-writeBack
@28
TOP.VexRiscv.dataCache_1.io_mem_cmd_valid
TOP.VexRiscv.dataCache_1.io_mem_cmd_ready
TOP.VexRiscv.dataCache_1.io_mem_cmd_payload_wr
@22 @22
TOP.VexRiscv.instructionCache_1.lineLoader_waysDatasWritePort_payload_address[9:0] TOP.VexRiscv.dataCache_1.io_mem_cmd_payload_address[31:0]
TOP.VexRiscv.instructionCache_1.lineLoader_waysDatasWritePort_payload_data[31:0] TOP.VexRiscv.dataCache_1.io_mem_cmd_payload_data[31:0]
TOP.VexRiscv.dataCache_1.io_mem_cmd_payload_mask[3:0]
TOP.VexRiscv.dataCache_1.io_mem_rsp_payload_data[31:0]
@28 @28
TOP.VexRiscv.instructionCache_1.lineLoader_waysDatasWritePort_valid TOP.VexRiscv.dataCache_1.io_mem_rsp_valid
TOP.VexRiscv.clk
@22 @22
TOP.VexRiscv.instructionCache_1.lineLoader_request_payload_addr[31:0] TOP.VexRiscv.dataCache_1.dataWriteCmd_payload_data[31:0]
TOP.VexRiscv.dataCache_1.dataWriteCmd_payload_mask[3:0]
@28 @28
TOP.VexRiscv.instructionCache_1.lineLoader_request_ready TOP.VexRiscv.dataCache_1.dataWriteCmd_valid
TOP.VexRiscv.instructionCache_1.lineLoader_request_valid TOP.VexRiscv.dataCache_1.clk
TOP.VexRiscv.dataCache_1.way_dataReadRspTwoEnable
@22
TOP.VexRiscv.dataCache_1.way_dataReadRspTwo[31:0]
@28
TOP.VexRiscv.dataCache_1.way_tagReadRspTwoEnable
TOP.VexRiscv.dataCache_1.way_tagReadRspTwo_dirty
TOP.VexRiscv.dataCache_1.way_tagReadRspTwo_used
@22
TOP.VexRiscv.dataCache_1.way_dataReadRspOne[31:0]
@28
TOP.VexRiscv.dataCache_1.victim_request_ready
TOP.VexRiscv.dataCache_1.victim_request_valid
TOP.VexRiscv.dataCache_1.victim_dataReadRestored
@22
TOP.VexRiscv.dataCache_1.victim_readLineCmdCounter[3:0]
TOP.VexRiscv.dataCache_1.dataReadCmd_payload[4:0]
@28
TOP.VexRiscv.dataCache_1.dataReadCmd_valid
[pattern_trace] 1 [pattern_trace] 1
[pattern_trace] 0 [pattern_trace] 0

View File

@ -239,9 +239,12 @@ public:
} }
switch(addr){ switch(addr){
case 0xF00FFF10u: case 0xF00FFF10u:
*data = i/2; *data = mTime;
#ifdef REF_TIME
mTime += 100000;
#endif
break; break;
case 0xF00FFF40u: *data = mTime; break; case 0xF00FFF40u: *data = mTime; break;
case 0xF00FFF44u: *data = mTime >> 32; break; case 0xF00FFF44u: *data = mTime >> 32; break;
case 0xF00FFF48u: *data = mTimeCmp; break; case 0xF00FFF48u: *data = mTimeCmp; break;
case 0xF00FFF4Cu: *data = mTimeCmp >> 32; break; case 0xF00FFF4Cu: *data = mTimeCmp >> 32; break;
@ -309,7 +312,9 @@ public:
try { try {
// run simulation for 100 clock periods // run simulation for 100 clock periods
for (i = 16; i < timeout*2; i+=2) { for (i = 16; i < timeout*2; i+=2) {
#ifndef REF_TIME
mTime = i/2; mTime = i/2;
#endif
#ifdef CSR #ifdef CSR
top->timerInterrupt = mTime >= mTimeCmp ? 1 : 0; top->timerInterrupt = mTime >= mTimeCmp ? 1 : 0;
//if(mTime == mTimeCmp) printf("SIM timer tick\n"); //if(mTime == mTimeCmp) printf("SIM timer tick\n");

View File

@ -1,13 +1,14 @@
IBUS=IBUS_CACHED IBUS=IBUS_SIMPLE
DBUS=DBUS_SIMPLE DBUS=DBUS_CACHED
TRACE=no TRACE=no
TRACE_START=0 TRACE_START=0
CSR=yes CSR=no
DHRYSTONE=yes DHRYSTONE=yes
FREE_RTOS=no FREE_RTOS=no
REDO=10 REDO=10
REF=no REF=no
TRACE_WITH_TIME=no TRACE_WITH_TIME=no
REF_TIME=no
ADDCFLAGS += -CFLAGS -D${IBUS} ADDCFLAGS += -CFLAGS -D${IBUS}
ADDCFLAGS += -CFLAGS -D${DBUS} ADDCFLAGS += -CFLAGS -D${DBUS}
@ -29,6 +30,10 @@ ifeq ($(TRACE_WITH_TIME),yes)
ADDCFLAGS += -CFLAGS -DTRACE_WITH_TIME ADDCFLAGS += -CFLAGS -DTRACE_WITH_TIME
endif endif
ifeq ($(REF_TIME),yes)
ADDCFLAGS += -CFLAGS -DREF_TIME
endif
ifeq ($(REF),yes) ifeq ($(REF),yes)
ADDCFLAGS += -CFLAGS -DREF ADDCFLAGS += -CFLAGS -DREF
endif endif