Commit 5c864ac8 by Luis Vega Committed by Thierry Moreau

fix pynq 32-bit address pointers (#3558)

parent 48c1ae45
...@@ -101,7 +101,9 @@ class VCR(implicit p: Parameters) extends Module { ...@@ -101,7 +101,9 @@ class VCR(implicit p: Parameters) extends Module {
val rdata = RegInit(0.U(vp.regBits.W)) val rdata = RegInit(0.U(vp.regBits.W))
// registers // registers
val nTotal = vp.nCtrl + vp.nECnt + vp.nVals + (2*vp.nPtrs) val nPtrs = if (mp.addrBits == 32) vp.nPtrs else 2*vp.nPtrs
val nTotal = vp.nCtrl + vp.nECnt + vp.nVals + nPtrs
val reg = Seq.fill(nTotal)(RegInit(0.U(vp.regBits.W))) val reg = Seq.fill(nTotal)(RegInit(0.U(vp.regBits.W)))
val addr = Seq.tabulate(nTotal)(_ * 4) val addr = Seq.tabulate(nTotal)(_ * 4)
val reg_map = (addr zip reg) map { case (a, r) => a.U -> r } val reg_map = (addr zip reg) map { case (a, r) => a.U -> r }
...@@ -167,7 +169,7 @@ class VCR(implicit p: Parameters) extends Module { ...@@ -167,7 +169,7 @@ class VCR(implicit p: Parameters) extends Module {
} }
} }
for (i <- 0 until (vp.nVals + (2*vp.nPtrs))) { for (i <- 0 until (vp.nVals + nPtrs)) {
when (io.host.w.fire() && addr(vo + i).U === waddr) { when (io.host.w.fire() && addr(vo + i).U === waddr) {
reg(vo + i) := wdata reg(vo + i) := wdata
} }
...@@ -183,7 +185,13 @@ class VCR(implicit p: Parameters) extends Module { ...@@ -183,7 +185,13 @@ class VCR(implicit p: Parameters) extends Module {
io.vcr.vals(i) := reg(vo + i) io.vcr.vals(i) := reg(vo + i)
} }
for (i <- 0 until vp.nPtrs) { if (mp.addrBits == 32) { // 32-bit pointers
for (i <- 0 until nPtrs) {
io.vcr.ptrs(i) := reg(po + i)
}
} else { // 64-bits pointers
for (i <- 0 until (nPtrs/2)) {
io.vcr.ptrs(i) := Cat(reg(po + 2*i + 1), reg(po + 2*i)) io.vcr.ptrs(i) := Cat(reg(po + 2*i + 1), reg(po + 2*i))
} }
}
} }
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