summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-06-04Fix an issue with riscv_platform involving flow typingAlasdair Armstrong
- Refactor the flow typing implementation in the type-checker. This should fix an issue involving riscv_platform. Specifically it should now work better when an if statement contains multiple conditions combined with and/or, only some of which imply constraints at the type level. This change also simplifies the implementation of flow typing, and removes some obscure features that were hardly used - specifically, flow typing could modify types, but this was fairly obscure and doesn't seem to affect any of our specifications. More testing is needed to ensure that this change hasn't inadvertantly broken anything, but it does pass all our tests and continue to typecheck arm, riscv and cheri. - Also adds a option for generating faster undefined functions for enum and variant types. Previously I tried to optimise away such functions in the C backend, because they could be slow and cause considerable uneccessary allocation, however this was error prone and it turns out a much simpler solution is to simply make the functions themselves much faster, at the cost of hard-coding certain decisions about what undefined means for these types at compile tile (which is fine for fast emulation). This almost doubles the performance of the generated C code. - Add a wrapper for right shift to avoid UB when shifting by 64 or more places.
2018-06-04Fix bug with function return types in C backendAlasdair Armstrong
2018-06-04switch to using a Map data structure for cheri tags in ocaml backend. This ↵Robert Norton
solves a problem where the Hashtbl module was encountering a stack overflow booting CheriBSD. There seems to be little or no performance impact.
2018-06-04Use Util.split_on_char in sail_lib.mlAlasdair Armstrong
2018-05-31Fix for Jenkins buildAlasdair Armstrong
Looks like Jenkins is still on OCaml 4.02.3. We should probably upgrade to 4.05 at some point.
2018-05-31Fixes to get ARM u-boot working in Sail.Alasdair Armstrong
Also fixes to C backend for compiling MIPS spec to C - Fix an issue with const correctness in internal_vector_update functions generated by C backend - Add builtins for MIPS to sail.h - Fix an issue where reg_deref didn't work when called on pointers to large bitvectors, i.e. vectors containing references to large bitfields as in the MIPS TLB code - Various bug fixes and changes for running U-boot on ARM model, including for interpreter and OCaml compilation. - Fix memory leak issues and incorrect shadowing for foreach loops - Update C header file. Fixes memory leak in memory read/write builtins. - Add aux constructor to ANF representation to hold environment information. - Fix undefined behavior caused by optimisation left shifting uint64_t vectors 64 or more times. Unfortunately there's more issues because the same happens for X >> 64 right shifts. It would make sense for this to be zero, because that would guarantee the property that ((X >> n) >> m) == (X >> (n + m)) but we probably need to do (X >> (n - 1) >> 1) in the optimisation to ensure that we don't cause UB. Shifting by 63 and then by 1 is well-defined, but shifting by 64 in one go isn't according to the C standard. This issue with right-shifts only occurs for zero-length vectors, so it's not a huge deal, but it's still annoying. - Add versions of print_bits and print_int that print to stderr. Follows OCaml convention of print/prerr. Should make things more explicit. Different backends had different ideas about where print should output to, not every backend needs to have this (e.g. theorem prover backends don't need to print) but having both stderr and stdout seperate and clear is useful for executable models (UART needs to be stdout, debug messages should be stderr).
2018-05-31Some tweaks to ocaml compilation and sail_lib for ARM with system registersAlasdair Armstrong
2018-05-28Coq: merge some implicit variables from axioms with argumentsBrian Campbell
(Similar to the proper translation for function definitions)
2018-05-28Coq: prefer simple binders over patternsBrian Campbell
Otherwise it has occasional problems working out the return type
2018-05-28Coq: add option to produce axioms for unimplemented functionsBrian Campbell
Useful for partial test cases (e.g., some of the typechecking tests) Also a bonus warning for such functions in normal use
2018-05-28Coq: proper printing of nexpsBrian Campbell
2018-05-25Use paged memory storage for ocaml backend memory. This is slightly slower ↵Robert Norton
(<5% on a simple test) but dramatically reduces memory usage compared to having a hash table entry per byte!
2018-05-24Revert "Allow instantiation of type or order type variables without kind ↵Brian Campbell
declaration" This reverts commit 895f868cd537277ba61dfc427fee0e288af7e226. These are actually treated as Ints (although you could pretend they weren't and it mostly worked).
2018-05-24Check kinds of type variables while checking well-formedness of typesBrian Campbell
Stops (e.g.) an Int being used as a Type, including when no kind was declared. The following commit will remove the test for the latter case.
2018-05-24Coq: need None special case here, tooBrian Campbell
2018-05-24Coq: record conditionals in the context for constraint solvingBrian Campbell
2018-05-23Coq: Implement the most basic merging of type- and term-level parametersBrian Campbell
2018-05-22Fix one part of cast introduction, leave another for laterBrian Campbell
2018-05-22Fix for E_cons not being compiled correctly into OCamlAlasdair Armstrong
2018-05-21Add an -ocaml-nobuild option to avoid building the generated ocaml by ↵Prashanth Mundkur
default (off by default).
2018-05-18Make named theorem collections of state monad more fine-grainedThomas Bauereiss
2018-05-18Fix bug in rewriting variable updatesThomas Bauereiss
2018-05-18Avoid split_on_char function that was introduced in OCaml 4.04. Use Util ↵Robert Norton
version instead and make sure to install util and copy it to ocaml build directory.
2018-05-17changes to for testing FreeBSD boot on MIPS: allowing loading raw file in ↵Robert Norton
ocaml main so that we can have simboot + kernel. Support UART output only.
2018-05-17Merge branch 'cheri-mono' into sail2Brian Campbell
2018-05-17Remove sequential code againBrian Campbell
2018-05-17Use an intermediate base_monad type alias in Lem,Brian Campbell
resolving the difference in type parameters between the prompt and state monads, and allowing a single output file to be used with either. Normally, the type alias is to the prompt monad, but for HOL4 we use the state monad.
2018-05-16Declare hol automatic termination in sail_valuesRamana Kumar
2018-05-12Fix bug in handling of registers with option typeThomas Bauereiss
Also add test cases and Isabelle lemmas
2018-05-11More builtin names in constant propagationBrian Campbell
2018-05-11Make nexp simplification a little smarterBrian Campbell
(should really make the Lem pretty printer use the solver properly, but this is a useful stopgap)
2018-05-11Actually use the correct type for singleton rewriting this timeBrian Campbell
2018-05-11Be much more careful to introduce the right bitvector casts to the right sizesBrian Campbell
2018-05-11Handle automatic existential unpacking in function application in mono analysisBrian Campbell
2018-05-11Use type from funcl in singleton rewritingBrian Campbell
The pattern types may be subtypes, using those caused it to try rewriting int parameters and failing
2018-05-11Add Boolean short-circuiting to state monadThomas Bauereiss
2018-05-11Merge branch 'sail2' into cheri-monoThomas Bauereiss
In order to use up-to-date sequential CHERI model for test suite
2018-05-11Remove buggy bit list comparison functions from Lem libraryThomas Bauereiss
Found bugs by running CHERI test suite on Isabelle-exported model: signed less-than for bit lists was missing negations for the two's complement, and unsigned less-than compared the reverse lists. Since all other backends implement this in Sail, it seems best to just remove this code. Also add support for infix operators to Lem backend, by z-encoding their identifiers like the other backends do.
2018-05-11Remove unneeded _sail suffix from latex files.Robert Norton
2018-05-11Avoid generating latex files that differ only by case because this causes ↵Robert Norton
confusion on case insensitive file systems (e.g. mac).
2018-05-10latex: don't include the prefix in the label. This means we have the option ↵Robert Norton
of omitting valspec in documentation if it is deemed too verbose and still have hyperlinks work. The caveat is that it could result in multiply defined labels.
2018-05-09Add language=sail option in listings command for latex output. This helps ↵Robert Norton
with documents containing listings in multiple languages.
2018-05-09Fix an issue with C compilationAlasdair Armstrong
2018-05-09Fix printing of hex strings in LemThomas Bauereiss
2018-05-09Add tests for Isabelle->OCaml generation for CHERI and AArch64Thomas Bauereiss
2018-05-09Add more annotations for loop bounds in Lem rewritingThomas Bauereiss
Typechecking for-loops failed after the Lem rewriting passes in some cases: if the lower bound for the loop may be greater than the upper bound, the loop variable's type might be empty, and it cannot be initialised. This patch adds a guard "lower <= upper" around the loop body, and removes it again during pretty-printing.
2018-05-09Run ARM built-in tests for Lem backend (via OCaml)Thomas Bauereiss
2018-05-09Support short-circuiting of Boolean expressions in LemThomas Bauereiss
2018-05-09Generate initial register state recordThomas Bauereiss
Filled with default values (e.g., 0) and used to initialise the state monad. There is already code to generate a Sail function "initialize_registers", but this is monadic itself, so it cannot be used to initialise the monad.
2018-05-09Fix Byte_sequence errors due to linksem updateemersion