summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-04-29Add progress reporting to monomorphisationThomas Bauereiss
2020-04-21Fix build with OCaml 4.06.1Thomas Bauereiss
2020-04-21Lem: Print more type annotationsThomas Bauereiss
In particular tuple types containing bitvectors.
2020-04-21Add more SMT builtinsThomas Bauereiss
Also add support for intialising variables with an "undefined" literal; make the SMT solver treat the value as arbitrary but fixed.
2020-04-21Add more monomorphisation rewritesThomas Bauereiss
Supporting more ASL idioms
2020-04-21Take kid synonyms into account when propagating constantsThomas Bauereiss
For example, in let datasize = e in ... the typechecker will generate a kid '_datasize if e has an existential type (with one kid), and in let 'datasize = e in ... the typechecker will bind both 'datasize and '_datasize. If we substitute one as part of constant propagation, this patch will make constant propagation also substitute the other.
2020-04-21Mono: Check for non-constant calls to make_the_valueThomas Bauereiss
... and try to resolve them using constant propagation.
2020-04-21Mono: Extract more kid instantiations from assertionsThomas Bauereiss
Ask the type checker instead of looking at the expression syntax. This also discovers implied instantiations, e.g. if we previously knew ('N in {32, 64}) and we have an assertion ('N != 32), then we know ('N == 64).
2020-04-21Mono: Propagate constants after applying pattern choicesThomas Bauereiss
This will propagate constant assignments in chosen branches of case expressions after applying pattern choices, e.g. the assignment to datasize in match size { [bitone, _] => datasize = 64, ... } when pattern [bitone, _] is chosen for size.
2020-04-21Add rewrite for constant-folding top-level letbindingsThomas Bauereiss
This will constant-fold letbindings such as let LOG2_TAG_GRANULE : int(4) = 4 let TAG_GRANULE : int = (1 << LOG2_TAG_GRANULE) which is useful for the translation to Lem if TAG_GRANULE is used in bitvector lengths.
2020-04-21Various monomorphisation fixesThomas Bauereiss
- Handle more combinations of patterns and expressions in constant propagation - Remove dead code after throw() in monomorphisation - Use correct val specs and environments when analysing and pretty-printing function clauses
2020-04-21Consider literals in pattern disjointness checkThomas Bauereiss
This check is used in the guarded pattern rewrite step, which would previously generate some impossible matches (e.g. matching expression "true" against pattern "false").
2020-04-21Mono: Extract set constraints from (in)equalitiesThomas Bauereiss
2020-04-21Handle more cases in bitvector cast rewriteThomas Bauereiss
Add casts for function arguments using the constraints in the environment of the function clause (not just assertions within the function body). Also pass in the global typing environment for comparison with the environment within the function clause (and make a corresponding change in the Lem pretty-printer so that it uses the right environments).
2020-04-21Add support for some ASL idioms in mono rewritesThomas Bauereiss
2020-04-21Tweak types of loop combinators for prover combinatorsThomas Bauereiss
Split the variable (tuple) type into an input and output type. They are meant to be the same, but due to the way function types are instantiated, unification can fail in the case of existential types, as in the added test case (when trying to generate Lem definitions from it). The output of the loop will be checked against the expected type, though, due to a type annotation outside the loop added by the rewrite pass for variable updates.
2020-04-21Save SMT cache when terminating with an exceptionThomas Bauereiss
2020-04-21Add more mono rewrites for bitvector subrangesThomas Bauereiss
2020-04-21Rewrite vector concat lexps to sequences of assignmentsThomas Bauereiss
... instead of a tuple assignment. This makes the rewrite independent of the tuple assignment rewrite and allows it to be moved after the latter (nesting vector concat lexps into tuple lexps is an idiom in ASL, but the other way around doesn't make sense).
2020-04-21Be more careful about type annotations in rewrites to LemThomas Bauereiss
In particular, don't add annotations for types with existentially quantified variables that only occur in constraints, not in the type, e.g. {'i1 'i2, 'i1 == div('i2, 8). int('i1)}. These seem to confuse the type checker when pulled out into the source AST.
2020-04-10Check more types in monomorphisation rewritesThomas Bauereiss
In the new version of the ASL-generated Sail, some vector operators are also overloaded for integers to match idioms of ASL (e.g. i[31:0], where i is an integer), so check in the monomorphisation rewrites that we use bitvector helper functions only for actual bitvectors.
2020-04-10Allow empty Sail source filesThomas Bauereiss
... instead of dying with "Syntax error".
2020-04-10Add Lem builtins for operations on realsThomas Bauereiss
... that match the names in lib/real.sail. Also fix the lem mapping for abs_int_atom and a Lem syntax error with nested record updates.
2020-04-10Make bounds check for vector subrange assignments stricterThomas Bauereiss
Check that indices are within bounds, not just in the right (increasing/decreasing) order.
2020-04-10Implement hex_str for LemThomas Bauereiss
2020-04-10Be more careful when flow-typing loopsThomas Bauereiss
Asserting constraints from the loop condition in the body is fine for while-loops, but doesn't make sense for until-loops.
2020-04-01Report SMT solver stderr on unexpected return codeBrian Campbell
2020-03-29Implement set_slice_int in the interpreterAlasdair
2020-03-25Fix a typo in write_mem for the interpreterAlasdair
2020-03-19Improve a particularly unhelpful type errorAlasdair
From: No type variable 'ex14# to: Type error: [../and_let_bool.sail]:6:19-50 6 | and_bool(let y : bool = x in not_bool(y), x) | ^-----------------------------^ | The type variable 'ex14# would leak into an outer scope. | | Try adding a type annotation to this expression. | This error was caused by: | [../and_let_bool.sail]:6:23-24 | 6 | and_bool(let y : bool = x in not_bool(y), x) | | ^ | | Type variable 'ex14# was introduced here |
2020-03-18Expose details of failed lexp bounds checksThomas Bauereiss
Allows ASL-to-Sail translation to automatically patch lexp bounds check errors.
2020-03-13SMT fixes for some corner cases of vector updatesThomas Bauereiss
2020-03-02Fix jenkinsAlasdair Armstrong
2020-03-02Add arith_shiftr to SMT and interpreterThomas Bauereiss
2020-02-25Implement count_leading_zeros for interpreterThomas Bauereiss
2020-02-24Avoid generating assertions multiple times during typecheckingThomas Bauereiss
2020-02-21Make sure we test that struct literals have a complete set of fields. Fixes #60Alasdair Armstrong
2020-02-21Distinguish type identifiers in topological sortingThomas Bauereiss
Fixes #61
2020-02-21Fix bug in last patch to topological sorting (e5ee087f)Thomas Bauereiss
2020-02-21SMT: Implement a few more primopsThomas Bauereiss
2020-02-21Nl_flow: Consider early returnsThomas Bauereiss
Tells the typechecker that, for example, in a block after if (i < 0) then { return (); } else { ... } the constraint not(i < 0) holds. This is a useful pattern when type-checking code generated from ASL.
2020-02-21Move topological sorting code to graph.mlThomas Bauereiss
2020-02-20More list C codegen fixes for issue #59Alasdair Armstrong
2020-02-20Fix missing code generation builtins for lists. Fixes #59Alasdair Armstrong
Also uncovered a few other issues w.r.t lists
2020-02-06Make sure tdiv_int and tmod_int are recognised by sail -iAlasdair Armstrong
2020-01-31Fix soundness bug found by MarkAlasdair
When returning a type from a letbinding we need to be careful that the type it returns does not refer to any type variable that only exists for the lifetime of the letbinding (because it was bound by it). Normally this fails because any type variable bound in the inner letbinding won't exist in the outer scope, but if it is shadowed this can cause an issue.
2020-01-30Make sure external pprint is listed as a dependency for sail when used as an ↵Alasdair Armstrong
OCaml library
2020-01-28Use external PPrintThomas Bauereiss
2020-01-28Fix a bug with lexp->exp conversion for register referencesAlasdair
2020-01-22Preserve effect annotation when realising mappingsThomas Bauereiss