CIDARLAB/pyLFR

Wrong error for missing ;

ryu-bu opened this issue · 3 comments

Code;

module seeding(
    control [6:0] c,
    finput seeding_origin, [7:0] seeding, buffer, stimuli,
    foutput waste
);

    distribute@(c[0]) begin
        if (c[0] == 1)
            seeding[0:7] <= seeding_origin; 
    end

    flow [7:0] seeding_out1;
    flow [5:0] seeding_out2;
    flow [3:0] seeding_out3;
    flow [1:0] seeding_out4;

    distribute@(c[1]) begin
        if (c[1] == 1)
            seeding_out1[0:7] <= seeding[0:7];
    end

    distribute@(c[2]) begin 
        if (c[2] == 1)
            seeding_out2[0:5] <= seeding_out1[0:5]
    end
endmodule;

the error message for

if (c[2] == 1)
            seeding_out2[0:5] <= seeding_out1[0:5]
    end

is

ANTLR runtime and generated code versions disagree: 4.9!=4.8
ANTLR runtime and generated code versions disagree: 4.9!=4.8
line 27:4 no viable alternative at input 'seeding_out1[0:5]end'
line 27:4 mismatched input 'end' expecting '<='
Stopping compiler because of syntax errors

whereas it should be "missing ;" .

The syntax should be:

if (c[2] == 1)
   begin
            seeding_out2[0:5] <= seeding_out1[0:5]
    end

you're missing begin

Should there be begin even if there is only one line under the if statement?

Should there be begin even if there is only one line under the if statement?

begin + end occur in pairs always if you only have 1 line you can just skip having them