for_loop_inits.v 393 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module top;
`define LOOP(ID, START) \
    x = 0; \
    for (x = START; x < 3; x = x + 1) \
        $display(`"ID x = %0d`", x);

    initial begin : blk
        integer x;
        `LOOP(A, 1)
        `LOOP(B, 1)
        `LOOP(C, 1)
        `LOOP(D, 0)
        `LOOP(E, 0)
        `LOOP(F, 1)
        `LOOP(G, 1)
        `LOOP(H, -1)
        `LOOP(I, -1)
        `LOOP(J, -1)
    end
endmodule