简体   繁体   中英

In chisel, How to generate serval Module with different parameter?

I have a Module monit which has an parameter threshold , then I want to generate serval(eg8) Module monit in the wrapper with different threshold. But when I use

val monits = Seq.fill(8)(Module(new monit(32)))

to create 8 modules monit, they all have same threshold, how can I deliver different threshold parameter?

Maybe something like this?

val thresholds = Seq(1,2,3,4,5,6,7,8)
val monits = thresholds.map(th => Module(new monit(th)) )

I typed this on my phone and have not tested the code, but should give an idea about using scala collections and map for the purpose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM