From 5440d6c2ae8ec23b3c69ea2809d0b41ba85b6460 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Mon, 26 Oct 2015 12:23:03 -0700 Subject: [PATCH] balance MultiChannel router correctly --- junctions/src/main/scala/nasti.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/junctions/src/main/scala/nasti.scala b/junctions/src/main/scala/nasti.scala index 5c3b2e22..df1a1bd1 100644 --- a/junctions/src/main/scala/nasti.scala +++ b/junctions/src/main/scala/nasti.scala @@ -469,9 +469,12 @@ object NastiMultiChannelRouter { Vec(master) } else { val dataBytes = p(MIFDataBits) * p(MIFDataBeats) / 8 + val selOffset = log2Up(dataBytes) val selBits = log2Ceil(nChannels) + // Consecutive blocks route to alternating channels val routeSel = (addr: UInt) => { - Vec.tabulate(nChannels)(i => addr(selBits - 1, 0) === UInt(i)).toBits + val sel = addr(selOffset + selBits - 1, selOffset) + Vec.tabulate(nChannels)(i => sel === UInt(i)).toBits } val router = Module(new NastiRouter(nChannels, routeSel)) router.io.master <> master