don't use CAM in ReorderQueue if not necessary
This commit is contained in:
parent
2f70136f90
commit
c0dc09b3a1
@ -175,16 +175,20 @@ class ReorderDequeueIO[T <: Data](dType: T, tagWidth: Int) extends Bundle {
|
||||
new ReorderDequeueIO(dType, tagWidth).asInstanceOf[this.type]
|
||||
}
|
||||
|
||||
class ReorderQueue[T <: Data](dType: T, tagWidth: Int, size: Int)
|
||||
class ReorderQueue[T <: Data](dType: T, tagWidth: Int, size: Option[Int] = None)
|
||||
extends Module {
|
||||
val io = new Bundle {
|
||||
val enq = new ReorderEnqueueIO(dType, tagWidth).flip
|
||||
val deq = new ReorderDequeueIO(dType, tagWidth)
|
||||
}
|
||||
|
||||
val roq_data = Mem(size, dType.cloneType)
|
||||
val roq_tags = Reg(Vec(size, UInt(width = tagWidth)))
|
||||
val roq_free = Reg(init = Vec.fill(size)(Bool(true)))
|
||||
val tagSpaceSize = 1 << tagWidth
|
||||
val actualSize = size.getOrElse(tagSpaceSize)
|
||||
|
||||
if (tagSpaceSize > actualSize) {
|
||||
val roq_data = Mem(actualSize, dType)
|
||||
val roq_tags = Reg(Vec(actualSize, UInt(width = tagWidth)))
|
||||
val roq_free = Reg(init = Vec.fill(actualSize)(Bool(true)))
|
||||
|
||||
val roq_enq_addr = PriorityEncoder(roq_free)
|
||||
val roq_matches = roq_tags.zip(roq_free)
|
||||
@ -204,6 +208,25 @@ class ReorderQueue[T <: Data](dType: T, tagWidth: Int, size: Int)
|
||||
when (io.deq.valid) {
|
||||
roq_free(roq_deq_addr) := Bool(true)
|
||||
}
|
||||
|
||||
println("Warning: inferring a CAM for ReorderQueue")
|
||||
} else {
|
||||
val roq_data = Mem(tagSpaceSize, dType)
|
||||
val roq_free = Reg(init = Vec.fill(tagSpaceSize)(Bool(true)))
|
||||
|
||||
io.enq.ready := roq_free(io.enq.bits.tag)
|
||||
io.deq.data := roq_data(io.deq.tag)
|
||||
io.deq.matches := !roq_free(io.deq.tag)
|
||||
|
||||
when (io.enq.valid && io.enq.ready) {
|
||||
roq_data(io.enq.bits.tag) := io.enq.bits.data
|
||||
roq_free(io.enq.bits.tag) := Bool(false)
|
||||
}
|
||||
|
||||
when (io.deq.valid) {
|
||||
roq_free(io.deq.tag) := Bool(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object DecoupledHelper {
|
||||
|
Loading…
Reference in New Issue
Block a user