|
| 1 | +// Issue #1257 |
| 2 | + |
| 3 | +module t1 |
| 4 | + ( |
| 5 | + ); |
| 6 | + |
| 7 | + genvar pipe; |
| 8 | + logic [1:0] v; |
| 9 | + logic x; |
| 10 | + |
| 11 | + //generate |
| 12 | + for (pipe=0; pipe<2; pipe++) begin : v_bl |
| 13 | + always_comb begin |
| 14 | + assign v[pipe] = '0; |
| 15 | + end |
| 16 | + assign x = '0; // will be incorrectly indented to column 0 |
| 17 | + end |
| 18 | + //endgenerate |
| 19 | + |
| 20 | +endmodule |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +module indent; |
| 26 | + |
| 27 | + // CASE 1 indented wrong. See end of module |
| 28 | + for (genvar aa = 0; aa < FF; aa++) begin : gen_hh |
| 29 | + for (genvar bb = 0; bb < FF; bb++) begin : gen_ii |
| 30 | + if (`asdf [aa]) begin : gen_jj |
| 31 | + |
| 32 | + always_ff @ (negedge cc [aa][bb]) begin |
| 33 | + if (dd [aa][bb])) begin |
| 34 | + for (uint_t d_idx = 0; d_idx < 16; d_idx++) |
| 35 | + ee [aa][bb].push_front (tx_dfe_out [aa][bb] [15 - d_idx]); |
| 36 | + end |
| 37 | + end |
| 38 | + |
| 39 | + always_ff @ (posedge hs_clk) begin |
| 40 | + ee_size [aa][bb] = ee [aa][bb].size(); |
| 41 | + if (ee_size [aa][bb] > 0) |
| 42 | + gg [aa][bb] <= ee [aa][bb].pop_front; |
| 43 | + end |
| 44 | + |
| 45 | + end : gen_jj |
| 46 | + end : gen_ii |
| 47 | + end : gen_hh |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + // this indents correctly without generate/endgenerate |
| 52 | + for (genvar aa = 0; aa < FF; aa++) begin : gen_hh |
| 53 | + for (genvar bb = 0; bb < FF; bb++) begin : gen_ii |
| 54 | + if (`asdf [aa]) begin : gen_jj |
| 55 | + assign a[aa][bb] = aa + bb; |
| 56 | + assign b[aa][bb] = aa + bb; |
| 57 | + end : gen_jj |
| 58 | + end : gen_ii |
| 59 | + end : gen_hh |
| 60 | + |
| 61 | + |
| 62 | + // this works now with gen/endgen |
| 63 | + generate |
| 64 | + for (genvar aa = 0; aa < FF; aa++) begin : gen_hh |
| 65 | + for (genvar bb = 0; bb < FF; bb++) begin : gen_ii |
| 66 | + always @ (negedge cc) |
| 67 | + a = 5; |
| 68 | + always @ (negedge dd) |
| 69 | + w = 2; |
| 70 | + end : gen_ii |
| 71 | + end : gen_hh |
| 72 | + endgenerate |
| 73 | + |
| 74 | + |
| 75 | + // CASE 1 again. No change but works - apparently since verilog-mode hit a generate statement above this line |
| 76 | + for (genvar aa = 0; aa < FF; aa++) begin : gen_hh |
| 77 | + for (genvar bb = 0; bb < FF; bb++) begin : gen_ii |
| 78 | + if (`asdf [aa]) begin : gen_jj |
| 79 | + |
| 80 | + always_ff @ (negedge cc [aa][bb]) begin |
| 81 | + if (dd [aa][bb])) begin |
| 82 | + for (uint_t d_idx = 0; d_idx < 16; d_idx++) |
| 83 | + ee [aa][bb].push_front (tx_dfe_out [aa][bb] [15 - d_idx]); |
| 84 | + end |
| 85 | + end |
| 86 | + |
| 87 | + always_ff @ (posedge hs_clk) begin |
| 88 | + ee_size [aa][bb] = ee [aa][bb].size(); |
| 89 | + if (ee_size [aa][bb] > 0) |
| 90 | + gg [aa][bb] <= ee [aa][bb].pop_front; |
| 91 | + end |
| 92 | + |
| 93 | + end : gen_jj |
| 94 | + end : gen_ii |
| 95 | + end : gen_hh |
| 96 | + |
| 97 | +endmodule : indent |
0 commit comments