Fix DBus AXI bridges from writePending counter deadlock
This commit is contained in:
parent
bd2787b562
commit
2bf6a536c9
|
@ -184,16 +184,17 @@ case class DataCacheMemBus(p : DataCacheConfig) extends Bundle with IMasterSlave
|
||||||
slave(rsp)
|
slave(rsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
def toAxi4Shared(stageCmd : Boolean = false): Axi4Shared = {
|
def toAxi4Shared(stageCmd : Boolean = false, pendingWritesMax : Int = 7): Axi4Shared = {
|
||||||
val axi = Axi4Shared(p.getAxi4SharedConfig())
|
val axi = Axi4Shared(p.getAxi4SharedConfig())
|
||||||
val pendingWritesMax = 7
|
|
||||||
|
val cmdPreFork = if (stageCmd) cmd.stage.stage().s2mPipe() else cmd
|
||||||
|
|
||||||
val pendingWrites = CounterUpDown(
|
val pendingWrites = CounterUpDown(
|
||||||
stateCount = pendingWritesMax + 1,
|
stateCount = pendingWritesMax + 1,
|
||||||
incWhen = axi.sharedCmd.fire && axi.sharedCmd.write,
|
incWhen = cmdPreFork.fire && cmdPreFork.wr,
|
||||||
decWhen = axi.writeRsp.fire
|
decWhen = axi.writeRsp.fire
|
||||||
)
|
)
|
||||||
|
|
||||||
val cmdPreFork = if (stageCmd) cmd.stage.stage().s2mPipe() else cmd
|
|
||||||
val hazard = (pendingWrites =/= 0 && !cmdPreFork.wr) || pendingWrites === pendingWritesMax
|
val hazard = (pendingWrites =/= 0 && !cmdPreFork.wr) || pendingWrites === pendingWritesMax
|
||||||
val (cmdFork, dataFork) = StreamFork2(cmdPreFork.haltWhen(hazard))
|
val (cmdFork, dataFork) = StreamFork2(cmdPreFork.haltWhen(hazard))
|
||||||
val cmdStage = cmdFork.throwWhen(RegNextWhen(!cmdFork.last,cmdFork.fire).init(False))
|
val cmdStage = cmdFork.throwWhen(RegNextWhen(!cmdFork.last,cmdFork.fire).init(False))
|
||||||
|
|
|
@ -106,17 +106,19 @@ case class DBusSimpleBus() extends Bundle with IMasterSlave{
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
def toAxi4Shared(stageCmd : Boolean = false): Axi4Shared = {
|
def toAxi4Shared(stageCmd : Boolean = false, pendingWritesMax : Int = 7): Axi4Shared = {
|
||||||
val axi = Axi4Shared(DBusSimpleBus.getAxi4Config())
|
val axi = Axi4Shared(DBusSimpleBus.getAxi4Config())
|
||||||
val pendingWritesMax = 7
|
|
||||||
|
val cmdPreFork = if (stageCmd) cmd.stage.stage().s2mPipe() else cmd
|
||||||
|
|
||||||
val pendingWrites = CounterUpDown(
|
val pendingWrites = CounterUpDown(
|
||||||
stateCount = pendingWritesMax + 1,
|
stateCount = pendingWritesMax + 1,
|
||||||
incWhen = axi.sharedCmd.fire && axi.sharedCmd.write,
|
incWhen = cmdPreFork.fire && cmdPreFork.wr,
|
||||||
decWhen = axi.writeRsp.fire
|
decWhen = axi.writeRsp.fire
|
||||||
)
|
)
|
||||||
|
|
||||||
val cmdPreFork = if (stageCmd) cmd.stage.stage().s2mPipe() else cmd
|
val hazard = (pendingWrites =/= 0 && cmdPreFork.valid && !cmdPreFork.wr) || pendingWrites === pendingWritesMax
|
||||||
val (cmdFork, dataFork) = StreamFork2(cmdPreFork.haltWhen((pendingWrites =/= 0 && cmdPreFork.valid && !cmdPreFork.wr) || pendingWrites === pendingWritesMax))
|
val (cmdFork, dataFork) = StreamFork2(cmdPreFork.haltWhen(hazard))
|
||||||
axi.sharedCmd.arbitrationFrom(cmdFork)
|
axi.sharedCmd.arbitrationFrom(cmdFork)
|
||||||
axi.sharedCmd.write := cmdFork.wr
|
axi.sharedCmd.write := cmdFork.wr
|
||||||
axi.sharedCmd.prot := "010"
|
axi.sharedCmd.prot := "010"
|
||||||
|
|
Loading…
Reference in New Issue