Skip to content

Commit

Permalink
Fix ICache exception priority over miss reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Feb 19, 2018
1 parent 0270ee2 commit d957934
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/main/scala/vexriscv/ip/InstructionCache.scala
Expand Up @@ -77,15 +77,15 @@ case class InstructionCacheCpuDecode(p : InstructionCacheConfig) extends Bundle
val isUser = Bool
val isStuck = Bool
val pc = UInt(p.addressWidth bits)
val redo = Bool
val cacheMiss = Bool
val data = ifGen(p.dataOnDecode) (Bits(p.cpuDataWidth bits))
val error = if(p.catchAccessFault) Bool else null
val mmuMiss = if(p.catchMemoryTranslationMiss) Bool else null
val illegalAccess = if(p.catchIllegalAccess) Bool else null
val error = Bool
val mmuMiss = Bool
val illegalAccess =Bool

override def asMaster(): Unit = {
out(isValid, isUser, isStuck, pc)
in(redo)
in(cacheMiss)
inWithNull(error,mmuMiss,illegalAccess,data)
}
}
Expand Down Expand Up @@ -334,16 +334,16 @@ class InstructionCache(p : InstructionCacheConfig) extends Component{
}
}

io.cpu.decode.redo := io.cpu.decode.isValid && !hit.valid
when(io.cpu.decode.redo){
io.cpu.decode.cacheMiss := !hit.valid
when( io.cpu.decode.isValid && io.cpu.decode.cacheMiss){
io.cpu.prefetch.haltIt := True
lineLoader.valid := True
lineLoader.address := mmuRsp.physicalAddress //Could be optimise if mmu not used
}

if(catchAccessFault) io.cpu.decode.error := hit.error
if(catchMemoryTranslationMiss) io.cpu.decode.mmuMiss := mmuRsp.miss
if(catchIllegalAccess) io.cpu.decode.illegalAccess := !mmuRsp.allowExecute || (io.cpu.decode.isUser && !mmuRsp.allowUser)
io.cpu.decode.error := hit.error
io.cpu.decode.mmuMiss := mmuRsp.miss
io.cpu.decode.illegalAccess := !mmuRsp.allowExecute || (io.cpu.decode.isUser && !mmuRsp.allowUser)
}
}

2 changes: 1 addition & 1 deletion src/main/scala/vexriscv/plugin/IBusCachedPlugin.scala
Expand Up @@ -112,7 +112,7 @@ class IBusCachedPlugin(config : InstructionCacheConfig, askMemoryTranslation : B
cache.io.cpu.decode.isUser := (if(privilegeService != null) privilegeService.isUser(decode) else False)
// cache.io.cpu.decode.pc := decode.input(PC)

redoBranch.valid := cache.io.cpu.decode.redo
redoBranch.valid := decode.arbitration.isValid && ownDecode && cache.io.cpu.decode.cacheMiss && !cache.io.cpu.decode.mmuMiss && !cache.io.cpu.decode.illegalAccess
redoBranch.payload := decode.input(PC)
when(redoBranch.valid){
decode.arbitration.redoIt := True
Expand Down

0 comments on commit d957934

Please sign in to comment.