1
0

tilelink2 RegisterRouter: test fully Decoupled behaviour

This commit is contained in:
Wesley W. Terpstra 2016-10-02 00:47:42 -07:00 committed by Andrew Waterman
parent 422e6357a4
commit 52c1a053ff

View File

@ -35,7 +35,7 @@ class RRTestCombinational(val bits: Int, rvalid: Bool => Bool, wready: Bool => B
io.rvalid := rvalid_s io.rvalid := rvalid_s
io.wready := wready_s io.wready := wready_s
io.rdata := reg io.rdata := Mux(rvalid_s && io.rready, reg, UInt(0))
when (io.wvalid && wready_s) { reg := io.wdata } when (io.wvalid && wready_s) { reg := io.wdata }
} }
@ -47,10 +47,7 @@ object RRTestCombinational
def random: Bool => Bool = { ready => def random: Bool => Bool = { ready =>
seed = seed + 1 seed = seed + 1
val lfsr = LFSR16Seed(seed) LFSR16Seed(seed)(0)
val valid = RegInit(Bool(true))
valid := Mux(valid, !ready, lfsr(0) && lfsr(1))
valid
} }
def delay(x: Int): Bool => Bool = { ready => def delay(x: Int): Bool => Bool = { ready =>
@ -97,7 +94,7 @@ class RRTestRequest(val bits: Int,
val rofire = io.roready && rovalid val rofire = io.roready && rovalid
val wofire = io.woready && wovalid val wofire = io.woready && wovalid
io.rdata := reg io.rdata := Mux(rofire, reg, UInt(0))
when (wofire) { reg := wdata } when (wofire) { reg := wdata }
} }
@ -130,14 +127,11 @@ object RRTestRequest
val lfsr = LFSR16Seed(seed) val lfsr = LFSR16Seed(seed)
val busy = RegInit(Bool(false)) val busy = RegInit(Bool(false))
val data = Reg(UInt(width = idata.getWidth)) val data = Reg(UInt(width = idata.getWidth))
val progress = RegInit(Bool(false)) val progress = lfsr(0)
val iready = progress && !busy val iready = progress && !busy
val ovalid = progress && busy val ovalid = progress && busy
when (progress) { when (progress) {
busy := Mux(busy, !oready, ivalid) busy := Mux(busy, !oready, ivalid)
progress := Mux(busy, !oready, !ivalid)
} .otherwise {
progress := lfsr(0)
} }
when (ivalid && iready) { data := idata } when (ivalid && iready) { data := idata }
(iready, ovalid, data) (iready, ovalid, data)