-
Notifications
You must be signed in to change notification settings - Fork 171
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
Remove vector of bools in vext #622
base: master
Are you sure you want to change the base?
Conversation
The 'n produced in here, and I believe it can't be 0.
And the result of this commit run with riscv-vector-tests is in here |
I'm really curious about the code below... Maybe this should be supported by sail to remember the range of a funtion return value? idk...
|
Co-authored-by: Alexander Richardson <[email protected]> Signed-off-by: guan jian <[email protected]>
Co-authored-by: Alexander Richardson <[email protected]> Signed-off-by: guan jian <[email protected]>
Co-authored-by: Alexander Richardson <[email protected]> Signed-off-by: guan jian <[email protected]>
It should work if you make |
But I would recommend not trying to fix the types in this PR! I started going down that route and you end up rewriting half the vector code and never finishing (I have also done the same for the virtual memory code, though that is a less code so I've almost finished). Let's use asserts temporarily and then we can gradually fix the types and remove the asserts. |
I change the def below, change 'n >= 0 to 'n > 0. Because it all use get_num_elem to produce it.
|
let res : bool = match funct6 { | ||
VVM_VMADC => unsigned(vs2_val[i]) + unsigned(vs1_val[i]) + unsigned(bool_to_bits(vm_val[i])) > 2 ^ SEW - 1, | ||
VVM_VMSBC => unsigned(vs2_val[i]) - unsigned(vs1_val[i]) - unsigned(bool_to_bits(vm_val[i])) < 0 | ||
VVM_VMADC => unsigned(vs2_val[i]) + unsigned(vs1_val[i]) + (if vm_val[i] == bitone then 1 else 0) > 2 ^ SEW - 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this just be unsigned(vm_val[I])?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember the last time I tried with unsigned(vm_val[I]), and unsigned take bits not bit, also tried with to_bits,but it also not take type bit. sorry for not mention that...
val unsigned = pure {
ocaml: "uint",
lem: "uint",
interpreter: "uint",
coq: "uint",
lean: "BitVec.toNat",
_: "sail_unsigned"
} : forall 'n. bits('n) -> range(0, 2 ^ 'n - 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally looks good to me. There are a few more simplifications that I've pointed out (commented on the first instance only but there are often multiple).
Further cleanup can be done in a follow up
fix #554
emmm...
I will test the code with riscv-vector-tests later...
And to make sure
assert('n > 0);
is right