MIPS CPU models: several in one build, each instantiated from the one description.
(defmacro defmipsmodel) source(defmacro defmipsmodel (name &rest props)
"define model NAME (a symbol): the ISA NAME and its PROPS (a plist: :doc,
:level the MIPS ISA level, :xlen the GPR width 32 or 64, :features ...)"
(let ((key (intern (symbol-name name) :keyword)))
`(progn
(eval-when (:compile-toplevel :load-toplevel :execute)
(setq *mips-models* (cons (cons ,key ',props) (remove ,key *mips-models* :key #'car))))
(defisa ,name :width 32 :endian :little :state mips :doc ,(getf props :doc))
',name)))(defmacro defmipsmacro) source(defmacro defmipsmacro (name lambda-list &body body)
"a helper resolved per model (see the header); used outside a model it is an error"
`(progn
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf (gethash ',name *mips-macros*)
(lambda (args) (destructuring-bind ,lambda-list args ,@body))))
(defmacro ,name (&rest args)
(declare (ignore args))
(error "~S depends on the MIPS model: use it in DEFMIPS, WITH-MIPS-MODEL or a DEFMIPSMACRO" ',name))))(defmacro mips-model-case) source(defmacro mips-model-case (&rest clauses)
(declare (ignore clauses))
(error "MIPS-MODEL-CASE outside DEFMIPS / WITH-MIPS-MODEL"))(defmacro mips-feature-case) source(defmacro mips-feature-case (&rest clauses)
(declare (ignore clauses))
(error "MIPS-FEATURE-CASE outside DEFMIPS / WITH-MIPS-MODEL"))(defmacro mips-model-value) source(defmacro mips-model-value (key)
(declare (ignore key))
(error "MIPS-MODEL-VALUE outside DEFMIPS / WITH-MIPS-MODEL"))(defmacro with-mips-model) source(defmacro with-mips-model ((m) &body body)
"BODY resolved for model M (a keyword)"
`(progn ,@(mips-resolve body m)))Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.