summaryrefslogtreecommitdiff
path: root/src/test/power.sail
diff options
context:
space:
mode:
authorGabriel Kerneis2014-04-04 11:14:25 +0100
committerGabriel Kerneis2014-04-04 11:14:25 +0100
commit78703f987512fbc90ccccea4b813f24fe0ccd49a (patch)
treedbfbf4fb49793db6d495cb1098b7b25b113fb948 /src/test/power.sail
parent6211671cf52fb51aafe46438ba408d3e3e009734 (diff)
Improve Power execution
- Move FDE loop to the OCaml side of the Power model (avoid leaking memory due to lack of TCO in interpreter) - Display cycle count - Check the value of CIA at the end of each cycle and stop if it is equal to the initial value of LR, returning the value in GPR3.
Diffstat (limited to 'src/test/power.sail')
-rw-r--r--src/test/power.sail31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/test/power.sail b/src/test/power.sail
index e75e24ef..9cf49dc3 100644
--- a/src/test/power.sail
+++ b/src/test/power.sail
@@ -186,37 +186,10 @@ end ast
register ast instr (* monitor decoded instructions *)
-(* fetch-decode-execute loop *)
-function rec unit fde_loop () = {
+(* fetch-decode-execute cycle *)
+function unit cycle () = {
NIA := CIA + 4;
instr := decode(MEM(CIA, 4));
execute(instr);
CIA := NIA;
- fde_loop ()
-}
-
-function unit init() = {
- (* CIA is initialiazed externally, as well as MEM *)
-
- (* initial stack-pointer. stack grows downwards, the first step is to
- decrement it which should (hopefully) wrap around to the largest
- possible 64-bit value *)
- GPR1 := 0;
- (* initial value of environment pointer - no clue what it is used for,
- only saved in restore in our simple example. *)
- GPR31 := 0;
-
- (* unused in practice, but must be set for bclr computation *)
- CTR := 0;
- CR := 0;
- (* return address -- I have no idea what to put there, let's make an
- infinite loop! *)
- LR := CIA;
-
-
-}
-
-function unit main () = {
- init();
- fde_loop();
}