Use used mask in CoalShiftQueue
Easier to use than wptr when enqueuing & dequeueing at the same time.
This commit is contained in:
@@ -79,6 +79,35 @@ class CoalShiftQueueTest extends AnyFlatSpec with ChiselScalatestTester {
|
||||
c.io.deq.valid.expect(false.B)
|
||||
}
|
||||
}
|
||||
|
||||
it should "work when enqueing and dequeueing simultaneously" in {
|
||||
test(new CoalShiftQueue(UInt(8.W), 4)) { c =>
|
||||
// prepare
|
||||
c.io.deq.ready.poke(false.B)
|
||||
c.io.enq.ready.expect(true.B)
|
||||
c.io.enq.valid.poke(true.B)
|
||||
c.io.enq.bits.poke(0x12.U)
|
||||
c.clock.step()
|
||||
// enqueue and dequeue simultaneously
|
||||
c.io.deq.ready.poke(true.B)
|
||||
c.io.enq.ready.expect(true.B)
|
||||
c.io.enq.valid.poke(true.B)
|
||||
c.io.enq.bits.poke(0x34.U)
|
||||
c.io.deq.valid.expect(true.B)
|
||||
c.io.deq.bits.expect(0x12.U)
|
||||
c.clock.step()
|
||||
// dequeueing back-to-back should work without any holes in the middle
|
||||
c.io.deq.ready.poke(true.B)
|
||||
c.io.enq.valid.poke(false.B)
|
||||
c.io.deq.valid.expect(true.B)
|
||||
c.io.deq.bits.expect(0x34.U)
|
||||
c.clock.step()
|
||||
// make sure is empty
|
||||
c.io.deq.ready.poke(true.B)
|
||||
c.io.enq.valid.poke(false.B)
|
||||
c.io.deq.valid.expect(false.B)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UncoalescingUnitTest extends AnyFlatSpec with ChiselScalatestTester {
|
||||
|
||||
Reference in New Issue
Block a user