操作数与参数
SrcL- left Reg5 source
SrcR- right Reg5 source
C.ADD snapshots two complete Reg5 sources, adds SrcL and SrcR, and pushes the wrapping XLEN result to T.
PTO-SCALAR-C-ADDc.add srcL, srcR, ->t| 字段 | 位宽 | 有符号性 | 架构角色 | 编码零 |
|---|---|---|---|---|
SrcL | 5 | encoding-defined | left Reg5 source | Encoded zero reads the architectural zero GPR. |
SrcR | 5 | encoding-defined | right Reg5 source | Encoded zero reads the architectural zero GPR. |
Loading WaveDrom diagram… The encoding table and WaveJSON remain available below.
| Decoded item | Bit range | Value |
|---|---|---|
| SrcR | 15:11 | variable |
| SrcL | 10:6 | variable |
| Constant | 5:0 | 6'b001000 |
{
"reg": [
{
"bits": 6,
"name": "6'b001000"
},
{
"bits": 5,
"name": "SrcL"
},
{
"bits": 5,
"name": "SrcR"
}
],
"config": {
"bits": 16,
"fontsize": 13,
"hspace": 640,
"lanes": 1,
"offset": 0
}
}c.add srcL, srcR, ->t
SrcLSrcR下面是该指令所有者中的 Operation;页面没有重写这段行为。
readonly func InstructionContractOperation_C_ADD() => ScalarOperationbegin return ScalarOperation_C_ADD;end;readonly func InstructionContractHandler_C_ADD() => ScalarSemanticHandlerbegin return ScalarHandler_ScalarBinary;end;
pure func InstructionContractResult_C_ADD( left: Word, right: Word) => Wordbegin return ScalarBinary( ScalarBinary_ADD, left, right);end;// PTO-INSTRUCTION: {"assembly":["c.add srcL, srcR, ->t"],"block":[],"catalog_indices":[23],"catalog_records":[{"asm":"c.add srcL, srcR, ->t","constraints":[],"encoding":[{"index":0,"mask":"0x003f","match":"0x0008","width_bits":16}],"encoding_kind":"C16","fields":[{"name":"SrcL","pieces":[{"instruction_lsb":6,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5},{"name":"SrcR","pieces":[{"instruction_lsb":11,"value_lsb":0,"width":5}],"signedness":"encoding-defined","width":5}],"form_id":"c_add_16_85136d1e4904","length_bits":16,"mnemonic":"C.ADD","semantic_family":"ALU","semantic_group":"ALU","semantic_handler":"ScalarBinary","semantic_summary":"C.ADD snapshots two complete Reg5 sources, adds SrcL and SrcR, and pushes the wrapping XLEN result to T.","status":"accepted"}],"classification":["alu"],"contract":{"block_composition":["none"],"canonical_assembly":["c.add srcL, srcR, ->t"],"defaults":["SrcL and SrcR are required encoded fields; neither source can be omitted.","The destination is not encoded: every successful form pushes exactly one result to T."],"encoding_class":"standalone-encoded","examples":["c.add t#1, u#1, ->t"],"exceptions":["Addition is a total fixed-width operation and raises no arithmetic exception.","An unavailable selected T/U source raises Fault_IllegalInstruction before the T push, before TPC advances, and before any other effect."],"field_contracts":{},"field_zero_meanings":{"SrcL":"Encoded zero reads the architectural zero GPR.","SrcR":"Encoded zero reads the architectural zero GPR."},"legality":["Each source code 0..23 selects an absolute GPR, 24..27 selects T#1..T#4, and 28..31 selects U#1..U#4 without consumption.","Duplicate, absolute-relative, and relative-relative source pairs are legal. Every encoded source value is assigned."],"memory_effects":["none"],"operands":[{"field":"SrcL","role":"left Reg5 source"},{"field":"SrcR","role":"right Reg5 source"}],"ordering":["Snapshot both sources before pushing the destination so aliases observe the pre-instruction queue state.","Push the result as the newest T entry, then advance TPC by two bytes."],"standalone_opcode":true,"state_effects":["Compute addition on the two complete XLEN source values.","Push exactly one XLEN result to T. Existing T entries shift toward older indices, the former T#4 is discarded, and no source is consumed.","No GPR, U queue, memory, reservation, descriptor, numeric-status, block, privilege, predicate, or other control state changes. Successful execution advances TPC by two bytes."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-C-ADD","mnemonic":"C.ADD","summary":"C.ADD snapshots two complete Reg5 sources, adds SrcL and SrcR, and pushes the wrapping XLEN result to T.","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_C_ADD() => ScalarOperationbegin return ScalarOperation_C_ADD;end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_C_ADD() => ScalarSemanticHandlerbegin return ScalarHandler_ScalarBinary;end;
pure func InstructionContractResult_C_ADD( left: Word, right: Word) => Wordbegin return ScalarBinary( ScalarBinary_ADD, left, right);end;// DOC-END: operation
C.ADD 是一条紧凑的 16 位标量指令。它把两个完整 XLEN Reg5 源按 2^PTO_XLEN 取模相加,并且始终向 T 队列压入一个结果。
指令先对 SrcL 和 SrcR 取快照,再对两个保存值执行定宽加法,并把回绕后的结果发布为最新的 T 项。
目的位置是隐含的,并不占用编码字段:每次成功执行的 C.ADD 都恰好向 T 压入一个值。
0..23 选择 GPR,24..27 选择 T#1..T#4,28..31 选择 U#1..U#4。0 读取架构零 GPR。重复源、绝对源与相对源的组合以及两个相对源的组合均合法;读取临时源不会消费该项。
源快照先于隐含的 T 压入,因此先读 T 再压入 T 时,读取的是指令执行前的队列内容。
新结果成为 T#1,原有 T 项向 T#4 方向移动,原来的 T#4 被丢弃。U 队列保持不变,读取源本身不会消费队列项。
成功执行后 TPC 前进 2 字节;GPR、内存、保留状态、描述符、数值状态、指令束、特权、谓词和其他控制状态均不改变。
加法本身是全定义且不触发陷阱的。选中的 T/U 源尚不可用时,会在 T 压入、TPC 前进和任何无关状态变化之前引发 Fault_IllegalInstruction。
下面的演示只帮助理解当前所有者,并不是另一份指令定义。
若 T#1 保存 5、U#1 保存 3,则 c.add t#1, u#1, ->t 把 8 压入 T#1,把旧值 5 移到 T#2,保持 U#1 等于 3,并让 TPC 前进 2 字节。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
No NDF clause is attached to this unit.
10 matching entries
PTO-AVS-SCALAR-C-ADD-DECODE-001tests/asl/scalar/alu/C.ADD/scalar-decode-c-add-canonical-001.asl22d471a65da1a27159db2a4c98251cba5cc8d29c6c1f0e2520b53232bc7ffb86PTO-AVS-SCALAR-C-ADD-QUEUE-001tests/asl/scalar/alu/C.ADD/scalar-exec-c-add-queue-001.aslb0594615e62552ac4d16e0f6bb560827059e15322898e8342003c116e0d42240PTO-AVS-SCALAR-C-ADD-READINESS-001tests/asl/scalar/alu/C.ADD/scalar-fault-c-add-readiness-001.asla854d1e744c3420b6d991b306ac93d9a6b5bc7133940823a18779e4d7eafbef3PTO-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-0026…
ADR-0026docs/status/decisions/0026-scalar-alu-totality-and-alias-order.md41d126f224dddc371832120f1b02eab64e426872fdcbea452bad77c90bdec349Loading ADR-0059…
ADR-0059docs/status/decisions/0059-mnemonic-field-encoding-closure.mdf18d13f735cfaf9f2803c754c5818f4af33d1cc42c489f0d9ce060b07bb3a196{
"classification": [
"alu"
],
"documentation": "docs/scalar/alu/C.ADD.md",
"id": "PTO-SCALAR-C-ADD",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "C.ADD",
"ndf_clause": "PTO-INST-SCALAR-C-ADD"
},
"mnemonic": "C.ADD",
"readiness_subjects": [
"ADR-0026",
"ADR-0059"
],
"semantic_tests": [
"PTO-AVS-SCALAR-C-ADD-QUEUE-001",
"PTO-AVS-SCALAR-C-ADD-READINESS-001"
],
"source": "asl/scalar/alu/C.ADD.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-C-ADD-DECODE-001",
"PTO-AVS-SCALAR-C-ADD-QUEUE-001",
"PTO-AVS-SCALAR-C-ADD-READINESS-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd868129b7436628a60d16301bba5db8d933dae955d00d0f943bd559da90b35b52d018ef03ad029f15351062569faa8fe0d191fdb9456e05e93c2a139fdca0cb27dd6dbasl/scalar/alu/C.ADD.aslasl/scalar/alu/C.ADD.asl