1
0

balance MultiChannel router correctly

This commit is contained in:
Howard Mao 2015-10-26 12:23:03 -07:00
parent 3270d17ad3
commit 5440d6c2ae

View File

@ -469,9 +469,12 @@ object NastiMultiChannelRouter {
Vec(master) Vec(master)
} else { } else {
val dataBytes = p(MIFDataBits) * p(MIFDataBeats) / 8 val dataBytes = p(MIFDataBits) * p(MIFDataBeats) / 8
val selOffset = log2Up(dataBytes)
val selBits = log2Ceil(nChannels) val selBits = log2Ceil(nChannels)
// Consecutive blocks route to alternating channels
val routeSel = (addr: UInt) => { 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)) val router = Module(new NastiRouter(nChannels, routeSel))
router.io.master <> master router.io.master <> master