diff --git a/rocketv/src/SRAM.scala b/rocketv/src/SRAM.scala index de80e31a3..e2fc9174b 100644 --- a/rocketv/src/SRAM.scala +++ b/rocketv/src/SRAM.scala @@ -11,8 +11,11 @@ import chisel3.util.{log2Ceil, MemoryFile, SRAMDescription, SRAMInterface} import firrtl.transforms.BlackBoxInlineAnno import chisel3.experimental.ChiselAnnotation import chisel3.experimental.hierarchy.core.Hierarchy.HierarchyBaseModuleExtensions +import chisel3.util.HasExtModuleInline -class SRAMBlackbox(parameter: CIRCTSRAMParameter) extends FixedIOExtModule(new CIRCTSRAMInterface(parameter)) { self => +class SRAMBlackbox(parameter: CIRCTSRAMParameter) + extends FixedIOExtModule(new CIRCTSRAMInterface(parameter)) + with HasExtModuleInline { self => private val verilogInterface: String = (Seq.tabulate(parameter.write)(idx => @@ -112,19 +115,14 @@ class SRAMBlackbox(parameter: CIRCTSRAMParameter) extends FixedIOExtModule(new C override def desiredName = parameter.moduleName - chisel3.experimental.annotate( - new ChiselAnnotation { - def toFirrtl = new BlackBoxInlineAnno( - self.toNamed, - parameter.moduleName, - s"""module ${parameter.moduleName}( - |${verilogInterface} - |); - |${logic} - |endmodule - |""".stripMargin - ) - } + setInline( + desiredName + ".sv", + s"""module ${parameter.moduleName}( + |${verilogInterface} + |); + |${logic} + |endmodule + |""".stripMargin ) } @@ -409,13 +407,8 @@ object SRAM { }) .getOrElse(0) ) - - Module.currentModule.foreach { case m: RawModule => - m.atModuleBodyEnd { - descriptionInstance.hierarchyIn := Property(Path(mem.toTarget)) - } - } - description := descriptionInstance.getPropertyReference + descriptionInstance.hierarchyIn := Property(Path(mem.toTarget)) + description := descriptionInstance.getPropertyReference } out } diff --git a/t1/src/SRAM.scala b/t1/src/SRAM.scala index 35fc84930..e2fc9174b 100644 --- a/t1/src/SRAM.scala +++ b/t1/src/SRAM.scala @@ -116,7 +116,7 @@ class SRAMBlackbox(parameter: CIRCTSRAMParameter) override def desiredName = parameter.moduleName setInline( - desiredName, + desiredName + ".sv", s"""module ${parameter.moduleName}( |${verilogInterface} |); @@ -407,13 +407,8 @@ object SRAM { }) .getOrElse(0) ) - - Module.currentModule.foreach { case m: RawModule => - m.atModuleBodyEnd { - descriptionInstance.hierarchyIn := Property(Path(mem.toTarget)) - } - } - description := descriptionInstance.getPropertyReference + descriptionInstance.hierarchyIn := Property(Path(mem.toTarget)) + description := descriptionInstance.getPropertyReference } out }