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

CONVERSION ERROR #966

Open
Fuhj-better opened this issue Feb 5, 2025 · 2 comments · May be fixed by #970
Open

CONVERSION ERROR #966

Fuhj-better opened this issue Feb 5, 2025 · 2 comments · May be fixed by #970

Comments

@Fuhj-better
Copy link

Hello,
Is this syntax not supported?
Here is the code:

              integer i;
line 239   for (i = 0; i < N; i = i + 1)
          	if (i == 0)
				{co[i],sum[i]} = half_adder(a[i],b[i]);
			else
				{co[i],sum[i]} = full_adder(a[i],b[i],co[i-1]);

And here is the error message:

line 239: unknown identifier i
CONVERSION ERROR

Thank you for your help!

@kroening
Copy link
Member

kroening commented Feb 5, 2025

Did you forget the begin and end?

@Fuhj-better
Copy link
Author

This is the complete part of the function in the code:

function [N:0] rca_N;

// parameter N = 8;
input [N-1:0] a;
input [N-1:0] b;

reg [N-1:0] co, sum;

begin : RCA // RIPPLE_CARRY_ADDER
    integer i;
    //for (i = 0; i <= N; i = i + 1)
    for (i = 0; i < N; i = i + 1)
        if (i == 0)
            {co[i], sum[i]} = half_adder(a[i], b[i]);
        else
            {co[i], sum[i]} = full_adder(a[i], b[i], co[i-1]);

    rca_N[N-1:0] = sum;
    // MSB is a sign bit
    rca_N[N] = (a[N-1] == b[N-1]) ? co[N-1] : sum[N-1];
end
endfunction

However, it can be compiled through using QuestaSim.
This is the error message indicating line 239:

for (i = 0; i < N; i = i + 1)

Did you forget the begin and end?

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

Successfully merging a pull request may close this issue.

2 participants