; Simple 8 Bit Processor -*- Scheme -*- (include "simplify.inc") ; FIXME: Delete sign extension of accumulator results. ; Sign extension is done when accumulator is read. ; define-arch must appear first (define-arch (name proc) ; name of cpu family (comment "8 Bit Processor") (insn-lsb0? #f) (machs proc) (isas proc) ) (define-isa (name proc) (default-insn-bitsize 8) (base-insn-bitsize 8) (default-insn-word-bitsize 8) ) (define-cpu (name proc) (comment "8 Bit Processor Family") (endian big) (word-bitsize 8) ) (define-mach (name proc) (comment "8 Bit FPGA Processor") (cpu proc) ) (define-model (name proc) (comment "8 Bit Processor Model") (attrs) (mach proc) (unit u-exec "Execution Unit" () 1 1 () () () ()) ) (dnf f-op "op" () 0 8) (dnf f-uimm8 "unsigned 8 bit immediate" () 8 8) (dnf f-uimm16 "unsigned 16 bit immediate" () 8 16) (define-normal-insn-enum insn-op "insn format enums" () OP_ f-op (.map .str (.iota 256)) ) (dnh h-pc "program counter" (PC PROFILE) (pc) () () ()) (define-hardware (name h-accu) (comment "Accumulator") (attrs PROFILE );CACHE-ADDR) (type register DI ) ) (define-attr (for operand) (type boolean) (name HASH-PREFIX) (comment "immediates have an optional '#' prefix") ) (dnop accu "accumulator" () h-accu f-nil) (dnop uimm8 "unsigned 8 bit immediate" () h-uint f-uimm8) (dnop uimm16 "unsigned 16 bit immediate" () h-uint f-uimm16) (dni nop "nop" () "nop" (+ OP_0) (nop) () ) (dni lda "lda" () "lda $uimm16" (+ OP_1 uimm16) (set accu (mem WI uimm16)) () ) (dni ldc "ldc" () "ldc $uimm8" (+ OP_2 uimm8) (set accu uimm8) () ) (dni decx "decx" () "decx" (+ OP_100) (nop) () ) (dni decy "decy" () "decy" (+ OP_101) (nop) () )