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

Support static fields and properties (HAST-251) #24

Open
Piedone opened this issue Dec 25, 2017 · 0 comments
Open

Support static fields and properties (HAST-251) #24

Piedone opened this issue Dec 25, 2017 · 0 comments

Comments

@Piedone
Copy link
Member

Piedone commented Dec 25, 2017

Currently, all methods' variables are like private static fields because the VHDL variables' values are kept between FSM executions. Because such variables are never read before being initialized (this would also be invalid in C#) this is not an issue.

The same mechanism could be used for static fields/properties: every field would have a static setter and getter FSM (like for instance properties) and they'd use the same common signal to store the member's value (which would only be produced once, on first access).

It's a question how this could work with arrays, because their single elements should also be writable. Maybe the easiest way would be to always overwrite the whole array too.

However, arrays and static fields/properties also bring an issue with concurrency: what happens if multiple threads try to access an uninitialized static field? This is not thread-safe in .NET either.

When ConvertConstructorCallIntoInitializer is deactivated, static constructors will appear, and these will contain field initializers (however instance ctors will also appear with a lot of redundant code). This is easier to transform. Such static ctors should be run once after power up (i.e. on the FPGA we need to store that they were run) simultaneously on the first start Task.WhenAll()-style. But what if static fields depend on each other? Maybe a sequential run, but with two passes is better.

Jira issue

@github-actions github-actions bot changed the title Support static fields and properties Support static fields and properties (HAST-251) Sep 18, 2022
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

1 participant