diff options
author | Camil Staps | 2016-07-05 17:25:10 +0200 |
---|---|---|
committer | Camil Staps | 2016-07-05 17:25:10 +0200 |
commit | ceb0b74bd0b368124679378ebfb2cf316deb2e39 (patch) | |
tree | 7f5c562952bcf0427d838274177123765fe93cf5 /ABC/Machine/Driver.icl | |
parent | ProgramStore as array for efficiency (diff) |
Added Machine as module level
Diffstat (limited to 'ABC/Machine/Driver.icl')
-rw-r--r-- | ABC/Machine/Driver.icl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ABC/Machine/Driver.icl b/ABC/Machine/Driver.icl new file mode 100644 index 0000000..29b42ca --- /dev/null +++ b/ABC/Machine/Driver.icl @@ -0,0 +1,25 @@ +implementation module ABC.Machine.Driver + +import StdEnv + +import ABC.Machine + +boot :: ([Instruction], [Desc]) -> State +boot (prog,descs) + = { astack = as_init + , bstack = bs_init + , cstack = cs_init + , graphstore = gs_init + , descstore = ds_init descs + , pc = pc_init + , program = ps_init prog + , io = io_init + } + +fetch_cycle :: State -> State +fetch_cycle st=:{pc,program} +| pc_end pc = st +| otherwise = fetch_cycle (currinstr {st & pc=pc`}) +where + pc` = pc_next pc + currinstr = ps_get pc program |