- Duplicating of Modules - 3 Updates
Arsh G <arsh....@gmail.com>: Dec 05 06:19AM -0800
Hi,
I'm trying to instantiate multiple instances of the same module in chisel
for example
val X1 = Module(new Y(proto= ...))
val X2 = Module(new Y(proto= ...))
val X3 = Module(new Y(proto= ...))
val X4 = Module(new Y(proto= ...))
...
upto n times
I've tried mapping them to List, so
val X = Module(new Y(proto= ...))
val Y = (0 until n).map(x => X).toList
The chisel compiles but when I do hardware simulation I can only see one
module not multiple ones in this method.
Can someone point out why this is happening, I've tried googling but of no
help ? :(
Thank you
Edward Wang <edw...@berkeley.edu>: Dec 05 07:06AM -0800
Hi,
Thanks for your interest in Chisel. One thing to take a look at could be
https://www.chisel-lang.org/docs/cookbooks/hierarchy#how-do-i-instantiate-multiple-instances-with-the-same-module-parameterization
Additionally, are all the modules used? FIRRTL/CIRCT I believe will remove
unused hardware elements so that might be another possibility.
On Tuesday, December 5, 2023 at 9:19:28 a.m. UTC-5 arsh....@gmail.com wrote:
Hi,
I'm trying to instantiate multiple instances of the same module in chisel
for example
val X1 = Module(new Y(proto= ...))
val X2 = Module(new Y(proto= ...))
val X3 = Module(new Y(proto= ...))
val X4 = Module(new Y(proto= ...))
...
upto n times
I've tried mapping them to List, so
val X = Module(new Y(proto= ...))
val Y = (0 until n).map(x => X).toList
The chisel compiles but when I do hardware simulation I can only see one
module not multiple ones in this method.
Can someone point out why this is happening, I've tried googling but of no
help ? :(
Thank you
Kevin Laeufer <lae...@berkeley.edu>: Dec 05 10:33AM -0500
Something that might also be worth trying is:
val Y = (0 until n).map(_ => Module(new Y(proto= ...))).toList
The difference here is that this now calls the constructor n times.
The previous version was just copying the _reference_ to the module n
times. I.e., you got n references to the same module instance.
- Kevin
On 12/5/23 10:06, 'Edward Wang' via chisel-users wrote:
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to chisel-users...@googlegroups.com.