-
Notifications
You must be signed in to change notification settings - Fork 159
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
Simplify prelude.sail by including generic_equality.sail and mapping.sail #318
Simplify prelude.sail by including generic_equality.sail and mapping.sail #318
Conversation
LGTM. reg_deref isn't removed, it's just called I'm not sure why the library defines hex_bits_20 only. You can technically define a polymorphic hex_bits in current Sail, but it's not very useful, as it has the type:
which means it isn't a drop-in replacement, as the requirement to specify the width on the left hand side means it always has to go on the other side of the assembly mappings so:
becomes
what we could do is specify all the |
I added the hex_bits_N functions (up to 32) here: rems-project/sail@f228c2b We could copy those definitions into the prelude_mapping file until the next sail release then just replace with an |
Don't you also need _matches_prefix functions for strings? |
You don't -- currently string append patterns (which used those functions) are quarantined by the effect system marking them non-executable, then they are removed from the model. The previous implementation was so broken it was causing issues elsewhere. I have some ideas for how to fix them but I don't plan on using any kind of _matches_prefix functions. In general they can only work in some backends, so we will need to use the effect system or some other static analysis pass to ensure the semantics of instructions never depends on string append patterns. It's not a super high priority thing for me right now though. Now I'm working on hardware model checking, compiling Sail into SystemVerilog, so I'll likely try to become a bit more strict about how strings in general (and linked lists for similar reasons) are used, as they don't play very nicely with Jasper. |
Ok, them being gone is simplifying, it was causing all kinds of problems for making rems-project/sail#57 work in the general case. I guess that should be closed now? |
Oh, that's an old PR. Yes, it shouldn't be needed now. I like how I said I'd look at it tomorrow (four-ish years ago) then didn't say anything more... If I do that again you should bug me some more. I suspect I probably had some grand plan of just fixing the whole string mapping situation even then. I don't think I've actually achieved that but the badness is more constrained at least. So much pain for a feature that just looked cutesy in our POPL paper. |
I think you said you'd look at it, then I went away, poked it some more and discovered it didn't actually work for all cases, and doing so properly would be a whole project in and of itself, so we both just forgot about it... :) |
6578d5d
to
b1fb0fb
Compare
@Alasdair I copy & pasted your new
No file/line number. Do I need to update my Sail compiler? Maybe the |
Yes, you would need the latest released version I think. Looking at the prelude |
I made the lib mapping file what it should be, at least for spc, opt_spc, and def_spc. It's not clear that it should be defining it's own string manipulation functions but I left those alone for now https://github.com/rems-project/sail/blob/5ff1cb6f8d901969923002155eadd852140a63a6/lib/mapping.sail |
Ah great. I'll copy that file in too. |
…sail This change includes `generic_equality.sail` and `mapping.sail` from the Sail standard library which defines a lot of things that were defined in `prelude.sail`. I also removed `reg_deref` which is no longer required. The `mapping.sail` and `hex_bits.sail` files are in Sail 0.18 which is not yet released, so they have been temporarily copied here.
b1fb0fb
to
4f3946f
Compare
This worked for me with Sail 0.17.1. I think that's the version I used anyway. It seems like there's a very confusing missing dependency link in Sail's |
Yes, I think that can happen if you build on one commit, then checkout another and build without a |
This is ready to merge. |
As a heads up, I think once |
Yep the intention is to remove these once |
@billmcspadden-riscv any objection to merging this? |
This change includes
generic_equality.sail
andmapping.sail
from the Sail standard library which defines a lot of things that were defined inprelude.sail
.I also removed
reg_deref
which as far as I can tell is removed.hex_bits_20
is commented out because it is defined bymapping.sail
(but none of the others are; I am not sure why).