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.Instruction

Contents

Synopsis

the instruction set type

data Inst Source

the instruction definition.

You can create instructions as you like :-)

Operand order is Intel, ARM, MIPS, PowerPC,... order. (opcode dst src1 src2)

Constructors

NOP

no operation

HALT

halt (stop the processor)

MOVI GReg Int

GReg <- Int

MOV GReg GReg

GReg <- GReg

MOVPC GReg

GReg <- PC

ADD GReg GReg GReg

GReg <- GReg + GReg

SUB GReg GReg GReg

GReg <- GReg - GReg

CMP GReg GReg

Flag <- compare(GReg, GReg)

ABS GReg GReg

GReg <- abs(GReg)

ASH GReg GReg GReg

GReg <- GReg << GReg // arithmetic shift

MUL GReg GReg GReg

GReg <- GReg * GReg

DIV GReg GReg GReg

GReg <- GReg / GReg

AND GReg GReg GReg

GReg <- GReg & GReg

OR GReg GReg GReg

GReg <- GReg | GReg

NOT GReg GReg

GReg <- ~GReg

XOR GReg GReg GReg

GReg <- GReg ^ GReg

LSH GReg GReg GReg

GReg <- GReg << GReg // logical shift

BRI FCond Int

if (FCond(Flag)) goto (PC + Int) // pc relative addressing

JRI Int

goto (PC + Int) // pc relative addressing

J GReg

goto GReg // absolute addressing

CALL GReg

goto GReg; R0 <- PC // absolute addressing

RET

goto R0

LD GReg GReg

GReg <- memory(GReg)

ST GReg GReg

memory(GReg) <- GReg

UNDEF

undefined

Instances

data GReg Source

the general purpose registers.

You can create registers as you like :-)

Constructors

R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 

data FCond Source

the Flag conditions

Constructors

FCEQ

equal

FCNE

not equal

FCLT

little than

FCLE

little equal

FCGT

greater than

FCGE

greater equal

Instances