• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
        • Instructions
        • States
          • Stat
          • Stat-validp
          • Write-memory-unsigned64
          • Write-memory-unsigned32
          • Write-memory-unsigned8
          • Write-memory-unsigned16
          • Read-xreg-unsigned
          • Write-xreg-32
          • States64
          • Write-xreg
          • Read-memory-unsigned8
          • Read-memory-unsigned64
          • Read-memory-unsigned32
          • Read-memory-unsigned16
          • Read-xreg-signed
          • Read-xreg-unsigned32
          • States32
          • Write-pc
          • Read-xreg-signed32
          • Read-pc
            • Inc4-pc
          • Decoding
          • Encoding
          • Features
          • Semantics
          • Execution
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • States

    Read-pc

    Read the program counter.

    Signature
    (read-pc stat feat) → pc
    Arguments
    stat — Guard (statp stat).
    feat — Guard (featp feat).
    Returns
    pc — Type (unsigned-byte-p (feat->xlen feat) pc).

    The result is always an unsigned XLEN-bit integer, which is an address in memory; recall that the memory address space goes from 0 to 2^XLEN - 1, as explained in stat.

    Definitions and Theorems

    Function: read-pc

    (defun read-pc (stat feat)
      (declare (xargs :guard (and (statp stat) (featp feat))))
      (declare (xargs :guard (stat-validp stat feat)))
      (let ((__function__ 'read-pc))
        (declare (ignorable __function__))
        (unsigned-byte-fix (feat->xlen feat)
                           (stat->pc stat))))

    Theorem: return-type-of-read-pc

    (defthm return-type-of-read-pc
      (b* ((pc (read-pc stat feat)))
        (unsigned-byte-p (feat->xlen feat) pc))
      :rule-classes :rewrite)

    Theorem: natp-of-read-pc

    (defthm natp-of-read-pc
      (b* ((pc (read-pc stat feat)))
        (natp pc))
      :rule-classes :type-prescription)

    Theorem: ubyte32p-of-read-pc

    (defthm ubyte32p-of-read-pc
      (implies (and (stat-validp stat feat)
                    (feat-32p feat))
               (b* ((acl2::?pc (read-pc stat feat)))
                 (ubyte32p pc))))

    Theorem: ubyte64p-of-read-pc

    (defthm ubyte64p-of-read-pc
      (implies (and (stat-validp stat feat)
                    (feat-64p feat))
               (b* ((acl2::?pc (read-pc stat feat)))
                 (ubyte64p pc))))

    Theorem: read-pc-of-stat-fix-stat

    (defthm read-pc-of-stat-fix-stat
      (equal (read-pc (stat-fix stat) feat)
             (read-pc stat feat)))

    Theorem: read-pc-stat-equiv-congruence-on-stat

    (defthm read-pc-stat-equiv-congruence-on-stat
      (implies (stat-equiv stat stat-equiv)
               (equal (read-pc stat feat)
                      (read-pc stat-equiv feat)))
      :rule-classes :congruence)

    Theorem: read-pc-of-feat-fix-feat

    (defthm read-pc-of-feat-fix-feat
      (equal (read-pc stat (feat-fix feat))
             (read-pc stat feat)))

    Theorem: read-pc-feat-equiv-congruence-on-feat

    (defthm read-pc-feat-equiv-congruence-on-feat
      (implies (feat-equiv feat feat-equiv)
               (equal (read-pc stat feat)
                      (read-pc stat feat-equiv)))
      :rule-classes :congruence)