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

Refactor VHDL N-Dimensional Array Access #3760

Open
leftink opened this issue Mar 7, 2024 · 0 comments
Open

Refactor VHDL N-Dimensional Array Access #3760

leftink opened this issue Mar 7, 2024 · 0 comments

Comments

@leftink
Copy link
Contributor

leftink commented Mar 7, 2024

@ktbarrett, I wanted to propose a change for next Major release that would break backwards compatibility but get rid of some weird code I wrote early on.

For multi-dimensional arrays in VHDL, and I am not referring to arrays of arrays but true multi-dimensional arrays, you need to provide all dimensions to get an element in the array. When I implemented this capability, due to some limitations in the existing GPI interface and also my limited experience with python at the time, I treated the arrays as arrays of arrays. For example, to access an element in a 2-dimensional array the python interface would be:

element = arr[0][1]

While this worked, there was some "hacky" code written in C to manage this, not sure if it is still this way, but what I remember is having to maintain Pseudo handles that stored the first index because all indices were necessary to actually get a handle to the element of a multi-dimensional array. If I remember correctly, FLI could handle the current way of accessing multi-dimensional arrays, but VHPI required all indices to be provided.

Anyway, I propose we make multi-dimensional array access in python look the same as it would in VHDL and mimic the format used by numpy's ndarrays, i.e.

element = arr[0,1]

If you don't think it is worth it that is fine but wanted to throw it out there for consideration. I was never a huge fan of my approach to use Pseudo handles (which is also used on Generate loops) since it is a "fake" handle. Maybe we just need to take a look at all the Pseudo handle stuff as I am sure there is a better way than what I did there so long ago.

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

No branches or pull requests

1 participant