From 1b93b27da4e23d2e0d5d4533cacec225b9961d39 Mon Sep 17 00:00:00 2001 From: Henry Cook Date: Thu, 8 Mar 2018 16:12:15 -0800 Subject: [PATCH] util: restore dontTouch annotation; Chisel's is broken on 0 element Aggregates --- src/main/scala/util/Misc.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/scala/util/Misc.scala b/src/main/scala/util/Misc.scala index eabfa3af..fb34c3ef 100644 --- a/src/main/scala/util/Misc.scala +++ b/src/main/scala/util/Misc.scala @@ -4,7 +4,7 @@ package freechips.rocketchip.util import Chisel._ -import chisel3.experimental.{dontTouch, RawModule} +import chisel3.experimental.{ChiselAnnotation, RawModule} import freechips.rocketchip.config.Parameters import scala.math._ @@ -14,6 +14,13 @@ class ParameterizedBundle(implicit p: Parameters) extends Bundle trait DontTouch { self: RawModule => + def dontTouch(data: Data): Unit = data match { + case agg: Aggregate => + agg.getElements.foreach(dontTouch) + case elt: Element => + annotate(ChiselAnnotation(elt, classOf[firrtl.Transform], "DONTtouch!")) + } + /** Marks every port as don't touch * * @note This method can only be called after the Module has been fully constructed