Basic constructor macro for instr-branch structures.
(make-instr-branch [:funct <funct>] [:rs1 <rs1>] [:rs2 <rs2>] [:imm <imm>])
This is the usual way to construct instr-branch structures. It simply conses together a structure with the specified fields.
This macro generates a new instr-branch structure from scratch. See also change-instr-branch, which can "change" an existing structure, instead.
This is an ordinary
Macro:
(defmacro make-instr-branch (&rest args) (std::make-aggregate 'instr-branch args '((:funct) (:rs1) (:rs2) (:imm)) 'make-instr-branch nil))
Function:
(defun instr-branch (funct rs1 rs2 imm) (declare (xargs :guard (and (branch-funct-p funct) (ubyte5p rs1) (ubyte5p rs2) (ubyte12p imm)))) (declare (xargs :guard t)) (let ((__function__ 'instr-branch)) (declare (ignorable __function__)) (b* ((funct (mbe :logic (branch-funct-fix funct) :exec funct)) (rs1 (mbe :logic (ubyte5-fix rs1) :exec rs1)) (rs2 (mbe :logic (ubyte5-fix rs2) :exec rs2)) (imm (mbe :logic (ubyte12-fix imm) :exec imm))) (cons :branch (list funct rs1 rs2 imm)))))