summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-01-28Fix a bug with lexp->exp conversion for register referencesAlasdair
2020-01-22Preserve effect annotation when realising mappingsThomas Bauereiss
2020-01-21Reduce the amount of unnecessary parentheses in Coq outputBrian Campbell
2020-01-21Use hex/bin literals in Coq backendBrian Campbell
Also be more careful to avoid pattern bindings with identifiers to avoid parsing clashes, eg `let 'bytes := ...` which is confused with the notation for binary literals.
2020-01-17Merge scattered mapping fixesJames Clarke
2020-01-17Merge branch 'coq-bool-props' into sail2Brian Campbell
2020-01-17Keep track of source locations for all IR branchesAlasdair
Useful for tracking down non-determinism
2020-01-16Allow effects on mappingsAlasdair Armstrong
2020-01-16Cleanup type-checking rule for LEXP_fieldAlasdair Armstrong
Was being overly conservative with nested structs and used an incorrect location for the error message
2020-01-16Keep track of (non-bit) vectors known to be fixed size in JibAlasdair Armstrong
This is useful because an arbitrary vector of a fixed size N can be represented symbolically as a vector of N symbolic values, whereas an arbitrary vector of arbitrary size cannot be easily represented.
2020-01-14Basic support to track uncaught exceptions in Sail->CAlasdair
2020-01-10Don't do any C specific name mangling for the cons operator in jib_compileAlasdair Armstrong
Instead handle it specially in c_backend, leaving the type information in the IR available for other consumers
2020-01-04Coq: change record field update notation to avoid duplicating termsBrian Campbell
(using match rather than let-and-projections because the latter would be reduced by tactics like unfold)
2020-01-03Add Sail pretty-printing of bitfieldsThomas Bauereiss
2019-12-18Make sure we generate literals of precisely the right length for symbolic ↵Alasdair Armstrong
execution
2019-12-13move ott pp to different Makefile rulePeter Sewell
2019-12-13experiment in ott-generated ppPeter Sewell
2019-12-12Fix a little bit of inconsistency in the command line argumentsAlasdair Armstrong
2019-12-10Introduce new bitfield syntax for ASL translationAlasdair Armstrong
Now we less desugared ASL we'd like to translate some notions more idiomatically, such as bitfields with names. However the current bitfield implementation in Sail is really ugly (entirely my fault) This commit introduces a new flag -new_bitfields which changes the behavior of bitfields as follows bitfield B : bits(32) = { Field: 7..0 } Is now treated as a struct with a single field called `bits` register R : B function main() -> unit = { R[Field] = 0xFF; assert(R[Field] == 0xFF) } then desugars as R.bits[7..0] = 0xFF and assert(R.bits[7..0] == 0xFF) which is much simpler, matches ASL and is probably how it should have worked all along
2019-12-06Don't introduce uneccesary control flow when compilingAlasdair Armstrong
2019-12-03Prover backends: Expand Int type synonyms in type definitionsThomas Bauereiss
... not just in type abbreviations. Fixes an error in the RV32 build of CHERI-RISC-V.
2019-12-01Coq: remove last use and definition of doc_nc_propBrian Campbell
(plus test, as it wasn't covered before)
2019-11-29Merge branch 'word-numerals' into sail2Thomas Bauereiss
2019-11-29Tweak generated register_value typeThomas Bauereiss
Don't include length and indexing order in Regval_vector constructor, as these can get in the way of proofs without providing any value.
2019-11-29Coq: switch to boolean predicates for Sail-type propertiesBrian Campbell
- ArithFact takes a boolean predicate - defined in terms of ArithFactP, which takes a Prop predicate, and is used directly for existentials - used abstract in more definitions with direct proofs - beef up solve_bool_with_Z to handle more equalities, andb and orb
2019-11-26Allow overriding of generated mapping functionsThomas Bauereiss
If, for example, we have a bidirectional encoding-decoding mapping as in sail-riscv, but want to translate only the decoder to a theorem prover, this commit allows us to stub out the the encoder by splicing in dummy definitions.
2019-11-25Merge branch 'hol-regstate' into sail2Thomas Bauereiss
2019-11-21Fix bugs in mutrec constant propagationThomas Bauereiss
The val spec generation for partially evaluated function copies did not pick up type variables originally declared using the new "constant" syntax, as well as some implicit existential variables (e.g. in "bool") that were not declared originally but appear and get bound during instantiation. Change the code to just recreate the list of type variables from scratch from the new type. This will lose "constant" annotations, but the new list of type variables should be correct.
2019-11-21Mono: Use more environment information when adding bitvector castsThomas Bauereiss
When considering whether to add a cast, now also consider the updated environment within an if branch / match clause to compare against the outer environment. This picks up not only constraints on type variables added by an if condition or pattern guard (e.g. "if (size == 16) ..."), but also constraints depending on those (e.g. in "bits('width)" where "'width == 'size * 8"). Fixes a type error observed when generating Lem for sail-arm (in aget__Mem).
2019-11-21Add option to generate grouped register state recordThomas Bauereiss
... with one field per register *type*, instead of one field per register. The fields store functions from register name to value. This leads to dramatically reduced processing time for the register state record in HOL4.
2019-11-21Implement -cycle-limit option for OCaml emulator similar to one for C.Robert Norton
2019-11-20Allow undefined values in IR for SMT generationAlasdair Armstrong
Means we can avoid the use of -undefined_gen for Sail->SMT
2019-11-14Fix typo in constant folding for and_bool/or_boolAlasdair Armstrong
2019-11-11Make sure undefined_gen inserts enough type annotations for union constructorsAlasdair Armstrong
2019-11-11Update libsail slightly with recent changesAlasdair Armstrong
Also don't include the toplevel files in the library, and move load_files and descatter into process_file where they can be called
2019-11-11Make sure we include LEXP_cast register refs when slicing the specificationAlasdair Armstrong
Also make the Error type private, so it's only constructed through the functions we expose in reporting.mli
2019-11-08Refactor Jib compilationAlasdair Armstrong
Split the dynamic context into the ctx struct, and the static configuration into a module which parameterises the sail->jib compilation step rather than just having a giant ctx struct.
2019-11-07Fix Jenkins buildAlasdair Armstrong
sail2_instr_kinds was in the folder with the old lem interpreter for some reason, rather than with all the other sail2*.lem files
2019-11-07Backport fixes to SMT generation from poly_mapping branchAlasdair Armstrong
2019-11-06Allow specifying specific fields of a register as constant with ↵Alasdair Armstrong
:fixed_registers command
2019-11-06Add toplevel commands to fix specific register values and simply spec ↵Alasdair Armstrong
accordingly
2019-11-05Forbid types declared after a scattered union being used in clausesAlasdair
The following is therefore always forbidden ``` scattered union U enum E = A | B | C union clause U = Ctor : E ``` We attempt to detect when this occurs and include a hint indicating the likely reason why a 'Undefined type E' error might occur in this circumstance
2019-11-05Improve type error for recursive types slightlyAlasdair Armstrong
2019-11-05Make sure we correctly forbid recursive datatypes that we don't want to supportAlasdair Armstrong
Ensure we give a nice error message that explains that recursive types are forbidden ``` Type error: [struct_rec.sail]:3:10-11 3 | field : S | ^ | Undefined type S | This error was caused by: | [struct_rec.sail]:2:0-4:1 | 2 |struct S = { | |^----------- | 4 |} | |^ | | Recursive types are not allowed ``` The theorem prover backends create a special register_value union that can be recursive, so we make sure to special case that.
2019-11-04Allow overriding the interpreter effectsAlasdair Armstrong
This allows read_mem and read_reg effects to be handled by GDB
2019-11-01More work on GDB interfaceAlasdair Armstrong
The following now works to run sail on every HVC call with hafnium function gdb_init() -> unit = { // Connect to QEMU via GDB sail_gdb_qemu(""); sail_gdb_symbol_file("hafnium.elf.sym"); sail_gdb_send("break-insert sync_lower_exception") } function gdb() -> unit = { gdb_init(); while true do { sail_gdb_send("exec-continue"); sail_gdb_sync() } }
2019-11-01Add a missing well-formedness checkAlasdair
2019-10-31Allow sail to be scripted using sailAlasdair
Currently the -is option allows a list of interactive commands to be passed to the interactive toplevel, however this is only capable of executing a sequential list of instructions which is quite limiting. This commit allows sail interactive commands to be invoked from sail functions running in the interpreter which can be freely interleaved with ordinary sail code, for example one could test an assertion at each QEMU/GDB breakpoint like so: $include <aarch64.sail> function main() -> unit = { sail_gdb_start("target-select remote localhost:1234"); while true do { sail_gdb_continue(); // Run until breakpoint sail_gdb_sync(); // Sync register state with QEMU if not(my_assertion()) { print_endline("Assertion failed") } } }
2019-10-31Allow sail interactive toplevel to connect to a running QEMU instance using ↵Alasdair Armstrong
GDB/MI After starting QEMU with -s -S we can run :gdb_qemu in isail to connect to it using a gdb-multiarch child process, which we communicate with via the gdb/mi interface. :gdb_send command sends a command to gdb and waits for it to respond. The idea is we will have a :gdb_sync command that will sync the register state of the running QEMU session with the Sail interpreter after a breakpoint, then we can run Sail code to test the state of the machine by hooking memory reads into approprate gdb commands.
2019-10-28Fix jib.ott and SMT regressionsAlasdair Armstrong
SMT seems sensitive to gensym counter being reset between definitions, but it shouldn't care due to unique_per_function_ids... need to investigate further. Only causes a single test to fail so must be subtle. Diffing between the bad/good versions reveals a few lines of generated SMT go missing when the gensym counter is reset.