Hi Jack,
Thanks for the suggestions. I tried increasing the memory but it didn't solve the problem. What I was hoping for is basically making each module independent from each other and independent of recursion level since it is just one variable (port size) that changes in actual verilog. I solved the problem by using BlackBox class and overriding desiredName of the Module in Chisel. Here is the pseudocode for the solution I used:
class InitialModule extends module {
// some registers and logic
}
class MyModuleBlackBox(val size: Int) extends BlackBox {
override val desiredName = s"MyModule_$size"
val io = IO(new Bundle {
val clock = Input(Clock())
val reset = Input(Bool())
val in = Input(UInt(size.W))
val out = Output(UInt(size.W))
})
}
class MyModule(val size: Int) extends Module {
override val desiredName = s"MyModule_$size"
val io = IO(new Bundle {
val clock = Input(Clock())
val reset = Input(Bool())
val in = Input(UInt(size.W))
val out = Output(UInt(size.W))
})
if (size == 4) {
val subModules = Seq.fill(4)(Module(new InitialModule()))
for (i <- 0 until 4) {
subModules(i).
io.in := ...
// just some connections between subModules and io of this module
}
} else {
val subModules = Seq.fill(4)(Module(new MyModuleBlackBox(size/4)))
for (i <- 0 until 4) {
subModules(i).io.clock := clock
subModules(i).io.reset := reset.asBool
subModules(i).
io.in := ...
// just some connections between subModules and io of this module
}
}
}
object MyModuleRecursiveInit extends App {
val max_width = 1024
for (size <- Iterator.iterate(4)(x => x * 2).takeWhile(_ <= max_width)) {
ChiselStage.emitSystemVerilogFile(
new MyModule(size),
firtoolOpts = Array(
"-disable-all-randomization",
"-strip-debug-info"
)
}
}
I was wondering if there is a compiler option for that. I cannot post the exact code that caused the error, but I can create a similar chisel code and reproduce failure with Scala CLI if you think that is still important for the chisel community.
Best Regards,
Saltuk
7 Mayıs 2025 Çarşamba tarihinde saat 01:14:08 UTC+2 itibarıyla Jack Koenig şunları yazdı: