Add data cache flush feature
This commit is contained in:
parent
066f562c5e
commit
922c18ee49
|
@ -133,11 +133,13 @@ case class DataCacheCpuBus(p : DataCacheConfig) extends Bundle with IMasterSlave
|
||||||
val writeBack = DataCacheCpuWriteBack(p)
|
val writeBack = DataCacheCpuWriteBack(p)
|
||||||
|
|
||||||
val redo = Bool()
|
val redo = Bool()
|
||||||
|
val flush = Event
|
||||||
|
|
||||||
override def asMaster(): Unit = {
|
override def asMaster(): Unit = {
|
||||||
master(execute)
|
master(execute)
|
||||||
master(memory)
|
master(memory)
|
||||||
master(writeBack)
|
master(writeBack)
|
||||||
|
master(flush)
|
||||||
in(redo)
|
in(redo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +300,6 @@ case class DataCacheMemBus(p : DataCacheConfig) extends Bundle with IMasterSlave
|
||||||
|
|
||||||
class DataCache(p : DataCacheConfig) extends Component{
|
class DataCache(p : DataCacheConfig) extends Component{
|
||||||
import p._
|
import p._
|
||||||
assert(wayCount == 1)
|
|
||||||
assert(cpuDataWidth == memDataWidth)
|
assert(cpuDataWidth == memDataWidth)
|
||||||
|
|
||||||
val io = new Bundle{
|
val io = new Bundle{
|
||||||
|
@ -449,13 +450,20 @@ class DataCache(p : DataCacheConfig) extends Component{
|
||||||
tagsWriteCmd.address := mmuRsp.physicalAddress(lineRange)
|
tagsWriteCmd.address := mmuRsp.physicalAddress(lineRange)
|
||||||
tagsWriteCmd.way.setAll()
|
tagsWriteCmd.way.setAll()
|
||||||
tagsWriteCmd.data.valid := False
|
tagsWriteCmd.data.valid := False
|
||||||
when(mmuRsp.physicalAddress(lineRange) =/= lineCount - 1) {
|
when(mmuRsp.physicalAddress(lineRange) =/= wayLineCount - 1) {
|
||||||
mmuRsp.physicalAddress.getDrivingReg(lineRange) := mmuRsp.physicalAddress(lineRange) + 1
|
mmuRsp.physicalAddress.getDrivingReg(lineRange) := mmuRsp.physicalAddress(lineRange) + 1
|
||||||
io.cpu.writeBack.haltIt := True
|
io.cpu.writeBack.haltIt := True
|
||||||
} otherwise {
|
} otherwise {
|
||||||
valid := False
|
valid := False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
io.cpu.flush.ready := False
|
||||||
|
when(io.cpu.flush.valid && !io.cpu.execute.isValid && !io.cpu.memory.isValid && !io.cpu.writeBack.isValid && !io.cpu.redo){
|
||||||
|
io.cpu.flush.ready := True
|
||||||
|
mmuRsp.physicalAddress.getDrivingReg(lineRange) := 0
|
||||||
|
valid := True
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,15 +61,13 @@ class DBusCachedPlugin(config : DataCacheConfig,
|
||||||
REGFILE_WRITE_VALID -> True,
|
REGFILE_WRITE_VALID -> True,
|
||||||
BYPASSABLE_EXECUTE_STAGE -> False,
|
BYPASSABLE_EXECUTE_STAGE -> False,
|
||||||
BYPASSABLE_MEMORY_STAGE -> False,
|
BYPASSABLE_MEMORY_STAGE -> False,
|
||||||
MEMORY_WR -> False,
|
MEMORY_WR -> False
|
||||||
MEMORY_MANAGMENT -> False
|
|
||||||
) ++ (if(catchSomething) List(HAS_SIDE_EFFECT -> True) else Nil)
|
) ++ (if(catchSomething) List(HAS_SIDE_EFFECT -> True) else Nil)
|
||||||
|
|
||||||
val storeActions = stdActions ++ List(
|
val storeActions = stdActions ++ List(
|
||||||
SRC2_CTRL -> Src2CtrlEnum.IMS,
|
SRC2_CTRL -> Src2CtrlEnum.IMS,
|
||||||
RS2_USE -> True,
|
RS2_USE -> True,
|
||||||
MEMORY_WR -> True,
|
MEMORY_WR -> True
|
||||||
MEMORY_MANAGMENT -> False
|
|
||||||
)
|
)
|
||||||
|
|
||||||
decoderService.addDefault(MEMORY_ENABLE, False)
|
decoderService.addDefault(MEMORY_ENABLE, False)
|
||||||
|
@ -102,9 +100,9 @@ class DBusCachedPlugin(config : DataCacheConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
def MANAGEMENT = M"-------00000-----101-----0001111"
|
def MANAGEMENT = M"-------00000-----101-----0001111"
|
||||||
decoderService.add(MANAGEMENT, stdActions ++ List(
|
|
||||||
SRC2_CTRL -> Src2CtrlEnum.RS,
|
decoderService.addDefault(MEMORY_MANAGMENT, False)
|
||||||
RS2_USE -> True,
|
decoderService.add(MANAGEMENT, List(
|
||||||
MEMORY_MANAGMENT -> True
|
MEMORY_MANAGMENT -> True
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -161,6 +159,10 @@ class DBusCachedPlugin(config : DataCacheConfig,
|
||||||
)
|
)
|
||||||
cache.io.cpu.execute.args.size := size
|
cache.io.cpu.execute.args.size := size
|
||||||
cache.io.cpu.execute.args.forceUncachedAccess := False
|
cache.io.cpu.execute.args.forceUncachedAccess := False
|
||||||
|
|
||||||
|
cache.io.cpu.flush.valid := arbitration.isValid && input(MEMORY_MANAGMENT)
|
||||||
|
arbitration.haltItself setWhen(cache.io.cpu.flush.isStall)
|
||||||
|
|
||||||
if(genAtomic) {
|
if(genAtomic) {
|
||||||
cache.io.cpu.execute.args.isAtomic := False
|
cache.io.cpu.execute.args.isAtomic := False
|
||||||
when(input(MEMORY_ATOMIC)){
|
when(input(MEMORY_ATOMIC)){
|
||||||
|
|
Loading…
Reference in New Issue