简体   繁体   English

在凿子中,如何生成具有不同参数的伺服模块?

[英]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.我有一个具有参数threshold的模块监视器,然后我想在具有不同阈值的包装器中生成 serval( monit ) 模块监视器。 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?要创建 8 个模块监控,它们都有相同的阈值,我如何提供不同的阈值参数?

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.我在我的手机上输入了这个并且没有测试代码,但应该给出关于使用 scala collections 和map的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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