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

Generate random values for undefineds when pokeing #28

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

lmbollen
Copy link
Member

The current FFI implementation does not handle undefined values.
This PR changes the storable instances of the inputs to vexrisc such that poke checks if a value has undefined bits.
If the value has undefined bits we generate a random value.

Do note that partially undefined values will get completely new randomized values. At the moment I'm not sure how to best implement this, I'm open for suggestions or discussion.

clash-vexriscv/src/VexRiscv/FFI.hsc Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/FFI.hsc Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/FFI.hsc Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/FFI.hsc Outdated Show resolved Hide resolved
@lmbollen lmbollen force-pushed the ffi-undefined-to-random-storable branch from 08b2217 to edc983a Compare March 28, 2024 07:30
@lmbollen lmbollen force-pushed the ffi-undefined-to-random-storable branch 2 times, most recently from 7667c6f to 05ec8b0 Compare April 4, 2024 08:43
clash-vexriscv/src/VexRiscv.hs Outdated Show resolved Hide resolved
clash-vexriscv/clash-vexriscv.cabal Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/Random.hs Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/Random.hs Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/Random.hs Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/Random.hs Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/Random.hs Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv/Random.hs Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv.hs Outdated Show resolved Hide resolved
clash-vexriscv/src/VexRiscv.hs Outdated Show resolved Hide resolved
@lmbollen lmbollen force-pushed the ffi-undefined-to-random-storable branch 5 times, most recently from c081831 to a0e97f4 Compare April 10, 2024 08:15
Copy link
Member

@martijnbastiaan martijnbastiaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One final tidbit, LGTM overall!

clash-vexriscv/src/VexRiscv/Random.hs Outdated Show resolved Hide resolved
@lmbollen lmbollen force-pushed the ffi-undefined-to-random-storable branch from a0e97f4 to 4a06e47 Compare April 11, 2024 09:51
@lmbollen lmbollen merged commit e5c2b53 into main Apr 11, 2024
7 checks passed
@lmbollen lmbollen deleted the ffi-undefined-to-random-storable branch April 11, 2024 10:05
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 this pull request may close these issues.

2 participants