1
0

change TileLinkWidthAdapter interface

This commit is contained in:
Howard Mao 2016-06-30 15:50:23 -07:00
parent 9feca99d5d
commit a0b1772404

View File

@ -151,20 +151,21 @@ class ClientTileLinkIOUnwrapper(implicit p: Parameters) extends TLModule()(p) {
} }
object TileLinkWidthAdapter { object TileLinkWidthAdapter {
def apply(in: ClientUncachedTileLinkIO, out: ClientUncachedTileLinkIO)(implicit p: Parameters): Unit = { def apply(in: ClientUncachedTileLinkIO, outerId: String)(implicit p: Parameters) = {
require(out.tlDataBits * out.tlDataBeats == in.tlDataBits * in.tlDataBeats) val outerDataBits = p(TLKey(outerId)).dataBitsPerBeat
if (outerDataBits > in.tlDataBits) {
if (out.tlDataBits > in.tlDataBits) { val widener = Module(new TileLinkIOWidener(in.p(TLId), outerId))
val widener = Module(new TileLinkIOWidener(in.p(TLId), out.p(TLId)))
widener.io.in <> in widener.io.in <> in
out <> widener.io.out widener.io.out
} else if (out.tlDataBits < in.tlDataBits) { } else if (outerDataBits < in.tlDataBits) {
val narrower = Module(new TileLinkIONarrower(in.p(TLId), out.p(TLId))) val narrower = Module(new TileLinkIONarrower(in.p(TLId), outerId))
narrower.io.in <> in narrower.io.in <> in
out <> narrower.io.out narrower.io.out
} else { } else { in }
out <> in
} }
def apply(out: ClientUncachedTileLinkIO, in: ClientUncachedTileLinkIO)(implicit p: Parameters): Unit = {
require(out.tlDataBits * out.tlDataBeats == in.tlDataBits * in.tlDataBeats)
out <> apply(in, out.p(TLId))
} }
} }