操作数与参数
SrcL- Reg5 atomic address source
SrcR- Reg5 expected doubleword source
SrcD- Reg5 desired doubleword source
RegDst- Reg5 old-value destination
aq- acquire ordering bit
rl- release ordering bit
far- flat-address routing hint
HL.CASD atomically compares and conditionally replaces one doubleword, then publishes the prior value.
PTO-SCALAR-HL-CASDhl.casd [SrcL], SrcR, SrcD, ->Rdhl.casd.aq [SrcL], SrcR, SrcD, ->Rdhl.casd.rl [SrcL], SrcR, SrcD, ->Rdhl.casd.f [SrcL], SrcR, SrcD, ->Rdhl.casd.aqrl [SrcL], SrcR, SrcD, ->Rdhl.casd.aqf [SrcL], SrcR, SrcD, ->Rdhl.casd.rlf [SrcL], SrcR, SrcD, ->Rdhl.casd.aqrlf [SrcL], SrcR, SrcD, ->Rd| 字段 | 位宽 | 有符号性 | 架构角色 | 编码零 |
|---|---|---|---|---|
RegDst | 5 | encoding-defined | Reg5 old-value destination | Encoded zero discards the prior value. |
SrcD | 5 | encoding-defined | Reg5 desired doubleword source | Encoded zero supplies numeric zero as the desired value. |
SrcL | 5 | encoding-defined | Reg5 atomic address source | Encoded zero reads the architectural zero register as the address. |
SrcR | 5 | encoding-defined | Reg5 expected doubleword source | Encoded zero supplies numeric zero as the expected value. |
aq | 1 | encoding-defined | acquire ordering bit | Encoded zero disables acquire ordering. |
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 disables release ordering. |
Loading WaveDrom diagram… The encoding table and WaveJSON remain available below.
| Decoded item | Bit range | Value |
|---|---|---|
| Constant | 47:44 | 4'b0011 |
| far | 43 | variable |
| aq | 42 | variable |
| rl | 41 | variable |
| SrcR | 40:36 | variable |
| SrcL | 35:31 | variable |
| Constant | 30:28 | 3'b110 |
| RegDst | 27:23 | variable |
| Constant | 22:11 | 12'b000101100000 |
| SrcD | 10:6 | variable |
| Constant | 5:0 | 6'b001110 |
{
"reg": [
{
"bits": 6,
"name": "6'b001110"
},
{
"bits": 5,
"name": "SrcD"
},
{
"bits": 12,
"name": "12'b000101100000"
},
{
"bits": 5,
"name": "RegDst"
},
{
"bits": 3,
"name": "3'b110"
},
{
"bits": 5,
"name": "SrcL"
},
{
"bits": 5,
"name": "SrcR"
},
{
"bits": 1,
"name": "rl"
},
{
"bits": 1,
"name": "aq"
},
{
"bits": 1,
"name": "far"
},
{
"bits": 4,
"name": "4'b0011"
}
],
"config": {
"bits": 48,
"fontsize": 13,
"hspace": 900,
"lanes": 2,
"offset": 0
}
}hl.casd<.{aq, rl, f, aqrl, aqf, rlf, aqrlf}> [SrcL], SrcR, SrcD, ->{t, u, Rd}
SrcLSrcRSrcDRegDstaqrlfar下面是该指令所有者中的 Operation;页面没有重写这段行为。
readonly func InstructionContractOperation_HL_CASD() => ScalarOperationbegin return ScalarOperation_HL_CASD;end;readonly func InstructionContractHandler_HL_CASD() => ScalarSemanticHandlerbegin return ScalarHandler_CompareAndSwap;end;
pure func InstructionContractCompareSizeBytes_HL_CASD() => integer {1,2,4,8}begin return 8;end;
pure func InstructionContractHasFarField_HL_CASD() => booleanbegin return TRUE;end;
pure func InstructionContractZeroExtendsOldValue_HL_CASD() => booleanbegin return FALSE;end;
pure func InstructionContractSignExtendsOldValue_HL_CASD() => booleanbegin return FALSE;end;// PTO-INSTRUCTION: {"assembly":["hl.casd [SrcL], SrcR, SrcD, ->Rd","hl.casd.aq [SrcL], SrcR, SrcD, ->Rd","hl.casd.rl [SrcL], SrcR, SrcD, ->Rd","hl.casd.f [SrcL], SrcR, SrcD, ->Rd","hl.casd.aqrl [SrcL], SrcR, SrcD, ->Rd","hl.casd.aqf [SrcL], SrcR, SrcD, ->Rd","hl.casd.rlf [SrcL], SrcR, SrcD, ->Rd","hl.casd.aqrlf [SrcL], SrcR, SrcD, ->Rd"],"block":[],"catalog_indices":[124],"catalog_records":[{"asm":"hl.casd<.{aq, rl, f, aqrl, aqf, rlf, aqrlf}> [SrcL], SrcR, SrcD, ->{t, u, Rd}","constraints":[],"encoding":[{"index":0,"mask":"0xf000707ff83f","match":"0x3000600b000e","width_bits":48}],"encoding_kind":"HL48","fields":[{"name":"RegDst","pieces":[{"instruction_lsb":23,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"SrcD","pieces":[{"instruction_lsb":6,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"SrcL","pieces":[{"instruction_lsb":31,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"SrcR","pieces":[{"instruction_lsb":36,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"aq","pieces":[{"instruction_lsb":42,"value_lsb":0,"width":1}],"signedness":"encoding-defined","width":1},{"name":"far","pieces":[{"instruction_lsb":43,"value_lsb":0,"width":1}],"signedness":"encoding-defined","width":1},{"name":"rl","pieces":[{"instruction_lsb":41,"value_lsb":0,"width":1}],"signedness":"encoding-defined","width":1}],"form_id":"hl_casd_48_fbb5c4256d30","length_bits":48,"mnemonic":"HL.CASD","semantic_family":"AMO","semantic_group":"AMO","semantic_handler":"CompareAndSwap","semantic_summary":"HL.CASD atomically compares and conditionally replaces one doubleword, then publishes the prior value.","status":"accepted"}],"classification":["amo"],"contract":{"block_composition":["none"],"canonical_assembly":["hl.casd [SrcL], SrcR, SrcD, ->Rd","hl.casd.aq [SrcL], SrcR, SrcD, ->Rd","hl.casd.rl [SrcL], SrcR, SrcD, ->Rd","hl.casd.f [SrcL], SrcR, SrcD, ->Rd","hl.casd.aqrl [SrcL], SrcR, SrcD, ->Rd","hl.casd.aqf [SrcL], SrcR, SrcD, ->Rd","hl.casd.rlf [SrcL], SrcR, SrcD, ->Rd","hl.casd.aqrlf [SrcL], SrcR, SrcD, ->Rd"],"defaults":["SrcL, SrcR, SrcD, and RegDst are required Reg5 fields. Encoded source zero reads the architectural zero register; encoded destination zero discards the old value.","aq=0 and rl=0 select relaxed ordering. aq=1 selects acquire, rl=1 selects release, and aq=1 with rl=1 selects acquire-release.","far=0 selects the default flat-address route. far=1 is a profile routing hint; the reference profile preserves the same address and atomic result."],"encoding_class":"standalone-encoded","examples":["hl.casd [a0], a1, a2, ->a3","hl.casd.aqrlf [t#1], u#1, a0, ->u"],"exceptions":["The effective address must be aligned to 8 bytes. Alignment, read translation/permission, write translation/permission, and translated-address equality are checked before effects.","On a fault, no destination, memory write, event, reservation update, or TPC advance occurs. Trap entry saves the original TPC and recovery restores it for full reissue.","An undecodable fixed-bit pattern raises Fault_IllegalInstruction before effects. All explicit field values are assigned."],"field_contracts":{},"field_zero_meanings":{"RegDst":"Encoded zero discards the prior value.","SrcL":"Encoded zero reads the architectural zero register as the address.","SrcR":"Encoded zero supplies numeric zero as the expected value.","SrcD":"Encoded zero supplies numeric zero as the desired value.","aq":"Encoded zero disables acquire ordering.","rl":"Encoded zero disables release ordering.","far":"Encoded zero selects the default flat-address route."},"legality":["All 32 SrcL, SrcR, and SrcD Reg5 encodings are assigned: 0..23 select absolute GPRs, 24..27 select T#1..T#4, and 28..31 select U#1..U#4.","All 32 RegDst encodings are assigned. Code 0 and codes 24..29 discard, code 30 pushes U, code 31 pushes T, and codes 1..23 write the named absolute GPR.","All aq, rl, and far combinations are assigned.","The effective address must be aligned to 8 bytes."],"memory_effects":["After aligned read and write preflight identify the same translated location, atomically read one 8-byte doubleword and compare it with SrcR truncated to 8 bytes.","On equality, store SrcD truncated to 8 bytes and set write_performed in the atomic event. On mismatch, preserve memory and emit an ordered atomic event with write_performed false.","Only a successful overlapping write invalidates the local 64-byte-line reservation; mismatch and nonoverlap preserve it.","The 64-bit old value is published unchanged."],"operands":[{"field":"SrcL","role":"Reg5 atomic address source"},{"field":"SrcR","role":"Reg5 expected doubleword source"},{"field":"SrcD","role":"Reg5 desired doubleword source"},{"field":"RegDst","role":"Reg5 old-value destination"},{"field":"aq","role":"acquire ordering bit"},{"field":"rl","role":"release ordering bit"},{"field":"far","role":"flat-address routing hint"}],"ordering":["aq=0,rl=0 records relaxed ordering; aq=1,rl=0 acquire; aq=0,rl=1 release; aq=1,rl=1 acquire-release for both match and mismatch.","far changes only the route hint in the reference profile."],"standalone_opcode":true,"state_effects":["Snapshot SrcL, SrcR, and SrcD before any memory or destination effect.","Publish the prior value after every nonfaulting match or mismatch; publish no value on fault.","The 64-bit old value is published unchanged.","Successful execution advances TPC by 6 bytes. A fault saves and later restores the original TPC for full reissue."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-HL-CASD","mnemonic":"HL.CASD","summary":"HL.CASD atomically compares and conditionally replaces one doubleword, then publishes the prior value.","surface":"scalar"}// PTO-REVIEW: {"review_method":"formal-definition-read","outcome":"FORMAL-COMPLETE","reviewed_fields":["assembly","encoding","defaults","operation","state","memory","ordering","faults","reserved"]}// DOC-BEGIN: decodereadonly func InstructionContractOperation_HL_CASD() => ScalarOperationbegin return ScalarOperation_HL_CASD;end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_HL_CASD() => ScalarSemanticHandlerbegin return ScalarHandler_CompareAndSwap;end;
pure func InstructionContractCompareSizeBytes_HL_CASD() => integer {1,2,4,8}begin return 8;end;
pure func InstructionContractHasFarField_HL_CASD() => booleanbegin return TRUE;end;
pure func InstructionContractZeroExtendsOldValue_HL_CASD() => booleanbegin return FALSE;end;
pure func InstructionContractSignExtendsOldValue_HL_CASD() => booleanbegin return FALSE;end;// DOC-END: operation
HL.CASD 把 SrcL 指向的双字与 SrcR 进行原子比较;相等时写入 SrcD,而两条路径都会发布先前的 64 位值。
ASL DOC 契约选择 ScalarHandler_CompareAndSwap,访问宽度为 8 字节。
匹配与不匹配都会发出一个带排序属性的原子事件;只有匹配路径会把写入标记为已执行。
SrcL 承载 Reg5 原子地址源;SrcR 承载 Reg5 期望双字源;SrcD 承载 Reg5 目标双字源;RegDst 承载 Reg5 旧值目的地;aq 承载获取排序位;rl 承载释放排序位;far 承载平坦地址路由提示。
aq 与 rl 选择宽松、获取、释放或获取-释放排序;far 是配置档路由提示,在参考配置档中不改变架构结果。
预检成功后,即使比较不匹配也会发布旧值;只有相等时内存才会改变。
完成的写入会使重叠的本地 64 字节缓存行保留失效,保留不重叠的保留,并让 TPC 前进 6 字节。
有效地址必须按 8 字节对齐。对齐、地址翻译和权限检查都先于架构效果。
预检失败时不会发布目的值、内存事件、保留更新或退役效果;保存的原始 TPC 支持完整重新执行。
本示例只展示一种已接受写法;下方生成的契约仍是权威来源。
初次阅读可从 hl.casd [SrcL], SrcR, SrcD, ->Rd 开始,再只改变上文说明的排序或路由修饰位。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
No NDF clause is attached to this unit.
12 matching entries
PTO-AVS-SCALAR-HL-CASD-DECODE-001tests/asl/scalar/amo/HL.CASD/scalar-decode-hl-casd-canonical-001.asl8572d99804417266b811cd28c0cebbfd0dc1a489175bbd65d07acd7f0696ff88PTO-AVS-SCALAR-HL-CASD-MATCH-001tests/asl/scalar/amo/HL.CASD/scalar-exec-hl-casd-match-001.asl080e6b0f20ce92f6310bc453dd5692eabfb4de5c95480759d81f16bcf3fb04baPTO-AVS-SCALAR-HL-CASD-MISMATCH-001tests/asl/scalar/amo/HL.CASD/scalar-bound-hl-casd-mismatch-001.aslee6a167b93c21dbc5aaecbf15d3cc95e632743e5cf21f2f68933456e92ca88e7PTO-AVS-SCALAR-HL-CASD-PRECISE-001tests/asl/scalar/amo/HL.CASD/scalar-fault-hl-casd-precise-001.asl4e2710e63795d863b442ec5e7aa46e3fd67c9d3373ea424c63c3de351c270bfcPTO-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.mdf18d13f735cfaf9f2803c754c5818f4af33d1cc42c489f0d9ce060b07bb3a196{
"classification": [
"amo"
],
"documentation": "docs/scalar/amo/HL.CASD.md",
"id": "PTO-SCALAR-HL-CASD",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "HL.CASD",
"ndf_clause": "PTO-INST-SCALAR-HL-CASD"
},
"mnemonic": "HL.CASD",
"readiness_subjects": [
"ADR-0020",
"ADR-0030",
"ADR-0059"
],
"semantic_tests": [
"PTO-AVS-SCALAR-HL-CASD-MATCH-001",
"PTO-AVS-SCALAR-HL-CASD-MISMATCH-001",
"PTO-AVS-SCALAR-HL-CASD-PRECISE-001"
],
"source": "asl/scalar/amo/HL.CASD.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-HL-CASD-DECODE-001",
"PTO-AVS-SCALAR-HL-CASD-MATCH-001",
"PTO-AVS-SCALAR-HL-CASD-MISMATCH-001",
"PTO-AVS-SCALAR-HL-CASD-PRECISE-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd868127820c5f37074f3b382addeb3dd040d1072967e97f3364c1ab90315807356c480ee1a6842b2eda6e41bdad24664a248ba8ab893192267339e37d671591cb72b45asl/scalar/amo/HL.CASD.aslasl/scalar/amo/HL.CASD.asl