vu: state.lisp

a vector unit's state in micro mode, and a VIF's.

Other definitions

(defstruct vu) source
(defstruct (vu (:conc-name vu-))
  (id 0 :type (unsigned-byte 8))
  (vf (make-array 128 :element-type '(unsigned-byte 32) :initial-element 0)
   :type (simple-array (unsigned-byte 32) (128)))
  (vi (make-array 16 :element-type '(unsigned-byte 16) :initial-element 0)
   :type (simple-array (unsigned-byte 16) (16)))
  (acc (make-array 4 :element-type '(unsigned-byte 32) :initial-element 0)
   :type (simple-array (unsigned-byte 32) (4)))
  (q 0 :type (unsigned-byte 32))
  (preg 0 :type (unsigned-byte 32))   ; P (EFU results); not VU-P, the type predicate
  (i 0 :type (unsigned-byte 32))
  (r #x3F800000 :type (unsigned-byte 32))
  (mac 0 :type (unsigned-byte 32))
  (status 0 :type (unsigned-byte 32))
  (clip 0 :type (unsigned-byte 32))
  (tpc 0 :type (unsigned-byte 32))
  (running 0 :type (unsigned-byte 8))
  ;; a branch's target pending for after its delay slot (pc + 8 when none)
  (npc 0 :type (unsigned-byte 32))
  (micro-base 0 :type (unsigned-byte 32))
  (micro-mask #xFFF :type (unsigned-byte 32))
  (data-base 0 :type (unsigned-byte 32))
  (data-mask #xFFF :type (unsigned-byte 32))
  (steps 0 :type (unsigned-byte 64))
  (programs 0 :type (unsigned-byte 64)))
(defun vu-reset) source
(defun vu-reset (u)
  (declare (type vu u))
  (let ((a (vu-vf u))) (dotimes (i (length a)) (setf (aref a i) 0))) (let ((a (vu-vi u))) (dotimes (i (length a)) (setf (aref a i) 0))) (let ((a (vu-acc u))) (dotimes (i (length a)) (setf (aref a i) 0)))
  (setf (vu-q u) 0 (vu-i u) 0 (vu-r u) #x3F800000 (vu-mac u) 0 (vu-status u) 0 (vu-clip u) 0
        (vu-tpc u) 0 (vu-running u) 0)
  nil)
(defstruct vif) source
(defstruct (vif (:conc-name vif-))
  (id 0 :type (unsigned-byte 8))
  (regs (make-array 32 :element-type '(unsigned-byte 32) :initial-element 0)
   :type (simple-array (unsigned-byte 32) (32)))
  (cmd 0 :type (unsigned-byte 32))          ; the code whose data are being received
  (left 0 :type (unsigned-byte 32))         ; its data words still to come
  (pos 0 :type (unsigned-byte 32))          ; data words received
  (addr 0 :type (unsigned-byte 32))         ; MPG: the next byte of micro memory
  (qacc (make-array 4 :element-type '(unsigned-byte 32) :initial-element 0)
   :type (simple-array (unsigned-byte 32) (4)))  ; DIRECT: a quadword being assembled
  (buf (make-array 1024 :element-type '(unsigned-byte 32) :initial-element 0)
   :type (simple-array (unsigned-byte 32) (1024)))  ; UNPACK's data
  (codes 0 :type (unsigned-byte 64))
  (unpacks 0 :type (unsigned-byte 64))
  (unknown 0 :type (unsigned-byte 32)))
(defun vif-reset) source
(defun vif-reset (v)
  (declare (type vif v))
  (let ((a (vif-regs v))) (dotimes (i (length a)) (setf (aref a i) 0)))
  (setf (vif-left v) 0 (vif-pos v) 0 (vif-cmd v) 0)
  nil)

Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.