summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-02-16Can now compile aarch64/duopod to CAlasdair Armstrong
Goes through the C compiler without any errors, but as we still don't have all the requisite builtins it won't actually produce an executable. There are still a few things that don't work properly, such as vectors of non-bit types - but once those are fixed and the Sail library is implemented fully it should work.
2018-02-15Rebase state monad onto prompt monadThomas Bauereiss
Generate only one Lem model based on the prompt monad (instead of two models with different monads), and add a lifting from prompt to state monad. Add some Isabelle lemmas about the monad lifting. Also drop the "_embed" and "_sequential" suffixes from names of generated files.
2018-02-15Re-engineer prompt monad of Lem shallow embeddingThomas Bauereiss
- Use simplified monad type (e.g., without the with_aux constructors that are not needed by the shallow embedding). - Add support for registers with arbitrary types (e.g., records, enumerations, vectors of vectors). Instead of using bit lists as the common representation of register values at the monad interface, use a register_value type that is generated per spec as a union of all register types that occur in the spec. Conversion functions between register_value and concrete types are generated. - Use the same representation of register references as the state monad, in preparation of rebasing the state monad onto the prompt monad. - Split out those types from sail_impl_base.lem that are used by the shallow embedding into a new module sail_instr_kinds.lem, and import that. Removing the dependency on Sail_impl_base from the shallow embedding avoids name clashes between the different monad types. Not yet done: - Support for reading/writing register slices. Currently, a rewriting pass pushes register slices in l-expressions to the right-hand side, turning a write to a register slice into a read-modify-write. For interfacing with the concurreny model, we will want to be more precise than that (in particular since some specs represent register files as big single registers containing a vector of bitvectors). - Lemmas about the conversion functions to/from register_value should be generated automatically.
2018-02-15C backend can now handle record literals and record update syntax correctlyAlasdair Armstrong
2018-02-15Update duopod spec so it has no address translationAlasdair Armstrong
Also update the main aarch64 (no_vector) spec with latest asl_parser
2018-02-15List support in C backendAlasdair Armstrong
2018-02-14Another mono rewrite for aarch64Brian Campbell
2018-02-14Support monorphisation analysis of bitvectors inside existentialsBrian Campbell
2018-02-14Pick up more equivalent type variables in monomorphisationBrian Campbell
2018-02-14Handle simple returns in constant propagationBrian Campbell
Useful for feature functions, e.g. HaveFP16Ext
2018-02-13Support for large bitvector literals in C backendAlasdair Armstrong
2018-02-13Try to replace generated kids with user-defined ones from the environmentThomas Bauereiss
Solves a problem where generated kids crept into type annotations during rewriting and caused later typechecking passes to fail.
2018-02-13Some support in mono for extra fresh tyvars generated in the typecheckerBrian Campbell
(still some work to do in AtomToItself rewrite, but should work despite error messages)
2018-02-12Add support for top-level letbindings to C backendAlasdair Armstrong
2018-02-09Improve IR pretty-printing for debuggingAlasdair Armstrong
2018-02-09Formalize C backend intermediate representation in OttAlasdair Armstrong
Describes precisely the intermediate representation used in the C backend in an ott grammar, and also removes several C-isms where raw C code was inserted into the IR, so in theory this IR could be interpreted by a small VM/interpreter or compiled to LLVM bytecode etc. Currently the I_raw constructor for inserting C code is just used for inserting GCC attributes, so it can safely be ignored. Also augment and refactor the instruction type with an aux constructor so location information can be propagated down to this level.
2018-02-08Can now generate control flow graphs with C backendAlasdair Armstrong
Option -ddump_flow_graphs when used with -c will create graphviz files for each function in the specification with control and data dependencies shown.
2018-02-08work in progress mips sail2 port.Robert Norton
2018-02-08Some perl for automating some of sail->sail2 porting. Does not even attempt ↵Robert Norton
to get everything right but does manage some of the simpler and more tedious stuff. Health warning: may cause bleeding of eyes.
2018-02-08Add (most of) the bitvector cast insertion transformationBrian Campbell
to help Lem go from a general type `bits('n)` to a specific type `bits(16)` at a case split, and the other way around for a returned value. Doesn't handle function clause patterns yet
2018-02-07Setup test suite for C backendAlasdair Armstrong
2018-02-07Remove warnings during re-writingAlasdair Armstrong
Turn of warnings so we don't get warnings for generated code, this fixes the false-positive warnings in the riscv test suite. Also use basename in test/riscv/run_tests.sh to not print long paths
2018-02-07Have exceptions working in C backendAlasdair Armstrong
2018-02-07Add some printing functions to Lem shallow embeddingThomas Bauereiss
2018-02-06Fixed some bugs in the RVC spec; the rvc test now passes.Prashanth Mundkur
- fixed mapping of cregs to regs - fixed interpretation of NOP - fixed sign-extension for C.LW - added C.LD - fixed cut-paste errors in C.XOR, C.AND - fixed interpretations of C.ADDW, C.SUBW - fixed decode of C.LDSP
2018-02-06Add a system initialization function. For now, it merely initializes ↵Prashanth Mundkur
support for RVC in the misa.
2018-02-06Compile union types in C backendAlasdair Armstrong
2018-02-06Fix lexer so operators cannot start with /* or //Alasdair Armstrong
2018-02-06immediate for CIncOffsetImmediate must be treated as signed (fixes ↵Robert Norton
test_cp2_rep_underflow).
2018-02-06fix backwards arguments to pow2.Robert Norton
2018-02-06some prettyfying of riscv: replace regbits/bits(64) with xlenbits and use ↵Robert Norton
overloaded accessor functions for X registers.
2018-02-06Add remaining RVC instructions.Prashanth Mundkur
2018-02-06Make small change to improve readability of riscv duopodAlasdair Armstrong
2018-02-06Work on handling exceptions in C backendAlasdair Armstrong
2018-02-06note existence of sail2 in READMEPeter Sewell
2018-02-06Add aux constructor to type patterns for consistencyAlasdair Armstrong
2018-02-06Improve destructuring existential typesAlasdair Armstrong
Make destructuring existentials less arcane by allowing them to be destructured via type patterns (typ_pat in ast.ml). This allows the following code for example: val mk_square : unit -> {'n 'm, 'n = 'm. vector('n, dec, vector('m, dec, bit))} function test (() : unit) -> unit = { let matrix as vector('width, _, 'height) = mk_square (); _prove(constraint('width = 'height)); () } where 'width we become 'n from mk_square, and 'height becomes 'm. The old syntax let vector as 'length = ... or even let 'vector = ... still works under this new scheme in a uniform way, so this is backwards compatible The way this works is when a kind identifier in a type pattern is bound against a type, e.g. 'height being bound against vector('m, dec, bit) in the example, then we get a constraint that 'height is equal to the first and only n-expression in the type, in this case 'm. If the type has two or more n-expressions (or zero) then this is a type error.
2018-02-05Merge changes to type_check.mlAlasdair Armstrong
2018-02-05Add typ patterns for destructuring existentialsAlasdair Armstrong
2018-02-05Allow type variables to be introduced by global let bindings.Alasdair Armstrong
This was technically allowed previously but the rules for type variable names in function types were too strict so it didn't work. Also fixed a bug where Nexp_app constructors were never considered identical and fixed a bug where top-level let bindings got annotated with the wrong environment
2018-02-05riscv: slightly prettier register trace outputRobert Norton
2018-02-05squash a warning.Robert Norton
2018-02-02Added remaining compressed instructions in Quadrant 0 and 1, Quadrant 2 remains.Prashanth Mundkur
2018-02-02Add M extension to RISCV. Slightly inelegant implementation for now but ↵Robert Norton
passing tests.
2018-02-02Extra nexp simplificationBrian Campbell
2018-02-02Add arithmetic shift right for aarch64 monoBrian Campbell
2018-02-02Move exp_lift_assign rewrite after fixing effects and retypecheckingBrian Campbell
2018-02-02When cutting functions short at assertions, put an exit to correct typesBrian Campbell
if necessary
2018-02-02Also rewrite boolean terms in asserts during monomorphisationBrian Campbell
(otherwise wildcard cases won't be cut short at the assertion)
2018-02-02Add aarch64 duopod...Alasdair Armstrong
... all 4500 lines of it. Need to figure out how to cut out some details to make more minimal.