操作数与参数
SrcP- Reg5 predicate source
SrcL- Reg5 true-value source
SrcR- Reg5 false-value source
SrcRType- CSEL-specific false-source modifier selector
RegDst- Reg5 destination or discard
CSEL snapshots three Reg5 sources, selects SrcL for a nonzero predicate or its optionally negated SrcR for zero, and publishes through the common scalar destination map.
PTO-SCALAR-CSELcsel SrcP, SrcL, SrcR<.neg>, ->{t, u, Rd}| 字段 | 位宽 | 有符号性 | 架构角色 | 编码零 |
|---|---|---|---|---|
RegDst | 5 | encoding-defined | Reg5 destination or discard | Encoded zero discards the result. |
SrcL | 5 | encoding-defined | Reg5 true-value source | Encoded zero reads the architectural zero GPR. |
SrcP | 5 | encoding-defined | Reg5 predicate source | Encoded zero reads the architectural zero GPR and therefore selects the false value. |
SrcR | 5 | encoding-defined | Reg5 false-value source | Encoded zero reads the architectural zero GPR. |
SrcRType | 2 | encoding-defined | CSEL-specific false-source modifier selector | Encoded zero is an assigned unmodified false-source alias. |
Loading WaveDrom diagram… The encoding table and WaveJSON remain available below.
| Decoded item | Bit range | Value |
|---|---|---|
| SrcP | 31:27 | variable |
| SrcRType | 26:25 | variable |
| SrcR | 24:20 | variable |
| SrcL | 19:15 | variable |
| Constant | 14:12 | 3'b000 |
| RegDst | 11:7 | variable |
| Constant | 6:0 | 7'b1110111 |
{
"reg": [
{
"bits": 7,
"name": "7'b1110111"
},
{
"bits": 5,
"name": "RegDst"
},
{
"bits": 3,
"name": "3'b000"
},
{
"bits": 5,
"name": "SrcL"
},
{
"bits": 5,
"name": "SrcR"
},
{
"bits": 2,
"name": "SrcRType"
},
{
"bits": 5,
"name": "SrcP"
}
],
"config": {
"bits": 32,
"fontsize": 13,
"hspace": 900,
"lanes": 1,
"offset": 0
}
}csel SrcP, SrcL, SrcR<.neg>, ->{t, u, Rd}
SrcPSrcLSrcRSrcRTypeRegDst下面是该指令所有者中的 Operation;页面没有重写这段行为。
readonly func InstructionContractOperation_CSEL() => ScalarOperationbegin return ScalarOperation_CSEL;end;
pure func InstructionContractRightModifier_CSEL(encoded: bits(2)) => ScalarRightModifierbegin return DecodeScalarSelectRightModifier(encoded);end;readonly func InstructionContractHandler_CSEL() => ScalarSemanticHandlerbegin return ScalarHandler_ScalarConditionalSelect;end;
pure func InstructionContractFalseValue_CSEL( right: Word, encoded_modifier: bits(2)) => Wordbegin let modifier = InstructionContractRightModifier_CSEL(encoded_modifier); return ApplySelectModifier(right, modifier);end;
pure func InstructionContractResult_CSEL( predicate: Word, selected_true: Word, selected_false: Word, encoded_modifier: bits(2)) => Wordbegin let prepared_false = InstructionContractFalseValue_CSEL( selected_false, encoded_modifier); return ScalarConditionalSelect( predicate, selected_true, prepared_false);end;// PTO-INSTRUCTION: {"assembly":["csel SrcP, SrcL, SrcR<.neg>, ->{t, u, Rd}"],"block":[],"catalog_indices":[71],"catalog_records":[{"asm":"csel SrcP, SrcL, SrcR<.neg>, ->{t, u, Rd}","constraints":[],"encoding":[{"index":0,"mask":"0x0000707f","match":"0x00000077","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":"SrcP","pieces":[{"instruction_lsb":27,"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":"SrcRType","pieces":[{"instruction_lsb":25,"value_lsb":0,"width":2}],"signedness":"encoding-defined","width":2}],"form_id":"csel_32_ba77cbad3c99","length_bits":32,"mnemonic":"CSEL","semantic_family":"ALU","semantic_group":"ALU","semantic_handler":"ScalarConditionalSelect","semantic_summary":"CSEL snapshots three Reg5 sources, selects SrcL for a nonzero predicate or its optionally negated SrcR for zero, and publishes through the common scalar destination map.","status":"accepted"}],"classification":["alu"],"contract":{"block_composition":["none"],"canonical_assembly":["csel SrcP, SrcL, SrcR<.neg>, ->{t, u, Rd}"],"defaults":["SrcP, SrcL, SrcR, SrcRType, and RegDst are required encoded fields; no field can be omitted.","Assembly without .neg uses the canonical unmodified alias selected by the assembler. Raw SrcRType codes 00, 01, and 10 are assigned unmodified aliases; raw code 11 is .neg."],"encoding_class":"standalone-encoded","examples":["csel a0, a1, a2, ->a3","csel t#1, u#1, a0.neg, ->u","csel zero, a0, a1, ->zero"],"exceptions":["An unavailable selected T/U queue source raises Fault_IllegalInstruction before the destination effect and before TPC advances, including a source not selected by the predicate outcome.","CSEL raises no arithmetic, memory, alignment, permission, or control-flow exception."],"field_contracts":{},"field_zero_meanings":{"RegDst":"Encoded zero discards the result.","SrcL":"Encoded zero reads the architectural zero GPR.","SrcP":"Encoded zero reads the architectural zero GPR and therefore selects the false value.","SrcR":"Encoded zero reads the architectural zero GPR.","SrcRType":"Encoded zero is an assigned unmodified false-source alias."},"legality":["SrcP, SrcL, and SrcR codes 0..23 select absolute GPRs, 24..27 select T#1..T#4, and 28..31 select U#1..U#4 without consumption.","All four SrcRType values are assigned. Codes 00, 01, and 10 leave SrcR unchanged; code 11 negates the complete XLEN value modulo 2^PTO_XLEN.","RegDst codes 0 and 24..29 discard, codes 1..23 write GPRs, code 30 pushes U, and code 31 pushes T."],"memory_effects":["none"],"operands":[{"field":"SrcP","role":"Reg5 predicate source"},{"field":"SrcL","role":"Reg5 true-value source"},{"field":"SrcR","role":"Reg5 false-value source"},{"field":"SrcRType","role":"CSEL-specific false-source modifier selector"},{"field":"RegDst","role":"Reg5 destination or discard"}],"ordering":["Read all three Reg5 sources eagerly and non-consumingly before the destination write, even when the predicate outcome does not select one value.","Publish the selected value, then advance TPC by four bytes."],"standalone_opcode":true,"state_effects":["Snapshot SrcP, SrcL, and SrcR before any destination effect. Only an all-zero SrcP is false; every nonzero bit pattern is true.","For a true predicate publish the complete snapshotted SrcL. For a false predicate publish the complete snapshotted SrcR after the CSEL-specific raw modifier; negation wraps modulo 2^PTO_XLEN and does not fault.","No memory, reservation, descriptor, numeric-status, block, privilege, branch-target, or other control state changes. Successful execution advances TPC by four bytes."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-CSEL","mnemonic":"CSEL","summary":"CSEL snapshots three Reg5 sources, selects SrcL for a nonzero predicate or its optionally negated SrcR for zero, and publishes through the common scalar destination map.","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_CSEL() => ScalarOperationbegin return ScalarOperation_CSEL;end;
pure func InstructionContractRightModifier_CSEL(encoded: bits(2)) => ScalarRightModifierbegin return DecodeScalarSelectRightModifier(encoded);end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_CSEL() => ScalarSemanticHandlerbegin return ScalarHandler_ScalarConditionalSelect;end;
pure func InstructionContractFalseValue_CSEL( right: Word, encoded_modifier: bits(2)) => Wordbegin let modifier = InstructionContractRightModifier_CSEL(encoded_modifier); return ApplySelectModifier(right, modifier);end;
pure func InstructionContractResult_CSEL( predicate: Word, selected_true: Word, selected_false: Word, encoded_modifier: bits(2)) => Wordbegin let prepared_false = InstructionContractFalseValue_CSEL( selected_false, encoded_modifier); return ScalarConditionalSelect( predicate, selected_true, prepared_false);end;// DOC-END: operation
CSEL 是一条 32 位标量 ALU 指令。它谓词非零时选择左值,否则选择可选取反的右值;当前指令契约定义结果发布路径以及任何额外状态效果。
执行时先对编码输入做快照,然后谓词非零时选择左值,否则选择可选取反的右值,最后才产生目标效果。
SrcRType 在操作专属的算术或逻辑步骤之前选择右源转换方式。SrcP 是 5 位字段,通过 Reg5 选择谓词值。SrcL 是 5 位字段,选择谓词为真时使用的值。SrcR 是 5 位字段,选择谓词为假时使用的值。SrcRType 是 2 位字段,选择应用到假侧源的 CSEL 转换。RegDst 是 5 位字段,选择 Reg5 结果目标,或丢弃结果。这些角色来自当前指令契约;T/U 源只被读取和快照,不会因源选择而出队。编码零的精确含义列在下方生成的默认值章节中。
所有标量源都在目标效果前完成快照。完成后的值随后通过 RegDst 按当前标量目标映射发布。
该 ALU 操作不产生内存效果。成功完成架构效果后,TPC 前进 4 字节。
该操作不会产生隐藏的标量发布目标或隐式内存访问。架构变化仅限于当前契约列出的状态效果。
三个源都会在选择前读取;即使谓词最终不选择某一侧,该侧不可用的 T/U 源仍会在发布前触发 Fault_IllegalInstruction。
下方生成的合法性表是已分配字段值、保留编码和目标丢弃编码的权威说明。解码与源可用性检查先于架构效果完成。
本示例只用于演示当前 ASL 所有者,不替代规范操作。
以一个小型 CSEL 示例说明:谓词为 0、假侧值为 3 并选择取负转换时,发布按 2^PTO_XLEN 回绕的 -3。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
No NDF clause is attached to this unit.
12 matching entries
PTO-AVS-SCALAR-CSEL-ALIASES-001tests/asl/scalar/alu/CSEL/scalar-bound-csel-aliases-001.asl8189404df01d4047752cc85b48f3afb4f45b4d2f8283d0e71947746019405c7ePTO-AVS-SCALAR-CSEL-DECODE-001tests/asl/scalar/alu/CSEL/scalar-decode-csel-canonical-001.asld737c823173a6e5b655f0ee1e8848febf1ded43f1c578e06c1b41cd1400df00ePTO-AVS-SCALAR-CSEL-MODIFIER-001tests/asl/scalar/alu/CSEL/scalar-bound-csel-modifier-001.aslee8bbc2c9f01e69fdf27b1e237503e9c92c7e33c8ce79bec2c6492f871f3fab1PTO-AVS-SCALAR-CSEL-READINESS-001tests/asl/scalar/alu/CSEL/scalar-fault-csel-readiness-001.asl7735a3865de594610fcc151ab00b03e8630be4d6da113d36b51730ec08493343PTO-AVS-SCALAR-CSEL-SELECT-001tests/asl/scalar/alu/CSEL/scalar-exec-csel-select-001.aslfa403f1fd88912b725154984d9154320c6fac4c596c6db17358014cebafab991PTO-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/CSEL.md",
"id": "PTO-SCALAR-CSEL",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "CSEL",
"ndf_clause": "PTO-INST-SCALAR-CSEL"
},
"mnemonic": "CSEL",
"readiness_subjects": [
"ADR-0026",
"ADR-0059"
],
"semantic_tests": [
"PTO-AVS-SCALAR-CSEL-ALIASES-001",
"PTO-AVS-SCALAR-CSEL-MODIFIER-001",
"PTO-AVS-SCALAR-CSEL-READINESS-001",
"PTO-AVS-SCALAR-CSEL-SELECT-001"
],
"source": "asl/scalar/alu/CSEL.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-CSEL-ALIASES-001",
"PTO-AVS-SCALAR-CSEL-DECODE-001",
"PTO-AVS-SCALAR-CSEL-MODIFIER-001",
"PTO-AVS-SCALAR-CSEL-READINESS-001",
"PTO-AVS-SCALAR-CSEL-SELECT-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd8681279b14f86ccca58efb097e635b619db93e7d18188cf36ff488f5f8328c8c7a444ec9dcbed236471b1fd951a6f376552275254b505ae720c272328022ea6020b1basl/scalar/alu/CSEL.aslasl/scalar/alu/CSEL.asl