processor-creative-kit-0.1.0.1: a creation kit for instruction sets and cpu simulators and development tools

Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Pck.Cpu.Execution

Contents

Synopsis

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)