1
0
Fork 0

RationalCrossing: add some documentation

This commit is contained in:
Wesley W. Terpstra 2017-01-26 21:27:34 -08:00
parent fc3b72084f
commit 830d01329d
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,12 @@
// See LICENSE.SiFive for license details.
// If you know two clocks are related with a N:1 or 1:N relationship, you
// can cross the clock domains with lower latency than an AsyncQueue.
// This clock crossing behaves almost identically to a TLBuffer(2):
// - It adds one cycle latency to each clock domain.
// - All outputs of TLRational are registers (bits, valid, and ready).
// - It costs 3*bits registers as opposed to 2*bits in a TLBuffer(2)
package uncore.tilelink2
import Chisel._

View File

@ -1,5 +1,9 @@
// See LICENSE.SiFive for license details.
// If you know two clocks are related with a N:1 or 1:N relationship, you
// can cross the clock domains with lower latency than an AsyncQueue. This
// crossing adds 1 cycle in the target clock domain.
package util
import Chisel._
@ -34,7 +38,7 @@ class RationalCrossingSource[T <: Data](gen: T) extends Module
deq.valid := enq.valid
deq.source := count
deq.bits := Mux(equal, enq.bits, RegEnable(enq.bits, equal && enq.valid))
deq.bits := Mux(equal, enq.bits, RegEnable(enq.bits, equal))
enq.ready := Mux(equal, deq.ready, count(1) =/= deq.sink(0))
when (enq.fire()) { count := Cat(count(0), !count(1)) }