Hi
You still don't sound like you grasp what a generate statement is used for in Verilog. For most designers, these are not frequently used.
Generate statements exist to a) save you from having to repetitively type similar states and/or b) having the ability to conditionally add code to your file.
It sounds like you want to use generate to save a pattern to a register. You can't do that with a generate statement.
If you created the following generate block:
Code:
[syntax=verilog]logic [1:0] blah;
genvar i;
generate
for (i =0 ; i<4; i++) begin
assign blah = i;
endgenerate[/syntax]
This is the code that will be used by the simulator or synthesizer:
Code:
[syntax=verilog] assign blah = 0;
assign blah = 1;
assign blah = 2;
assign blah = 3;[/syntax]
And the only value that will be assigned to blah, assuming the simulator or synthesizer doesn't complain about it, is 3, since that is the last assignment made to blah.
More to the point, you imply that you want to repetitively assign values to a register outside of an always block. That is not valid Verilog.
If you need to store an internally-generated pattern to a register, you will need to feed that register with the output of a lookup table, an FSM , a counter, etc. that you design. And do that in a sequential always block.
As has been suggested previously, you may want to get a good textbook and Verilog and look for templates for registers, etc.
r.b.