From 0ebab0976a55ee30de9fbafcb230343cea1b5f63 Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Fri, 30 Sep 2016 04:54:40 -0700 Subject: [PATCH] tilelink2 Isolation: add enable signal (#368) --- src/main/scala/uncore/tilelink2/Isolation.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/scala/uncore/tilelink2/Isolation.scala b/src/main/scala/uncore/tilelink2/Isolation.scala index e5dda00f..c38cc10d 100644 --- a/src/main/scala/uncore/tilelink2/Isolation.scala +++ b/src/main/scala/uncore/tilelink2/Isolation.scala @@ -5,7 +5,7 @@ package uncore.tilelink2 import Chisel._ import chisel3.internal.sourceinfo.SourceInfo -class TLIsolation(f: UInt => UInt) extends LazyModule +class TLIsolation(f: (Bool, UInt) => UInt) extends LazyModule { val node = TLAsyncIdentityNode() @@ -13,9 +13,10 @@ class TLIsolation(f: UInt => UInt) extends LazyModule val io = new Bundle { val in = node.bundleIn val out = node.bundleOut + val iso = Bool(INPUT) } - def ISO[T <: Data](x: T): T = x.fromBits(f(x.asUInt)) + def ISO[T <: Data](x: T): T = x.fromBits(f(io.iso, x.asUInt)) ((io.in zip io.out) zip (node.edgesIn zip node.edgesOut)) foreach { case ((in, out), (edgeIn, edgeOut)) => @@ -52,9 +53,9 @@ object TLIsolation { // applied to the TL source node; y.node := TLIsolation()(x.node) // f should insert an isolation gate between the input UInt and its result - def apply(f: UInt => UInt)(x: TLAsyncOutwardNode)(implicit sourceInfo: SourceInfo): TLAsyncOutwardNode = { + def apply(f: (Bool, UInt) => UInt)(x: TLAsyncOutwardNode)(implicit sourceInfo: SourceInfo): (TLAsyncOutwardNode, () => Bool) = { val iso = LazyModule(new TLIsolation(f)) iso.node := x - iso.node + (iso.node, () => iso.module.io.iso) } }