Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbiflow-classroom: "Error declaring a variable inside an always_comb block" #264

Open
nelsobe opened this issue Mar 9, 2022 · 4 comments

Comments

@nelsobe
Copy link
Contributor

nelsobe commented Mar 9, 2022

SYMBIFLOW-CLASSROOM-PROJECT

Using original Yosys frontend.

The tools give compile errors when the integer is declared local to the always_comb body:

always_comb begin
    integer index;

    if (hcount < H_PIXELS && vcount < V_PIXELS) begin
        for (index = 0; index < 4; index = index + 1) begin
            VGA_R[index] = rd_data[2];
            VGA_G[index] = rd_data[1];
            VGA_B[index] = rd_data[0];
        end
    end else begin
        VGA_R = 4'b0000;
        VGA_B = 4'b0000;
        VGA_G = 4'b0000;
    end
end
@nelsobe
Copy link
Contributor Author

nelsobe commented Mar 9, 2022

@mithro @acomodi @tmichalak @mkurc-ant Would be interested in any feedback you can provide.

@tmichalak
Copy link
Collaborator

@nelsobe could you provide more details on the errors you get?

@nelsobe
Copy link
Contributor Author

nelsobe commented Mar 22, 2022

@tmichalak Working on getting a trace from the student.

@nelsobe
Copy link
Contributor Author

nelsobe commented Mar 28, 2022

@tmichalak The error provided by the tools is that a latch is inferred on the "index" signal and the compilation fails.

We do not believe that a latch should be inferred (or the compilation fail) since "index" is local to the always_comb block. In this code "index" is functioning like a VHDL variable - used to help in the computation but not intended to carry information out of the block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants