How to use instances of a module with instances' index?

376 Views Asked by At

For example,

module MM;

MM mm[128]();

I want to get mm[i].signle1,i from 0 to 120. but I cannot use "for", and I do not want to write 120 statments.

what can I do?

1

There are 1 best solutions below

0
On

You can create a list of ports and you can use a for loop:

signals : list of simple_port of bit is instance;
keep signals.size() == 128;
keep for each (s) in signals {
    s.hdl_path() == append("mm[",dec(i),"].signal1");
};