I'm trying to set initial conditions for registers in an array of interfaces. Doing it manually seems to work. In my project, this builds in Quartus without errors:
However, changing that block of code to this causes the build to fail:
In the second case I get an error of 'can't resolve reference to object "ports"' as though the array doesn't exist. Am I making a dumb mistake or trying something that isn't possible? My eventual goal is to have a parameterized number of ports, but that requires being able to make assignments using loops.
Code:
initial begin
ports[0].done = '1;
ports[1].done = '1;
ports[2].done = '1;
ports[3].done = '1;
end
Code:
initial begin
for(int n=0; n<4; n++) begin
ports[n].done = '1;
end
end