Skip to main content

PTO-SCALAR-MODEL-SYS-REGISTERS

PTO-SCALAR-MODEL-SYS-REGISTERS

ASL pseudocode

The complete ASL owner is shown directly below.

// PTO-UNIT: {"id":"PTO-SCALAR-MODEL-SYS-REGISTERS","surface":"scalar","classification":["model","sys","registers"],"depends_on":["PTO-SCALAR-MODEL-SYS-SEMANTICS","PTO-ARCH-SYSTEM-REGISTERS-MAINTENANCE"]}// PTO-REQ-SCALAR-SSR-001, PTO-REQ-PROFILE-001: canonical 24-bit// system-register addressing with explicit Access Control Ring checks.
readonly impdef func SystemRegisterAccessPermitted(    address: SystemRegisterAddress, write: boolean,    ring: AccessControlRing) => booleanbegin    // The active profile permits base registers at every ring and keeps    // context-family registers root-ring-only.    return UInt(address[11:0]) < 0x0f00 || ring == 0;end;
pure func IsBaseSystemRegisterAddress(address: SystemRegisterAddress) => booleanbegin    return address == Zeros{24} + 0x0000 ||           address == Zeros{24} + 0x0001 ||           address == Zeros{24} + 0x0010 ||           address == Zeros{24} + 0x0020 ||           address == Zeros{24} + 0x0021 ||           address == Zeros{24} + 0x0022 ||           address == Zeros{24} + 0x0023 ||           address == Zeros{24} + 0x0024 ||           address == Zeros{24} + 0x0025 ||           address == Zeros{24} + 0x0026 ||           address == Zeros{24} + 0x0027 ||           address == Zeros{24} + 0x0050 ||           address == Zeros{24} + 0x0051 ||           address == Zeros{24} + 0x0c00;end;
pure func BaseSystemRegisterOfAddress(address: SystemRegisterAddress) => SystemRegisterbegin    case UInt(address) of        when 0x0000 => return SystemRegister_THREAD_PTR;        when 0x0001 => return SystemRegister_GLOBAL_PTR;        when 0x0010 => return SystemRegister_TIME;        when 0x0020 => return SystemRegister_CORE_STATE;        when 0x0021 => return SystemRegister_CORE_ID;        when 0x0022 => return SystemRegister_VENDOR;        when 0x0023 => return SystemRegister_VERSION;        when 0x0024 => return SystemRegister_CORE_FEATURE;        when 0x0025 => return SystemRegister_CORE_FEATURE_ENABLE;        when 0x0026 => return SystemRegister_THREAD_ID;        when 0x0027 => return SystemRegister_TILE_CAPACITY;        when 0x0050 => return SystemRegister_BLOCKNUM;        when 0x0051 => return SystemRegister_BLOCKID;        when 0x0c00 => return SystemRegister_CYCLE;        otherwise => unreachable;    end;end;
pure func SystemRegisterFileIndexOf(address: SystemRegisterAddress)        => SystemRegisterFileIndexbegin    assert address[23:16] == Zeros{8};    return UInt(address[15:0]) as SystemRegisterFileIndex;end;
func ReadSystemRegisterAddress(address: SystemRegisterAddress) => Wordbegin    if !SystemRegisterAccessPermitted(address, FALSE, CurrentACR()) then        SetFault(Fault_IllegalInstruction, ReadPC());        return Zeros{PTO_XLEN};    end;    let access = SystemRegisterAccessOf(address);    if access == SystemRegisterAccess_Unknown ||       access == SystemRegisterAccess_WriteOnly then        SetFault(Fault_IllegalInstruction, ReadPC());        return Zeros{PTO_XLEN};    end;    if IsBaseSystemRegisterAddress(address) then        return ReadSystemRegister(BaseSystemRegisterOfAddress(address));    end;
    let low_index = UInt(address[11:0]);    let ring = UInt(address[15:12]) as AccessControlRing;    if low_index == 0x0f02 then return PackTrapStatus(ring); end;    if low_index == 0x0f03 then return _ACRTrapArgument0[[ring]]; end;    if low_index == 0x0f08 then return ReadInterruptPending(ring); end;    if low_index == 0x0f09 then return ReadTopPendingInterrupt(ring); end;    if low_index == 0x0f20 then return ReadMonotonicTime(); end;    return _ExtendedSystemRegisters[[SystemRegisterFileIndexOf(address)]];end;
readonly func SystemRegisterWritePermitted(address: SystemRegisterAddress)    => booleanbegin    let access = SystemRegisterAccessOf(address);    return SystemRegisterAccessPermitted(address, TRUE, CurrentACR()) &&           access != SystemRegisterAccess_Unknown &&           access != SystemRegisterAccess_ReadOnly;end;
readonly func SystemRegisterSwapPermitted(address: SystemRegisterAddress)    => booleanbegin    return SystemRegisterAccessPermitted(address, FALSE, CurrentACR()) &&           SystemRegisterAccessPermitted(address, TRUE, CurrentACR()) &&           SystemRegisterAccessOf(address) == SystemRegisterAccess_ReadWrite;end;
func WriteSystemRegisterAddress(address: SystemRegisterAddress, value: Word)begin    if !SystemRegisterWritePermitted(address) then        SetFault(Fault_IllegalInstruction, ReadPC());        return;    end;    if IsBaseSystemRegisterAddress(address) then        WriteSystemRegister(BaseSystemRegisterOfAddress(address), value);        return;    end;
    let low_index = UInt(address[11:0]);    let ring = UInt(address[15:12]) as AccessControlRing;    if low_index == 0x0f02 then        UnpackTrapStatus(ring, value);    elsif low_index == 0x0f03 then        _ACRTrapArgument0[[ring]] = value;    else        if low_index == 0x0f0a then            EndOfInterrupt(ring, value);        else            _ExtendedSystemRegisters[[SystemRegisterFileIndexOf(address)]] = value;            if low_index == 0x0f21 then RefreshTimerPending(ring); end;        end;    end;end;
func SwapSystemRegisterAddress(address: SystemRegisterAddress, value: Word) => Wordbegin    // A swap is a read/write transaction.  Preflight both permissions and the    // access class before reading so a rejected swap cannot trigger read-side    // effects such as timer-pending refresh on a read-only register.    if !SystemRegisterSwapPermitted(address) then        SetFault(Fault_IllegalInstruction, ReadPC());        return Zeros{PTO_XLEN};    end;    let old_value = ReadSystemRegisterAddress(address);    if _LastFault == Fault_None then WriteSystemRegisterAddress(address, value); end;    return old_value;end;
func ExecuteSystemRegisterGet(destination: Reg5Selector,                              address: SystemRegisterAddress)begin    let value = ReadSystemRegisterAddress(address);    if _LastFault == Fault_None then WriteScalarDestination(destination, value); end;end;
func ExecuteCompressedSystemRegisterGet(address: SystemRegisterAddress)begin    let value = ReadSystemRegisterAddress(address);    if _LastFault == Fault_None then WriteCompressedTResult(value); end;end;
func ExecuteSystemRegisterSet(source: Reg5Selector,                              address: SystemRegisterAddress)begin    if !SystemRegisterWritePermitted(address) then        SetFault(Fault_IllegalInstruction, ReadPC());        return;    end;    let value = ReadScalarRegisterOperand(source);    WriteSystemRegisterAddress(address, value);end;
func ExecuteSystemRegisterSwap(destination: Reg5Selector, source: Reg5Selector,                               address: SystemRegisterAddress)begin    if !SystemRegisterSwapPermitted(address) then        SetFault(Fault_IllegalInstruction, ReadPC());        return;    end;    let value = ReadScalarRegisterOperand(source);    let old_value = SwapSystemRegisterAddress(address, value);    if _LastFault == Fault_None then WriteScalarDestination(destination, old_value); end;end;

Architecture behavior

This internal model unit is documented through its normative ASL/NDF owners and validation evidence; it has no reader-guide migration target.

NDF clauses

Bodies come from owning ASL. Dragging or buttons change only this page-session view order.

No NDF clause is attached to this unit.

Evidence index

6 matching entries

Executable evidence1
  • PTO-SCALAR-MODEL-SYS-REGISTERS compiles as an independent normative unit
    1. surfaceSCALAR
    2. ownerPTO-SCALAR-MODEL-SYS-REGISTERS
    3. categorySTATIC-INVARIANT
    4. case001
    Show exact test source
    Sources and references
    Complete stable ID
    PTO-AVS-SCALAR-MODEL-SYS-REGISTERS-STATIC-001
    Path
    tests/asl/scalar/model/sys/registers/scalar-static-registers-contract-001.asl
    Kind / role
    static-invariant
    Pass condition
    the complete model and this unit's static invariant compile
    SHA-256
    1e6ccc57aa4299b7e1b4bd480761016bfbbac7bfc31f860849926d3514fa56e0
    Open exact source ↗ for PTO-AVS-SCALAR-MODEL-SYS-REGISTERS-STATIC-001
Commit-scoped evidence5
  • spec/evidence/release-traceability-readiness.json · closedPTO-EVIDENCE-RELEASE-TRACEABILITY
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-RELEASE-TRACEABILITY
    Path
    spec/evidence/release-traceability-readiness.json
    Kind / role
    ASL/NDF/documentation/AVS traceability
    SHA-256
    c7327021d39dc67ac5564bc55073b3870a397d79ac8d9648284d56e33bc14a3e
    Open exact source ↗ for PTO-EVIDENCE-RELEASE-TRACEABILITY
  • spec/evidence/instruction-contract-closure.json · closedPTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSURE
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSURE
    Path
    spec/evidence/instruction-contract-closure.json
    Kind / role
    mnemonic and encoding contract closure
    SHA-256
    3ef2bb62421c79dff8fa77a1c7983923b523244b8090812883ef81286ca8106a
    Open exact source ↗ for PTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSURE
  • spec/evidence/architecture-readiness.json · openPTO-EVIDENCE-ARCHITECTURE-READINESS
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-ARCHITECTURE-READINESS
    Path
    spec/evidence/architecture-readiness.json
    Kind / role
    architecture maturity and blockers
    SHA-256
    4b0b85199101251bea744e0f3591cc31906909dc80d5ab651c417a936036a004
    Open exact source ↗ for PTO-EVIDENCE-ARCHITECTURE-READINESS
  • spec/evidence/release-gate-readiness.json · ready-for-exact-head-verificationPTO-EVIDENCE-RELEASE-GATE-READINESS
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-RELEASE-GATE-READINESS
    Path
    spec/evidence/release-gate-readiness.json
    Kind / role
    exact-head gate readiness
    SHA-256
    a0f4d2b6920c08981ea55fd8ef820708a40d4feb5402c5150e8e9ab532d84ce0
    Open exact source ↗ for PTO-EVIDENCE-RELEASE-GATE-READINESS
  • spec/release-manifest.json · draftPTO-EVIDENCE-RELEASE-MANIFEST
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-RELEASE-MANIFEST
    Path
    spec/release-manifest.json
    Kind / role
    release content and encoding fingerprints
    SHA-256
    1a64c109ed7a90351c41e2a418b3c0ebaf8ad975838986d2101385186b85c0d8
    Open exact source ↗ for PTO-EVIDENCE-RELEASE-MANIFEST

Unit metadata

Open 4 generated metadata fields
id
PTO-SCALAR-MODEL-SYS-REGISTERS
surface
scalar
classification
[
  "model",
  "sys",
  "registers"
]
depends_on
[
  "PTO-SCALAR-MODEL-SYS-SEMANTICS",
  "PTO-ARCH-SYSTEM-REGISTERS-MAINTENANCE"
]
Open generated traceability record
{
  "classification": [
    "model",
    "sys",
    "registers"
  ],
  "documentation": "docs/scalar/model/sys/registers.md",
  "id": "PTO-SCALAR-MODEL-SYS-REGISTERS",
  "mnemonic": null,
  "readiness_subjects": [],
  "semantic_tests": [],
  "source": "asl/scalar/model/sys/registers.asl",
  "surface": "scalar",
  "tests": [
    "PTO-AVS-SCALAR-MODEL-SYS-REGISTERS-STATIC-001"
  ]
}

Sources and release identity

Show commit, paths, hashes, version, and canonical owners
Release
0.58.5 · Release candidate
Commit
7dc8b7e5b121d2b2499a2273bebff29e2cd86812
ASL SHA-256
9ca955860f45c7660bbc1a8dce879ad77c945e8504ec08d607ffb96d2a708cbb
Generated documentation
docs/scalar/model/sys/registers.md · embedded in this page
Documentation SHA-256
69ceaf6dbaa025f7b36fad552923f09d7f53bbef11c9cdb2b5a875ea6364d908

Exact owners