Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Run the processor
run :: InstImage -> DataImage -> CpuState Source
run the processor
Example: simple run
> run [(0, [MOVI R0 20, HALT])] [] pc : 1 gr : [20,0,0,0,0,0,0,0] fl : [False,False] ...
Example: run with initial data
> run [(0, [MOVI R1 0, LD R0 R1, HALT])] [(0,[100])] pc : 2 gr : [100,0,0,0,0,0,0,0] fl : [False,False] ...
evalProg :: Bool -> EvalCpu ResultStat Source
evaluate a program
run :: InstImage -> DataImage -> CpuState run insts vals = execState (evalProg False) (initCpuStateMem insts vals)