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

Add support for arrays of constants #114

Open
eyck opened this issue Apr 20, 2024 · 5 comments
Open

Add support for arrays of constants #114

eyck opened this issue Apr 20, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@eyck
Copy link
Contributor

eyck commented Apr 20, 2024

CoreDSL shall support arrays of constants ether as:
const unsigned int arr[] = {3,4,5};
which inferes the size or
const unsigned int arr[3] = {3,4,5};
where size has to be specified explicitly.

@eyck eyck added the enhancement New feature or request label Apr 20, 2024
@AtomCrafty
Copy link
Contributor

Question: do we need to be able to evaluate arr[1] as a constant expression as well?

const unsigned int arr[] = {16, 32, 64};
unsigned int XLEN = arr[1];

@eyck
Copy link
Contributor Author

eyck commented Apr 20, 2024

For the usecases I have in mind: no. Does the frontend support

const unsigned int c = 32;
unsigned int XLEN = c;

@AtomCrafty
Copy link
Contributor

AtomCrafty commented Apr 20, 2024

It does, yes. I'm specifically asking about the array accesses.

@AtomCrafty
Copy link
Contributor

AtomCrafty commented Apr 20, 2024

Another question: Should this support multi-dimensional arrays with nested array initializers?

const int a[][] = { {1, 2}, {3, 4} };

@eyck
Copy link
Contributor Author

eyck commented Apr 20, 2024

I guess in the long run we need to, I can imagine there are algorithms which need this. So we should start with a 1-dimensional array documenting the limitation.

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

No branches or pull requests

2 participants