Skip to content

Commit

Permalink
Merge pull request chipsalliance#2127 from chipsalliance/rational-cro…
Browse files Browse the repository at this point in the history
…ssing-reset

Allow a RationalCrossingSource to remain in reset longer than sink
  • Loading branch information
aswaterman authored Oct 15, 2019
2 parents d3f41f9 + b1ee804 commit 1588130
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/rocket/TLB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class TLB(instruction: Boolean, lgMaxSize: Int, cfg: TLBConfig)(implicit edge: T
newEntry.ppn := pte.ppn
newEntry.c := cacheable
newEntry.u := pte.u
newEntry.g := pte.g
newEntry.g := pte.g && pte.v
newEntry.ae := io.ptw.resp.bits.ae
newEntry.sr := pte.sr()
newEntry.sw := pte.sw()
Expand Down
23 changes: 23 additions & 0 deletions src/main/scala/util/BlockDuringReset.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// See LICENSE.SiFive for license details.

package freechips.rocketchip.util

import chisel3._
import chisel3.util.DecoupledIO

/** Blocks transactions until the cycle after reset. */
object BlockDuringReset
{
def apply[T <: Data](enq: DecoupledIO[T]): DecoupledIO[T] = {
val out_of_reset = RegNext(true.B, false.B)
val res = Wire(enq.cloneType)
res.valid := enq.valid
enq.ready := res.ready
res.bits := enq.bits
when (!out_of_reset) {
res.valid := false.B
enq.ready := false.B
}
res
}
}
9 changes: 5 additions & 4 deletions src/main/scala/util/RationalCrossing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ class RationalCrossingSource[T <: Data](gen: T, direction: RationalDirection = S
val deq = RationalIO(gen)
}

val enq_in = BlockDuringReset(io.enq)
val deq = io.deq
val enq = direction match {
case Symmetric => ShiftQueue(io.enq, 1, flow=true)
case Flexible => ShiftQueue(io.enq, 2)
case FastToSlow => io.enq
case SlowToFast => ShiftQueue(io.enq, 2)
case Symmetric => ShiftQueue(enq_in, 1, flow=true)
case Flexible => ShiftQueue(enq_in, 2)
case FastToSlow => enq_in
case SlowToFast => ShiftQueue(enq_in, 2)
}

val count = RegInit(UInt(0, width = 2))
Expand Down

0 comments on commit 1588130

Please sign in to comment.