From a5bc362fca3d8a7c6d49b35dcf0b63440d23303c Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 26 Jun 2018 14:44:27 +0100 Subject: Add configuration registers so __SetConfig ASL can be translated Registers can now be marked as configuration registers, for example: register configuration CFG_RVBAR = 0x1300000 They work like ordinary registers except they can only be set by functions with the 'configuration' effect and have no effect when read. They also have an initialiser, like a let-binding. Internally there is a new reg_dec constructor DEC_config. They are intended to represent configuration parameters for the model, which can change between runs, but don't change during execution. Currently they'll only work when compiled to C. Internally registers can now have custom effects for reads and writes rather than just rreg and wreg, so the type signatures of Env.add_register and Env.get_register have changed, as well as the Register lvar, so in the type checker we now write: Env.add_register id read_effect write_effect typ rather than Env.add_register id typ For the corresponding change to ASL parser there's a function is_config in asl_to_sail.ml which controls what becomes a configuration register for ARM. Some things we have to keep as let-bindings because Sail can't handle them changing at runtime - e.g. the length of vectors in other top-level definitions. Luckily __SetConfig doesn't (yet) try to change those options. Together these changes allow us to translate the ASL __SetConfig function, which means we should get command-line option compatibility with ArchEx for running the ARM conformance tests. --- src/parse_ast.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 2848edc0..26cb9df7 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -98,7 +98,7 @@ base_effect_aux = (* effect *) | BE_unspec (* unspecified values *) | BE_nondet (* nondeterminism from intra-instruction parallelism *) | BE_escape - + | BE_config type kid_aux = (* identifiers with kind, ticked to differntiate from program variables *) @@ -496,6 +496,7 @@ kind_def_aux = (* Definition body for elements of kind; many are shorthands for type dec_spec_aux = (* Register declarations *) DEC_reg of atyp * id + | DEC_config of id * atyp * exp | DEC_alias of id * exp | DEC_typ_alias of atyp * id * exp -- cgit v1.2.3