(include "simplify.inc") (define-arch (name foo) ; name of cpu family (comment "") (default-alignment aligned) (insn-lsb0? #f) (machs foo) (isas foo) ) (define-isa (name foo) ; The default size of an instruction in bits (default-insn-bitsize 16) (base-insn-bitsize 16) (default-insn-word-bitsize 16) ) (define-cpu (name foo) (comment "") (endian either) (word-bitsize 16) ; Generated files have an "f" suffix. (file-transform "f") ) (define-mach (name foo) (comment "") (cpu foo) ) (dnf f-a "op a" () 0 4) (dnf f-b "op a" () 4 4) (dnf f-c "op a" () 8 4) (dnf f-d "op a" () 12 4) (dnmf f-ac "op ac" () UINT (f-a f-c) (sequence () ; insert (set (ifield f-c) (and (ifield f-ac) (const 15))) (set (ifield f-a) (srl (ifield f-ac) (const 4))) ) (sequence () ; extract (set (ifield f-ac) (or (ifield f-c) (sll (ifield f-a) 4))) ) ) (define-pmacro (dni xname xcomment xsyntax xformat xattrs xsemantics) (define-insn (name xname) (comment xcomment) (.splice attrs (.unsplice xattrs)) (syntax xsyntax) (format xformat) (semantics xsemantics) ) ) (dnh h-pc "program counter" (PC PROFILE) (pc) () () ()) (dni swi "" "swi" (+ (f-ac 18) (f-b 3) (f-d 4)) () (sequence () (set pc (c-call SI "foo_trap" pc 0))) )