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

Array does not work with integers #315

Closed
westonMS opened this issue Jun 1, 2022 · 6 comments
Closed

Array does not work with integers #315

westonMS opened this issue Jun 1, 2022 · 6 comments

Comments

@westonMS
Copy link

westonMS commented Jun 1, 2022

When declaring an array, only the rightmost value will be read correctly while the rest will be read as 0. The SV is accepted and implemented and a bit-stream is generated. Only then can you see that the values are incorrect. In the following example, indices 0-6 will be read as 0 while index 7 will be read as 3.
ex:
logic[1:0] modmem[8] = '{0, 1, 2, 3, 0, 1, 2, 3};

This can be avoided if the width of each value is specified (in hex, decimal, or binary). In the next example, all values will be read correctly when referenced.
ex:
logic[1:0] modmem[8] = '{2'00, 2'b01, 2'b10, 2'b11, 2'd0, 2'd1, 2'h2, 2'h3};

When a mix of integers and specified widths are used, the rightmost integer will cause everything to the left of it to become 0. In the example, indices 0-4 will be read as 0 while indices 5-7 will be read correctly.
ex:
logic[1:0] modmem[8] = '{0, 1, 2'b10, 2'b11, 2'd00, 1, 2'b10, 2'h3};

Note:

This issue uses the same code that nelsobe found to be a problem in Yosys in issue #263 .
This issue is for Surelog, which parses it and results in a faulty bitsream.

Example: integer_in_array.zip

@rkapuscik
Copy link
Contributor

Thanks for reporting, we'll look into it.

@rkapuscik
Copy link
Contributor

This should be already fixed, please update the plugin to the newest version as described here to verify.

@westonMS
Copy link
Author

We have re-tested this with the latest plugin and the design works now. However, we want fixes to be available to all users when they use the main install. I re-installed the tool-chain with the latest install instructions and this is not fixed without manually updating the plugin.

@mithro
Copy link
Contributor

mithro commented Jul 16, 2022

FYI - @kgugala

@tmichalak
Copy link
Collaborator

@westonMS we are working on a conda_lock_update mechanism - see more detailed comment

@westonMS
Copy link
Author

Retested and it works

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

5 participants