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

Replace undefined with vector_init in vector code #536

Closed
Timmmm opened this issue Sep 4, 2024 · 2 comments
Closed

Replace undefined with vector_init in vector code #536

Timmmm opened this issue Sep 4, 2024 · 2 comments

Comments

@Timmmm
Copy link
Collaborator

Timmmm commented Sep 4, 2024

There's a few places in the vector code like this:

val init_masked_result : forall 'n 'm 'p, 'n >= 0. (int('n), int('m), int('p), vector('n, dec, bits('m)), vector('n, dec, bool)) -> (vector('n, dec, bits('m)), vector('n, dec, bool))
function init_masked_result(num_elem, SEW, LMUL_pow, vd_val, vm_val) = {
...
  var mask : vector('n, dec, bool) = undefined;
  var result : vector('n, dec, bits('m)) = undefined;

I think that was done because until recently there was no way to create a vector literal without a fixed size. However this use of undefined seems pretty dubious. We should now be able to do something like this:

  var mask : vector('n, dec, bool) = vector_init(false);
  var result : vector('n, dec, bits('m)) = vector_init(zeros());
@Timmmm
Copy link
Collaborator Author

Timmmm commented Sep 4, 2024

Some of that vector code looks like it could be rewritten in a nicer style without for loops anyway though.

@Timmmm
Copy link
Collaborator Author

Timmmm commented Oct 2, 2024

I think the remaining undefineds are all covered by #554 (switching from vec(bool) to bits()) which I am working on (it's a decent sized change though).

@Timmmm Timmmm closed this as completed Oct 2, 2024
Timmmm pushed a commit to Timmmm/sail-riscv that referenced this issue Oct 2, 2024
If Svnapot is not implemented, skip the test.
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