• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Riscv
          • Specification
          • Executable
          • Specialized
          • Optimized
            • State-stobj
              • Stat1
              • Stat1-iso
              • Stat1-from-stat
              • Write1-memory-unsigned64
              • Stat-from-stat1
              • Read1-memory-unsigned64
              • Write1-memory-unsigned32
              • Make-stat1
              • Write1-xreg
                • Write1-memory-unsigned8
                • Write1-memory-unsigned16
                • Stat1->memory
                • Read1-memory-unsigned32
                • Read1-instruction
                • Write1-xreg-32
                • Write1-pc
                • Read1-memory-unsigned16
                • Stat1-validp
                • Read1-xreg-unsigned32
                • Read1-xreg-unsigned
                • Read1-xreg-signed32
                • Read1-memory-unsigned8
                • Inc1-4-pc
                • Error1
                • Read1-xreg-signed
                • Read1-pc
                • Errorp1
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • State-stobj

    Write1-xreg

    Signature
    (write1-xreg reg val stat1 feat) → *

    Definitions and Theorems

    Function: write1-xreg

    (defun write1-xreg (reg val stat1 feat)
     (declare (xargs :stobjs (stat1)))
     (declare
        (xargs :non-executable t
               :guard (and (stat1p stat1)
                           (b* ((stat (stat-from-stat1 stat1)))
                             (and (natp reg)
                                  (integerp val)
                                  (statp stat)
                                  (featp feat)
                                  (stat-validp stat feat)
                                  (< (lnfix reg) (feat->xnum feat)))))))
     (prog2$
      (acl2::throw-nonexec-error 'write1-xreg
                                 (list reg val stat1 feat))
      (let ((__function__ 'write1-xreg))
       (declare (ignorable __function__))
       (if
        (mbt (stat1p stat1))
        (stat1-from-stat
         (b* ((stat (stat-from-stat1 stat1)))
          (let* ((reg (lnfix reg)))
           (if (= reg 0)
               (stat-fix stat)
             (let
               ((change-stat stat)
                (stat->xregs (update-nth (+ -1 reg)
                                         (loghead (feat->xlen feat) val)
                                         (stat->xregs stat))))
               (stat stat->xregs (stat->pc change-stat)
                     (stat->memory change-stat)
                     (stat->error change-stat)))))))
        stat1))))