chipyard icon indicating copy to clipboard operation
chipyard copied to clipboard

Top-level trait from GCD example not being generated

Open sammhho opened this issue 5 years ago • 9 comments

Impact: rtl

Tell us about your environment: Chipyard Version: 1.5.0, also the version in the docker image OS: Ubuntu 20.04, and Ubuntu 18.04.5 from the docker image Other: Do source env.sh for custom env; No prior step for the docker image env.

What is the current behavior? Under sims/verilator, run either make CONFIG=GCDAXI4BlackBoxRocketConfig verilog or make CONFIG=GCDTLRocketConfig verilog, the generated rtl in generated-src/chipyard.TestHarness.GCDAXI4BlackBoxRocketConfig/chipyard.TestHarness.GCDAXI4BlackBoxRocketConfig.top.v does not have port busy in both ChipTop and DigitalTop level.

What is the expected behavior? Seems there should be ChipTop/DigitalTop port busy, connected from gcd_busy port of GCDTL/GCDAXI4, which is in turn connected from busy port of GCDMMIOBlackBox/GCDMMIOChiselModule.

Other information

According to docs 6.6 MMIO Peripherals/6.6.3 Top-level Traits, and also these code:

trait CanHavePeripheryGCDModuleImp extends LazyModuleImp {
  val outer: CanHavePeripheryGCD
  val gcd_busy = outer.gcd match {
    case Some(gcd) => {
      val busy = IO(Output(Bool()))
      busy := gcd.module.io.gcd_busy
      Some(busy)
    }
    case None => None
  }
}

seems there should be busy port at least on DigitalTop if not ChipTop ??? Really not sure if there's a problem in some cake pattern traits or in some part of the generator?

sammhho avatar Aug 17 '21 07:08 sammhho

Is the busy signal driving anything? If not, then perhaps it is getting optimized away. Try adding dontTouch(busy) after declaring the IO

jerryz123 avatar Aug 17 '21 07:08 jerryz123

indeed @jerryz123 is right, the signal seems to be optimized away at some point. The dontTouch(busy) works, you than have the signal in the DigitalTop. If you need it also in the ChipTop you need to add some IOBinders like so

class WithGCDIOCells extends OverrideIOBinder({ (system: CanHavePeripheryGCDModuleImp) => { val (ports, cells2d) = IOCell.generateIOFromSignal(system.gcd_busy.get, s"busy", system.p(IOCellKey), abstractResetAsAsync = true) (Seq(ports), cells2d) } })

Not sure if that's the intended way but it seems to work.

Rodiot avatar Aug 19 '21 15:08 Rodiot

Thx @jerryz123 @Rodiot , I did try dontTouch and it does keep it at DigitalTop; Thx for the tips on keeping it at top level too, Rodiot

sammhho avatar Aug 22 '21 09:08 sammhho

@Rodiot yes that is the intended mechanism for keeping it in ChipTop

jerryz123 avatar Aug 23 '21 07:08 jerryz123

Hello @sammhho, @jerryz123 and @Rodiot, I tried the code @Rodiot wrote to get the gcd_busy in the ChipTop but I got the following errors and I don't know how to fix. Do you think the code WithGCDIOCells you wrote is correct? I'm having trouble making gcd_busy available at ChipTop. For DigitalTop, I used dontTouch, and it works. image

vule20 avatar Sep 26 '21 15:09 vule20

@DucVu20 I met similar problem. Have you solved it yet?

leduchuybk avatar Dec 17 '22 12:12 leduchuybk

HI @vu-leduc and @leduchuybk ,

I have the problem with make CONFIG=GCDAXI4BlackBoxRocketConfig

[error] chisel3.package$ExpectedChiselTypeException: wire type 'GCDAXI4.in.bits.extra: Wire[BundleMap]' must be a Chisel type, not hardware [error] at chisel3.internal.requireIsChiselType$.apply(Binding.scala:34) [error] at chisel3.WireFactory.apply(Data.scala:982) [error] at chisel3.WireFactory.apply$(Data.scala:980) [error] at chisel3.Wire$.apply(Data.scala:1017) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterNode.$anonfun$regmap$16(RegisterRouter.scala:42) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterNode$$Lambda$20576/875509959.apply(Unknown Source) [error] at chisel3.internal.prefix$.apply(prefix.scala:48) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterNode.$anonfun$regmap$15(RegisterRouter.scala:42) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterNode$$Lambda$20575/1085760010.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterNode.regmap(RegisterRouter.scala:42) [error] at freechips.rocketchip.amba.axi4.AXI4RegModule.regmap(RegisterRouter.scala:114) [error] at chipyard.example.GCDModule.$init$(GCD.scala:138) [error] at chipyard.example.GCDAXI4$$anonfun$4$$anon$4.(GCD.scala:156) [error] at chipyard.example.GCDAXI4$$anonfun$4.apply(GCD.scala:156) [error] at chipyard.example.GCDAXI4$$anonfun$4.apply(GCD.scala:156) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterRouter.$anonfun$module$1(RegisterRouter.scala:127) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterRouter$$Lambda$20518/2020458260.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterRouter.module$lzycompute(RegisterRouter.scala:127) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterRouter.module(RegisterRouter.scala:127) [error] at freechips.rocketchip.amba.axi4.AXI4RegisterRouter.module(RegisterRouter.scala:118) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$15(LazyModule.scala:334) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5353/1184899848.apply(Unknown Source) [error] at chisel3.Module$.do_apply(Module.scala:53) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$14(LazyModule.scala:334) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5352/741939336.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$13(LazyModule.scala:334) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5351/511279444.apply(Unknown Source) [error] at scala.Option.getOrElse(Option.scala:201) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$1(LazyModule.scala:332) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5349/639208794.apply(Unknown Source) [error] at scala.collection.immutable.List.flatMap(List.scala:293) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate(LazyModule.scala:308) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate$(LazyModule.scala:305) [error] at freechips.rocketchip.diplomacy.LazyModuleImp.instantiate(LazyModule.scala:392) [error] at freechips.rocketchip.diplomacy.LazyModuleImp.$anonfun$x$22$1(LazyModule.scala:394) [error] at freechips.rocketchip.diplomacy.LazyModuleImp$$Lambda$5355/1368149501.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursivelyProduct(package.scala:48) [error] at freechips.rocketchip.diplomacy.LazyModuleImp.(LazyModule.scala:394) [error] at freechips.rocketchip.subsystem.BareSubsystemModuleImp.(BaseSubsystem.scala:29) [error] at freechips.rocketchip.subsystem.BaseSubsystemModuleImp.(BaseSubsystem.scala:122) [error] at chipyard.ChipyardSubsystemModuleImp.(Subsystem.scala:97) [error] at chipyard.ChipyardSystemModule.(System.scala:40) [error] at chipyard.DigitalTopModule.(DigitalTop.scala:41) [error] at chipyard.DigitalTop.$anonfun$module$1(DigitalTop.scala:38) [error] at chipyard.DigitalTop$$Lambda$5354/119660128.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at chipyard.DigitalTop.module$lzycompute(DigitalTop.scala:38) [error] at chipyard.DigitalTop.module(DigitalTop.scala:38) [error] at chipyard.DigitalTop.module(DigitalTop.scala:15) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$15(LazyModule.scala:334) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5353/1184899848.apply(Unknown Source) [error] at chisel3.Module$.do_apply(Module.scala:53) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$14(LazyModule.scala:334) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5352/741939336.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$13(LazyModule.scala:334) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5351/511279444.apply(Unknown Source) [error] at scala.Option.getOrElse(Option.scala:201) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$1(LazyModule.scala:332) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike$$Lambda$5349/639208794.apply(Unknown Source) [error] at scala.collection.immutable.List.flatMap(List.scala:293) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate(LazyModule.scala:308) [error] at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate$(LazyModule.scala:305) [error] at freechips.rocketchip.diplomacy.LazyRawModuleImp.instantiate(LazyModule.scala:401) [error] at freechips.rocketchip.diplomacy.LazyRawModuleImp.$anonfun$x$23$2(LazyModule.scala:414) [error] at freechips.rocketchip.diplomacy.LazyRawModuleImp$$Lambda$5348/527802603.apply(Unknown Source) [error] at chisel3.withClockAndReset$.apply(MultiClock.scala:26) [error] at freechips.rocketchip.diplomacy.LazyRawModuleImp.$anonfun$x$23$1(LazyModule.scala:414) [error] at freechips.rocketchip.diplomacy.LazyRawModuleImp$$Lambda$5347/2072529844.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursivelyProduct(package.scala:48) [error] at freechips.rocketchip.diplomacy.LazyRawModuleImp.(LazyModule.scala:413) [error] at chipyard.ChipTop$$anon$1.(ChipTop.scala:34) [error] at chipyard.ChipTop.$anonfun$module$1(ChipTop.scala:34) [error] at chipyard.ChipTop$$Lambda$5327/2025612162.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at chipyard.ChipTop.module$lzycompute(ChipTop.scala:34) [error] at chipyard.ChipTop.module(ChipTop.scala:34) [error] at chipyard.TestHarness.$anonfun$dut$2(TestHarness.scala:89) [error] at chipyard.TestHarness$$Lambda$5326/1784878325.apply(Unknown Source) [error] at chisel3.Module$.do_apply(Module.scala:53) [error] at chipyard.TestHarness.$anonfun$dut$1(TestHarness.scala:89) [error] at chipyard.TestHarness$$Lambda$5325/606882094.apply(Unknown Source) [error] at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33) [error] at chipyard.TestHarness.(TestHarness.scala:89) [error] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [error] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [error] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [error] at java.lang.reflect.Constructor.newInstance(Constructor.java:408) [error] at freechips.rocketchip.stage.phases.PreElaboration.$anonfun$transform$1(PreElaboration.scala:36) [error] at freechips.rocketchip.stage.phases.PreElaboration$$Lambda$4726/819668922.apply(Unknown Source) [error] at chisel3.Module$.do_apply(Module.scala:53) [error] at chisel3.stage.phases.Elaborate.$anonfun$transform$2(Elaborate.scala:40) [error] at chisel3.stage.phases.Elaborate$$Lambda$4738/2134387929.apply(Unknown Source) [error] at chisel3.internal.Builder$.$anonfun$build$1(Builder.scala:807) [error] at chisel3.internal.Builder$$$Lambda$4739/1505278853.apply(Unknown Source) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59) [error] at chisel3.internal.Builder$.build(Builder.scala:802) [error] at chisel3.stage.phases.Elaborate.$anonfun$transform$1(Elaborate.scala:40) [error] at chisel3.stage.phases.Elaborate$$Lambda$4730/1345829288.apply(Unknown Source) [error] at scala.collection.immutable.List.flatMap(List.scala:293) [error] at scala.collection.immutable.List.flatMap(List.scala:79) [error] at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:28) [error] at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:21) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:38) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:248) [error] at firrtl.options.Translator.transform$(Phase.scala:248) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at firrtl.options.DependencyManager.$anonfun$transform$5(DependencyManager.scala:280) [error] at firrtl.options.DependencyManager$$Lambda$4713/1760648804.apply(Unknown Source) [error] at firrtl.Utils$.time(Utils.scala:181) [error] at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:280) [error] at firrtl.options.DependencyManager$$Lambda$4711/344013278.apply(Unknown Source) [error] at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183) [error] at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179) [error] at scala.collection.immutable.List.foldLeft(List.scala:79) [error] at firrtl.options.DependencyManager.transform(DependencyManager.scala:269) [error] at firrtl.options.DependencyManager.transform$(DependencyManager.scala:255) [error] at firrtl.options.PhaseManager.transform(DependencyManager.scala:443) [error] at chisel3.stage.ChiselStage.run(ChiselStage.scala:45) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:38) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:248) [error] at firrtl.options.Translator.transform$(Phase.scala:248) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at firrtl.options.Stage.$anonfun$transform$5(Stage.scala:47) [error] at firrtl.options.Stage$$Lambda$4489/772435819.apply(Unknown Source) [error] at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183) [error] at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179) [error] at scala.collection.immutable.List.foldLeft(List.scala:79) [error] at firrtl.options.Stage.$anonfun$transform$3(Stage.scala:47) [error] at firrtl.options.Stage$$Lambda$4481/1228110471.apply(Unknown Source) [error] at logger.Logger$.$anonfun$makeScope$2(Logger.scala:137) [error] at logger.Logger$$$Lambda$4483/1220315573.apply(Unknown Source) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59) [error] at logger.Logger$.makeScope(Logger.scala:135) [error] at firrtl.options.Stage.transform(Stage.scala:47) [error] at firrtl.options.Stage.transform(Stage.scala:17) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:38) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:248) [error] at firrtl.options.Translator.transform$(Phase.scala:248) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at firrtl.options.DependencyManager.$anonfun$transform$5(DependencyManager.scala:280) [error] at firrtl.options.DependencyManager$$Lambda$4713/1760648804.apply(Unknown Source) [error] at firrtl.Utils$.time(Utils.scala:181) [error] at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:280) [error] at firrtl.options.DependencyManager$$Lambda$4711/344013278.apply(Unknown Source) [error] at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183) [error] at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179) [error] at scala.collection.immutable.List.foldLeft(List.scala:79) [error] at firrtl.options.DependencyManager.transform(DependencyManager.scala:269) [error] at firrtl.options.DependencyManager.transform$(DependencyManager.scala:255) [error] at firrtl.options.PhaseManager.transform(DependencyManager.scala:443) [error] at chisel3.stage.ChiselStage.run(ChiselStage.scala:45) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:38) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:248) [error] at firrtl.options.Translator.transform$(Phase.scala:248) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at firrtl.options.Stage.$anonfun$transform$5(Stage.scala:47) [error] at firrtl.options.Stage$$Lambda$4489/772435819.apply(Unknown Source) [error] at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183) [error] at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179) [error] at scala.collection.immutable.List.foldLeft(List.scala:79) [error] at firrtl.options.Stage.$anonfun$transform$3(Stage.scala:47) [error] at firrtl.options.Stage$$Lambda$4481/1228110471.apply(Unknown Source) [error] at logger.Logger$.$anonfun$makeScope$2(Logger.scala:137) [error] at logger.Logger$$$Lambda$4483/1220315573.apply(Unknown Source) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59) [error] at logger.Logger$.makeScope(Logger.scala:135) [error] at firrtl.options.Stage.transform(Stage.scala:47) [error] at firrtl.options.Stage.execute(Stage.scala:58) [error] at firrtl.options.StageMain.main(Stage.scala:71) [error] at chipyard.Generator.main(Generator.scala) [error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [error] at java.lang.reflect.Method.invoke(Method.java:483) [error] stack trace is suppressed; run last Compile / runMain for the full output [error] (Compile / runMain) java.lang.reflect.InvocationTargetException [error] Total time: 136 s (02:16), completed Jun 26, 2023 11:12:01 PM make: *** [/home/hoangph/chipyard/common.mk:110: /home/hoangph/chipyard/sims/vcs/generated-src/chipyard.TestHarness.GCDAXI4BlackBoxRocketConfig/chipyard.TestHarness.GCDAXI4BlackBoxRocketConfig.fir] Error 1

Have you met this before? And have you solved your above issue yet?

Thanks

hoangfint avatar Jun 27 '23 03:06 hoangfint

@hoangfint what version of chipyard and chisel you are using

leduchuybk avatar Jun 27 '23 03:06 leduchuybk

Hi @leduchuybk
I am using chipyard 1.9.0 and chisel3

hoangfint avatar Jun 27 '23 04:06 hoangfint