操作数与参数
SrcL- Reg5 atomic address source
SrcR- Reg5 atomic operand source
RegDst- Reg5 old-value destination
aq- acquire ordering bit
rl- release ordering bit
far- flat-address routing hint
LW.ADD atomically stores the modular 32-bit sum and publishes the prior memory value.
PTO-SCALAR-LW-ADDlw.add [SrcL], SrcR, ->Rdlw.add.aq [SrcL], SrcR, ->Rdlw.add.rl [SrcL], SrcR, ->Rdlw.add.f [SrcL], SrcR, ->Rdlw.add.aqrl [SrcL], SrcR, ->Rdlw.add.aqf [SrcL], SrcR, ->Rdlw.add.rlf [SrcL], SrcR, ->Rdlw.add.aqrlf [SrcL], SrcR, ->Rd| 字段 | 位宽 | 有符号性 | 架构角色 | 编码零 |
|---|---|---|---|---|
RegDst | 5 | encoding-defined | Reg5 old-value destination | Encoded zero discards the published old value. |
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. |
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 | 31:28 | 4'b0000 |
| far | 27 | variable |
| aq | 26 | variable |
| rl | 25 | variable |
| SrcR | 24:20 | variable |
| SrcL | 19:15 | variable |
| Constant | 14:12 | 3'b010 |
| RegDst | 11:7 | variable |
| Constant | 6:0 | 7'b0001011 |
{
"reg": [
{
"bits": 7,
"name": "7'b0001011"
},
{
"bits": 5,
"name": "RegDst"
},
{
"bits": 3,
"name": "3'b010"
},
{
"bits": 5,
"name": "SrcL"
},
{
"bits": 5,
"name": "SrcR"
},
{
"bits": 1,
"name": "rl"
},
{
"bits": 1,
"name": "aq"
},
{
"bits": 1,
"name": "far"
},
{
"bits": 4,
"name": "4'b0000"
}
],
"config": {
"bits": 32,
"fontsize": 13,
"hspace": 900,
"lanes": 1,
"offset": 0
}
}lw.add<.{aq, rl, f, aqrl, aqf, rlf, aqrlf}> [SrcL], SrcR, {->t, ->u, ->Rd}
SrcLSrcRRegDstaqrlfar下面是该指令所有者中的 Operation;页面没有重写这段行为。
readonly func InstructionContractOperation_LW_ADD() => ScalarOperationbegin return ScalarOperation_LW_ADD;end;readonly func InstructionContractHandler_LW_ADD() => ScalarSemanticHandlerbegin return ScalarHandler_AtomicReadModifyWrite;end;
pure func InstructionContractAtomicOperation_LW_ADD() => AtomicOperationbegin return Atomic_ADD;end;
pure func InstructionContractAtomicSizeBytes_LW_ADD() => integer {1,2,4,8}begin return 4;end;
pure func InstructionContractPublishesOldValue_LW_ADD() => booleanbegin return TRUE;end;
pure func InstructionContractSignExtendsOldValue_LW_ADD() => booleanbegin return TRUE;end;// PTO-INSTRUCTION: {"assembly":["lw.add [SrcL], SrcR, ->Rd","lw.add.aq [SrcL], SrcR, ->Rd","lw.add.rl [SrcL], SrcR, ->Rd","lw.add.f [SrcL], SrcR, ->Rd","lw.add.aqrl [SrcL], SrcR, ->Rd","lw.add.aqf [SrcL], SrcR, ->Rd","lw.add.rlf [SrcL], SrcR, ->Rd","lw.add.aqrlf [SrcL], SrcR, ->Rd"],"block":[],"catalog_indices":[341],"catalog_records":[{"asm":"lw.add<.{aq, rl, f, aqrl, aqf, rlf, aqrlf}> [SrcL], SrcR, {->t, ->u, ->Rd}","constraints":[],"encoding":[{"index":0,"mask":"0xf000707f","match":"0x0000200b","width_bits":32}],"encoding_kind":"L32","fields":[{"name":"RegDst","pieces":[{"instruction_lsb":7,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"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":"aq","pieces":[{"instruction_lsb":26,"value_lsb":0,"width":1}],"signedness":"encoding-defined","width":1},{"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":"lw_add_32_5be3ad1ad081","length_bits":32,"mnemonic":"LW.ADD","semantic_family":"AMO","semantic_group":"AMO","semantic_handler":"AtomicReadModifyWrite","semantic_summary":"LW.ADD atomically stores the modular 32-bit sum and publishes the prior memory value.","status":"accepted"}],"classification":["amo"],"contract":{"block_composition":["none"],"canonical_assembly":["lw.add [SrcL], SrcR, ->Rd","lw.add.aq [SrcL], SrcR, ->Rd","lw.add.rl [SrcL], SrcR, ->Rd","lw.add.f [SrcL], SrcR, ->Rd","lw.add.aqrl [SrcL], SrcR, ->Rd","lw.add.aqf [SrcL], SrcR, ->Rd","lw.add.rlf [SrcL], SrcR, ->Rd","lw.add.aqrlf [SrcL], SrcR, ->Rd"],"defaults":["SrcL, SrcR, and RegDst are required Reg5 fields. Encoded source zero reads the architectural zero register; encoded destination zero discards the published 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 architectural address and atomic result."],"encoding_class":"standalone-encoded","examples":["lw.add [a0], a1, ->a2","lw.add.aqrl [t#1], u#1, ->t","lw.add.f [sp], a0, ->u"],"exceptions":["The effective address must be aligned to 4 bytes. Alignment, translation, and permission checks occur before effects in that precedence order and report the original address.","Read and write access probes both complete before the memory load or store, and both probes must resolve to the same translated address.","On a fault, the instruction publishes no destination, performs no load, store, event, reservation update, or TPC advance. Trap entry saves the original TPC and recovery restores that TPC for full reissue.","An undecodable or operand-illegal form raises Fault_IllegalInstruction before effects."],"field_contracts":{},"field_zero_meanings":{"RegDst":"Encoded zero discards the published old value.","SrcL":"Encoded zero reads the architectural zero register as the atomic address.","SrcR":"Encoded zero supplies numeric zero as the atomic operand.","aq":"Encoded zero disables acquire ordering.","far":"Encoded zero selects the default flat-address route.","rl":"Encoded zero disables release 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.","All 32 Reg5 destination encodings are assigned. Destination code 0 and destination codes 24..29 discard. Destination code 30 pushes U, destination code 31 pushes T, and codes 1..23 write the named absolute GPR.","The effective address must be aligned to 4 bytes. aq, rl, and far have no reserved combinations."],"memory_effects":["Atomically read one aligned 4-byte little-endian value, compute the modular 32-bit sum, and write one 4-byte result to the same location.","On success, record one atomic memory event. A completed overlapping write invalidates the overlapping local reservation; a nonoverlapping reservation remains valid.","The published old value is sign-extended from 32 bits to XLEN."],"operands":[{"field":"SrcL","role":"Reg5 atomic address source"},{"field":"SrcR","role":"Reg5 atomic operand 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.","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 every memory or destination effect, so GPR and T/U source aliases observe the pre-instruction values.","LW.ADD computes the modular sum at 32-bit width and publishes the prior memory value only after a successful atomic commit.","The published old value is sign-extended from 32 bits to XLEN.","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."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-LW-ADD","mnemonic":"LW.ADD","summary":"LW.ADD atomically stores the modular 32-bit sum and publishes the prior memory 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_LW_ADD() => ScalarOperationbegin return ScalarOperation_LW_ADD;end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_LW_ADD() => ScalarSemanticHandlerbegin return ScalarHandler_AtomicReadModifyWrite;end;
pure func InstructionContractAtomicOperation_LW_ADD() => AtomicOperationbegin return Atomic_ADD;end;
pure func InstructionContractAtomicSizeBytes_LW_ADD() => integer {1,2,4,8}begin return 4;end;
pure func InstructionContractPublishesOldValue_LW_ADD() => booleanbegin return TRUE;end;
pure func InstructionContractSignExtendsOldValue_LW_ADD() => booleanbegin return TRUE;end;// DOC-END: operation
LW.ADD 对一个字原子执行模加、存储结果,并发布先前的内存值。
ASL DOC 契约选择 ScalarHandler_AtomicReadModifyWrite,访问宽度为 4 字节。
只有读取与写入访问都完成预检后,同一位置的原子读改写才能提交。
SrcL 承载 Reg5 原子地址源;SrcR 承载 Reg5 原子操作数源;RegDst 承载 Reg5 旧值目的地;aq 承载获取排序位;rl 承载释放排序位;far 承载平坦地址路由提示。
aq 与 rl 选择宽松、获取、释放或获取-释放排序;far 是配置档路由提示,在参考配置档中不改变架构结果。
只有读改写提交后才会发布旧内存值;任何目的地效果之前都会先捕获源别名。
完成的写入会使重叠的本地 64 字节缓存行保留失效,保留不重叠的保留,并让 TPC 前进 4 字节。
有效地址必须按 4 字节对齐。对齐、地址翻译和权限检查都先于架构效果。
预检失败时不会发布目的值、内存事件、保留更新或退役效果;保存的原始 TPC 支持完整重新执行。
本示例只展示一种已接受写法;下方生成的契约仍是权威来源。
初次阅读可从 lw.add [SrcL], SrcR, ->Rd 开始,再只改变上文说明的排序或路由修饰位。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
No NDF clause is attached to this unit.
12 matching entries
PTO-AVS-SCALAR-LW-ADD-DECODE-001tests/asl/scalar/amo/LW.ADD/scalar-decode-lw-add-canonical-001.asl750d1ff1ae5f0a3c021d35019fe5e1ede814cfdc7a53c1827d6487d86bf4d861PTO-AVS-SCALAR-LW-ADD-FORMS-001tests/asl/scalar/amo/LW.ADD/scalar-bound-lw-add-forms-001.asl975795c64ecefe7b2b95f5835167769c8151c33490212bc7d394fc083f2f02baPTO-AVS-SCALAR-LW-ADD-PRECISE-001tests/asl/scalar/amo/LW.ADD/scalar-fault-lw-add-precise-001.asleda2b90e2de2091879b9ebb1a4377955f3ce1ad6cc80127e514e163aec768995PTO-AVS-SCALAR-LW-ADD-RESULT-001tests/asl/scalar/amo/LW.ADD/scalar-exec-lw-add-result-001.asl10031ce5fba7bed3e08bbbbad286799e318c8de321df566cf82f065607dc6790PTO-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/LW.ADD.md",
"id": "PTO-SCALAR-LW-ADD",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "LW.ADD",
"ndf_clause": "PTO-INST-SCALAR-LW-ADD"
},
"mnemonic": "LW.ADD",
"readiness_subjects": [
"ADR-0020",
"ADR-0030",
"ADR-0059"
],
"semantic_tests": [
"PTO-AVS-SCALAR-LW-ADD-FORMS-001",
"PTO-AVS-SCALAR-LW-ADD-PRECISE-001",
"PTO-AVS-SCALAR-LW-ADD-RESULT-001"
],
"source": "asl/scalar/amo/LW.ADD.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-LW-ADD-DECODE-001",
"PTO-AVS-SCALAR-LW-ADD-FORMS-001",
"PTO-AVS-SCALAR-LW-ADD-PRECISE-001",
"PTO-AVS-SCALAR-LW-ADD-RESULT-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd86812f524907c7b46819437a74eb38e14923b3664fd814e63ecb1792de32fa0b18ad1f5a747ab4062b11d555e5cd1753379d132499a1b6ddc9c3c7db4a0d046e51d77asl/scalar/amo/LW.ADD.aslasl/scalar/amo/LW.ADD.asl