I have some similar register definition, and I want to write under the regmap construct. My code currently looks like this:
val regs = RegInit(Vec(Seq.fill(5)(0.U(32.W))))
regmap (
...
0x30 -> Seq(RegField(32,regs(0),RegFieldDesc("reg0",""),
0x34 -> Seq(RegField(32,regs(1),RegFieldDesc("reg1",""),
0x38 -> Seq(RegField(32,regs(2),RegFieldDesc("reg2",""),
0x3C -> Seq(RegField(32,regs(3),RegFieldDesc("reg3",""),
0x40 -> Seq(RegField(32,regs(4),RegFieldDesc("reg4",""),
...
)
My question, is there a way to write the above in more concise way using one of the Scala Iterators? Another requirement I have is that I still need to be able to add register before and after this iterator (3 dots lines).
I believe ,using iterators is good against copy/paste mistakes and looks better.
Thanks in advance for any help.