Skip to content

Commit

Permalink
fix pynq 32-bit address pointers (apache#3558)
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaluisjose authored and wweic committed Aug 9, 2019
1 parent 930fc22 commit dd81d1e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions vta/hardware/chisel/src/main/scala/shell/VCR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ class VCR(implicit p: Parameters) extends Module {
val rdata = RegInit(0.U(vp.regBits.W))

// 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 addr = Seq.tabulate(nTotal)(_ * 4)
val reg_map = (addr zip reg) map { case (a, r) => a.U -> r }
Expand Down Expand Up @@ -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) {
reg(vo + i) := wdata
}
Expand All @@ -183,7 +185,13 @@ class VCR(implicit p: Parameters) extends Module {
io.vcr.vals(i) := reg(vo + i)
}

for (i <- 0 until vp.nPtrs) {
io.vcr.ptrs(i) := Cat(reg(po + 2*i + 1), reg(po + 2*i))
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))
}
}
}

0 comments on commit dd81d1e

Please sign in to comment.