I wrote a module in System Verilog, I need 32 modules, so I am using generate statement for instantiation.
The problem is that in every rising edge of clock I need to instantiate new values to the modules and then need to choose one of them (in the same posedge clock, depending on the outputs of the modules, in my case the min between all the module output).
How can I do that?
This is my current version of the code:
genvar j;
generate
for (int j=0; j<32; j++)
begin: module_instant_loop
always @(posedge Clock)
begin
MyUnit unit[j] (.A(TEST1[j],.B(TEST2[j]),.OUT(MYOUT[j]);
end
end
end
endgenerate
And this is the code that I want to add:
for (int i=0; i<32; i++)
begin
if (MYOUT[i] < MINIMUM) MINIMUM=MYOUT[i];
if (MYOUT[i] > MAXIMUM) MAXIMUM=MYOUT[i];
end
How can I add the loop to my code?
intin the for loop inside the generate statement - j is already declared as a genvar. – Tom Carpenter Jun 01 '15 at 00:25