have multiple outstanding requests in CacheFillTest
This commit is contained in:
parent
f44778fa56
commit
21feeb4a4f
@ -11,30 +11,33 @@ class CacheFillTest(implicit p: Parameters) extends GroundTest()(p)
|
|||||||
val s_start :: s_prefetch :: s_retrieve :: s_finished :: Nil = Enum(Bits(), 4)
|
val s_start :: s_prefetch :: s_retrieve :: s_finished :: Nil = Enum(Bits(), 4)
|
||||||
val state = Reg(init = s_start)
|
val state = Reg(init = s_start)
|
||||||
|
|
||||||
val inflight = Reg(init = Bool(false))
|
|
||||||
val active = state === s_prefetch || state === s_retrieve
|
val active = state === s_prefetch || state === s_retrieve
|
||||||
|
|
||||||
|
val xact_pending = Reg(init = UInt(0, tlMaxClientXacts))
|
||||||
|
val xact_id = PriorityEncoder(~xact_pending)
|
||||||
|
|
||||||
disablePorts(mem = false)
|
disablePorts(mem = false)
|
||||||
|
|
||||||
val (xact_id, xact_flip) = Counter(io.mem.acquire.fire(), tlMaxClientXacts)
|
|
||||||
val (req_block, round_done) = Counter(io.mem.acquire.fire(), nblocks)
|
val (req_block, round_done) = Counter(io.mem.acquire.fire(), nblocks)
|
||||||
|
|
||||||
io.mem.acquire.valid := active && !inflight
|
io.mem.acquire.valid := active && !xact_pending.andR
|
||||||
io.mem.acquire.bits := Mux(state === s_prefetch,
|
io.mem.acquire.bits := Mux(state === s_prefetch,
|
||||||
GetPrefetch(xact_id, UInt(memStartBlock) + req_block),
|
GetPrefetch(xact_id, UInt(memStartBlock) + req_block),
|
||||||
GetBlock(xact_id, UInt(memStartBlock) + req_block))
|
GetBlock(xact_id, UInt(memStartBlock) + req_block))
|
||||||
io.mem.grant.ready := inflight
|
io.mem.grant.ready := xact_pending.orR
|
||||||
|
|
||||||
when (io.mem.acquire.fire()) {
|
def add_pending(acq: DecoupledIO[Acquire]): UInt =
|
||||||
inflight := Bool(true)
|
Mux(acq.fire(), UIntToOH(acq.bits.client_xact_id), UInt(0))
|
||||||
|
|
||||||
|
def remove_pending(gnt: DecoupledIO[Grant]): UInt = {
|
||||||
|
val last_grant = !gnt.bits.hasMultibeatData() ||
|
||||||
|
gnt.bits.addr_beat === UInt(tlDataBeats - 1)
|
||||||
|
~Mux(gnt.fire() && last_grant, UIntToOH(gnt.bits.client_xact_id), UInt(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
val last_grant = !io.mem.grant.bits.hasMultibeatData() ||
|
xact_pending := (xact_pending |
|
||||||
io.mem.grant.bits.addr_beat === UInt(tlDataBeats - 1)
|
add_pending(io.mem.acquire)) &
|
||||||
|
remove_pending(io.mem.grant)
|
||||||
when (io.mem.grant.fire() && last_grant) {
|
|
||||||
inflight := Bool(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
when (state === s_start) { state := s_prefetch }
|
when (state === s_start) { state := s_prefetch }
|
||||||
when (state === s_prefetch && round_done) { state := s_retrieve }
|
when (state === s_prefetch && round_done) { state := s_retrieve }
|
||||||
|
Loading…
Reference in New Issue
Block a user