操作数与参数
SrcL- Reg5 atomic address source
SrcR- Reg5 atomic operand source
far- flat-address routing hint
rl- release ordering bit
SW.AND atomically replaces the aligned 32-bit memory value with its bitwise AND with SrcR; it does not publish the old value.
PTO-SCALAR-SW-ANDsw.and [SrcL], SrcRsw.and.rl [SrcL], SrcRsw.and.f [SrcL], SrcRsw.and.rlf [SrcL], SrcR| 字段 | 位宽 | 有符号性 | 架构角色 | 编码零 |
|---|---|---|---|---|
SrcL | 5 | encoding-defined | Reg5 atomic address source | Encoded zero reads the architectural zero register as the atomic address. |
SrcR | 5 | encoding-defined | Reg5 atomic operand source | Encoded zero supplies numeric zero as the atomic operand. |
far | 1 | encoding-defined | flat-address routing hint | Encoded zero selects the default flat-address route. |
rl | 1 | encoding-defined | release ordering bit | Encoded zero selects relaxed ordering. |
Loading WaveDrom diagram… The encoding table and WaveJSON remain available below.
| Decoded item | Bit range | Value |
|---|---|---|
| Constant | 31:28 | 4'b0001 |
| far | 27 | variable |
| Constant | 26 | 0 |
| rl | 25 | variable |
| SrcR | 24:20 | variable |
| SrcL | 19:15 | variable |
| Constant | 14:0 | 15'b011000000001011 |
{
"reg": [
{
"bits": 15,
"name": "15'b011000000001011"
},
{
"bits": 5,
"name": "SrcL"
},
{
"bits": 5,
"name": "SrcR"
},
{
"bits": 1,
"name": "rl"
},
{
"bits": 1,
"name": "0"
},
{
"bits": 1,
"name": "far"
},
{
"bits": 4,
"name": "4'b0001"
}
],
"config": {
"bits": 32,
"fontsize": 13,
"hspace": 900,
"lanes": 1,
"offset": 0
}
}sw.and<.{rl, f, rlf}> [SrcL], SrcR
SrcLSrcRfarrl下面是该指令所有者中的 Operation;页面没有重写这段行为。
readonly func InstructionContractOperation_SW_AND() => ScalarOperationbegin return ScalarOperation_SW_AND;end;readonly func InstructionContractHandler_SW_AND() => ScalarSemanticHandlerbegin return ScalarHandler_AtomicReadModifyWrite;end;
pure func InstructionContractAtomicOperation_SW_AND() => AtomicOperationbegin return Atomic_AND;end;
pure func InstructionContractAtomicSizeBytes_SW_AND() => integer {1,2,4,8}begin return 4;end;
pure func InstructionContractPublishesOldValue_SW_AND() => booleanbegin return FALSE;end;// PTO-INSTRUCTION: {"assembly":["sw.and<.{rl, f, rlf}> [SrcL], SrcR"],"block":[],"catalog_indices":[442],"catalog_records":[{"asm":"sw.and<.{rl, f, rlf}> [SrcL], SrcR","constraints":[],"encoding":[{"index":0,"mask":"0xf4007fff","match":"0x1000300b","width_bits":32}],"encoding_kind":"L32","fields":[{"name":"SrcL","pieces":[{"instruction_lsb":15,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"SrcR","pieces":[{"instruction_lsb":20,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"far","pieces":[{"instruction_lsb":27,"value_lsb":0,"width":1}],"signedness":"encoding-defined","width":1},{"name":"rl","pieces":[{"instruction_lsb":25,"value_lsb":0,"width":1}],"signedness":"encoding-defined","width":1}],"form_id":"sw_and_32_7ef0872d5502","length_bits":32,"mnemonic":"SW.AND","semantic_family":"AMO","semantic_group":"AMO","semantic_handler":"AtomicReadModifyWrite","semantic_summary":"SW.AND atomically replaces the aligned 32-bit memory value with its bitwise AND with SrcR; it does not publish the old value.","status":"accepted"}],"classification":["amo"],"contract":{"block_composition":["none"],"canonical_assembly":["sw.and [SrcL], SrcR","sw.and.rl [SrcL], SrcR","sw.and.f [SrcL], SrcR","sw.and.rlf [SrcL], SrcR"],"defaults":["SrcL and SrcR are required Reg5 sources. Encoded zero reads the architectural zero register.","rl=0 selects relaxed ordering; rl=1 selects release ordering.","far=0 selects the default flat-address route. far=1 is a routing hint and does not change the architectural address or atomic operation in the reference profile."],"encoding_class":"standalone-encoded","examples":["sw.and [a0], a1","sw.and.rl [t#1], u#1","sw.and.f [sp], a0"],"exceptions":["Misalignment, translation, and permission checks occur before effects in that precedence order and report the original address.","If either read or write preflight fails, the instruction performs no load, store, event, reservation update, result publication, or TPC advance.","An undecodable or operand-illegal form raises Fault_IllegalInstruction before effects."],"field_contracts":{},"field_zero_meanings":{"SrcL":"Encoded zero reads the architectural zero register as the atomic address.","SrcR":"Encoded zero supplies numeric zero as the atomic operand.","far":"Encoded zero selects the default flat-address route.","rl":"Encoded zero selects relaxed ordering."},"legality":["All 32 Reg5 source encodings are assigned: 0..23 select absolute GPRs, 24..27 select T#1..T#4, and 28..31 select U#1..U#4.","The effective address must be aligned to 4 bytes. SrcL, SrcR, far, and rl have no reserved encodings in this form.","The instruction has no destination field and cannot publish the old memory value to a GPR or temporary queue."],"memory_effects":["Atomically read one aligned 4-byte little-endian value, compute the bitwise AND, and write one 4-byte result to the same location.","Complete both read and write access probes before the memory load or store, and require both probes to resolve to the same translated address.","On success, record one atomic memory event, invalidate an overlapping local reservation, and preserve a nonoverlapping reservation."],"operands":[{"field":"SrcL","role":"Reg5 atomic address source"},{"field":"SrcR","role":"Reg5 atomic operand source"},{"field":"far","role":"flat-address routing hint"},{"field":"rl","role":"release ordering bit"}],"ordering":["rl=0 records the atomic event with relaxed ordering; rl=1 records it with release ordering. This encoding has no acquire bit.","far changes only the route hint in the reference profile and does not change ordering, address arithmetic, or the read-modify-write result."],"standalone_opcode":true,"state_effects":["Snapshot SrcL and SrcR before any memory or architectural effect.","SW.AND computes the bitwise AND of the old value and operand at 32-bit width and stores that value; it does not publish the old value.","Successful execution advances TPC by four bytes. On a fault, the instruction does not retire; trap entry saves the original TPC, redirects the live TPC to the trap vector, and recovery restores that TPC for full reissue. GPRs, T/U queues, memory events, reservation state, and memory remain unchanged by the failed instruction."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-SW-AND","mnemonic":"SW.AND","summary":"SW.AND atomically replaces the aligned 32-bit memory value with its bitwise AND with SrcR; it does not publish the old value.","surface":"scalar"}// PTO-REVIEW: {"review_method":"formal-definition-read","outcome":"FORMAL-COMPLETE","reviewed_fields":["assembly","encoding","defaults","operation","state","memory","ordering","faults","reserved"]}// NDF-BEGIN: PTO-SW-AND-ADR-CONTRACT-001// ndf: kind=contract level=L1 layer=scalar status=accepted// Decisions: ADR-0030.// SW.AND MUST preflight its complete mnemonic-owned atomic access before// memory, reservation, event, or destination effects and MUST commit the// selected width, ordering, memory update, event, and result atomically.// NDF-END: PTO-SW-AND-ADR-CONTRACT-001// DOC-BEGIN: decodereadonly func InstructionContractOperation_SW_AND() => ScalarOperationbegin return ScalarOperation_SW_AND;end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_SW_AND() => ScalarSemanticHandlerbegin return ScalarHandler_AtomicReadModifyWrite;end;
pure func InstructionContractAtomicOperation_SW_AND() => AtomicOperationbegin return Atomic_AND;end;
pure func InstructionContractAtomicSizeBytes_SW_AND() => integer {1,2,4,8}begin return 4;end;
pure func InstructionContractPublishesOldValue_SW_AND() => booleanbegin return FALSE;end;// DOC-END: operation
SW.AND 对一个字原子执行按位与并存储结果,但不发布旧值。
ASL DOC 契约选择 ScalarHandler_AtomicReadModifyWrite,访问宽度为 4 字节。
只有读取与写入访问都完成预检后,同一位置的原子读改写才能提交。
SrcL 承载 Reg5 原子地址源;SrcR 承载 Reg5 原子操作数源;far 承载平坦地址路由提示;rl 承载释放排序位。
rl 选择宽松或释放排序;该形式没有获取位;far 是配置档路由提示,在参考配置档中不改变架构结果。
这种仅存储形式没有目的字段;提交成功时会更新内存并发出一个原子事件。
完成的写入会使重叠的本地 64 字节缓存行保留失效,保留不重叠的保留,并让 TPC 前进 4 字节。
有效地址必须按 4 字节对齐。对齐、地址翻译和权限检查都先于架构效果。
预检失败时不会发布目的值、内存事件、保留更新或退役效果;保存的原始 TPC 支持完整重新执行。
本示例只展示一种已接受写法;下方生成的契约仍是权威来源。
初次阅读可从 sw.and [SrcL], SrcR 开始,再只改变上文说明的排序或路由修饰位。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
Decisions: ADR-0030. SW.AND MUST preflight its complete mnemonic-owned atomic access before memory, reservation, event, or destination effects and MUST commit the selected width, ordering, memory update, event, and result atomically.
PTO-SW-AND-ADR-CONTRACT-001asl/scalar/amo/SW.AND.asl3c10a1bd761e68a3a0b9701090a71f39361b3f79fd98ea64d043c187f563996cd38311802da7f0dc488cd3c2af0eb6f4dc6cd650d7abdd8ed3fff9121710a40613 matching entries
PTO-AVS-SCALAR-SW-AND-DECODE-001tests/asl/scalar/amo/SW.AND/scalar-decode-sw-and-canonical-001.asl61e251c9526a4f8a8effa474620128008a4f2c91fda2c00425285fa4bf92907ePTO-AVS-SCALAR-SW-AND-FORMS-001tests/asl/scalar/amo/SW.AND/scalar-bound-sw-and-forms-001.aslb1a9a065eeedbb8814f08a58053ee6289419ff4a0be78488322010deaf7d9ec7PTO-AVS-SCALAR-SW-AND-PRECISE-001tests/asl/scalar/amo/SW.AND/scalar-fault-sw-and-precise-001.asl363ab9af5ea7f7aa4d185ad269823e9202a5c2c7ad9b2b14455fa27755870e9fPTO-AVS-SCALAR-SW-AND-STORE-001tests/asl/scalar/amo/SW.AND/scalar-exec-sw-and-store-only-001.asl31ee12d3eb7e1965fe0d1aa6c749a688161868a023b56d83f74c267e3a774ce6PTO-EVIDENCE-RELEASE-TRACEABILITYPTO-EVIDENCE-RELEASE-TRACEABILITYspec/evidence/release-traceability-readiness.jsonc7327021d39dc67ac5564bc55073b3870a397d79ac8d9648284d56e33bc14a3ePTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSUREPTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSUREspec/evidence/instruction-contract-closure.json3ef2bb62421c79dff8fa77a1c7983923b523244b8090812883ef81286ca8106aPTO-EVIDENCE-ARCHITECTURE-READINESSPTO-EVIDENCE-ARCHITECTURE-READINESSspec/evidence/architecture-readiness.json4b0b85199101251bea744e0f3591cc31906909dc80d5ab651c417a936036a004PTO-EVIDENCE-RELEASE-GATE-READINESSPTO-EVIDENCE-RELEASE-GATE-READINESSspec/evidence/release-gate-readiness.jsona0f4d2b6920c08981ea55fd8ef820708a40d4feb5402c5150e8e9ab532d84ce0PTO-EVIDENCE-RELEASE-MANIFESTPTO-EVIDENCE-RELEASE-MANIFESTspec/release-manifest.json1a64c109ed7a90351c41e2a418b3c0ebaf8ad975838986d2101385186b85c0d8Loading ADR-0020…
ADR-0020docs/status/decisions/0020-production-memory-events-and-atomic-corners.md215b18f05d0b53120949373fce6a5ce22f7ab534fb22df24743a9b2b4beb2decLoading ADR-0030…
ADR-0030docs/status/decisions/0030-scalar-amo-totality-and-reservation.md110bd32b3004a8383913ac6053cc7d0a1d0b8e03e3ef7c47d83292c94a6a17ebLoading ADR-0059…
ADR-0059docs/status/decisions/0059-mnemonic-field-encoding-closure.mdf18d13f735cfaf9f2803c754c5818f4af33d1cc42c489f0d9ce060b07bb3a196Loading ADR-0084…
ADR-0084docs/status/decisions/0084-scalar-system-and-queue-operations.mde068992fa81e2c4ac46e492391a2f784141d68e041bf0b9e0586c37217d1e08c{
"classification": [
"amo"
],
"documentation": "docs/scalar/amo/SW.AND.md",
"id": "PTO-SCALAR-SW-AND",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "SW.AND",
"ndf_clause": "PTO-INST-SCALAR-SW-AND"
},
"mnemonic": "SW.AND",
"readiness_subjects": [
"ADR-0020",
"ADR-0030",
"ADR-0059",
"ADR-0084"
],
"semantic_tests": [
"PTO-AVS-SCALAR-SW-AND-FORMS-001",
"PTO-AVS-SCALAR-SW-AND-PRECISE-001",
"PTO-AVS-SCALAR-SW-AND-STORE-001"
],
"source": "asl/scalar/amo/SW.AND.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-SW-AND-DECODE-001",
"PTO-AVS-SCALAR-SW-AND-FORMS-001",
"PTO-AVS-SCALAR-SW-AND-PRECISE-001",
"PTO-AVS-SCALAR-SW-AND-STORE-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd868123c10a1bd761e68a3a0b9701090a71f39361b3f79fd98ea64d043c187f563996cc52870b524b3680dcbbeb7dcaa48ca76b901520b042ed4390df3201b790b4665asl/scalar/amo/SW.AND.aslasl/scalar/amo/SW.AND.aslasl/scalar/amo/SW.AND.asl