Commit 70928314 authored by Jens Korinth's avatar Jens Korinth
Browse files

Add restart input to ProgrammableMaster

* while high, won't execute any actions, but reset its step counter
parent 0b91c23a
......@@ -35,6 +35,7 @@ final case class MasterWrite(address: Int, v: BigInt) extends MasterAction {
val w_resp = Decoupled(new chisel.axi.Axi4Lite.WriteResponse)
val finished = Output(Bool())
val start = Input(UInt(if (startable) 1.W else 0.W))
val restart = Input(Bool())
})
val cnt = RegInit(UInt(log2Ceil(action.length + 1).W), init = 0.U)
......@@ -77,20 +78,26 @@ final case class MasterWrite(address: Int, v: BigInt) extends MasterAction {
when (io.maxi.writeData.fire) { wd_valid := false.B }
when (io.maxi.writeResp.fire) { wr_ready := false.B }
when ((if (startable) RegNext(io.start(0), init = false.B) else true.B)) {
when (!signals.reduce(_ || _)) {
for (i <- 0 until action.length) {
when (i.U === cnt) {
//info(s"Starting action #$i: ${action(i)}")
ra := action(i).address.U
wa := action(i).address.U
wd := action(i).value.getOrElse(BigInt(0)).U
ra_valid := action(i).isRead.B
rd_ready := action(i).isRead.B
wa_valid := (!action(i).isRead).B
wd_valid := (!action(i).isRead).B
wr_ready := (!action(i).isRead).B
cnt := cnt + 1.U
when (RegNext(io.restart)) {
info("restarting action sequence ...")
cnt := 0.U
}
.otherwise {
when ((if (startable) RegNext(io.start(0), init = false.B) else true.B)) {
when (!signals.reduce(_ || _)) {
for (i <- 0 until action.length) {
when (i.U === cnt) {
//info(s"Starting action #$i: ${action(i)}")
ra := action(i).address.U
wa := action(i).address.U
wd := action(i).value.getOrElse(BigInt(0)).U
ra_valid := action(i).isRead.B
rd_ready := action(i).isRead.B
wa_valid := (!action(i).isRead).B
wd_valid := (!action(i).isRead).B
wr_ready := (!action(i).isRead).B
cnt := cnt + 1.U
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment