Operands and parameters
uimm5- unsigned five-bit halfword displacement from the pre-increment TPC
Materialize an unsigned halfword-scaled TPC-relative return address in ra and captured return state.
PTO-SCALAR-C-SETRETc.setret uimm, ->ra| Field | Bits | Signedness | Architectural role | Encoded zero |
|---|---|---|---|---|
uimm5 | 5 | unsigned | unsigned five-bit halfword displacement from the pre-increment TPC | Encoded zero supplies numeric zero for the 5-bit unsigned immediate. |
Loading WaveDrom diagram… The encoding table and WaveJSON remain available below.
| Decoded item | Bit range | Value |
|---|---|---|
| Constant | 15:11 | 5'b01010 |
| uimm5 | 10:6 | variable |
| Constant | 5:0 | 6'b010110 |
{
"reg": [
{
"bits": 6,
"name": "6'b010110"
},
{
"bits": 5,
"name": "uimm5"
},
{
"bits": 5,
"name": "5'b01010"
}
],
"config": {
"bits": 16,
"fontsize": 13,
"hspace": 640,
"lanes": 1,
"offset": 0
}
}c.setret uimm, ->ra
uimm5This Operation comes directly from the instruction owner; the page does not rewrite its behavior.
readonly func InstructionContractOperation_C_SETRET() => ScalarOperationbegin return ScalarOperation_C_SETRET;end;readonly func InstructionContractHandler_C_SETRET() => ScalarSemanticHandlerbegin return ScalarHandler_SetReturnAddress;end;
pure func InstructionContractTarget_C_SETRET( tpc: Word, uimm5: bits(5)) => Wordbegin let halfword_offset = ZeroExtend{PTO_XLEN}(uimm5); return tpc + LSL(halfword_offset, 1);end;// PTO-INSTRUCTION: {"assembly":["c.setret uimm, ->ra"],"block":[],"catalog_indices":[38],"catalog_records":[{"asm":"c.setret uimm, ->ra","constraints":[],"encoding":[{"index":0,"mask":"0xf83f","match":"0x5016","width_bits":16}],"encoding_kind":"C16","fields":[{"name":"uimm5","pieces":[{"instruction_lsb":6,"value_lsb":0,"width":5}],"signedness":"unsigned","width":5}],"form_id":"c_setret_16_335651ef6c27","length_bits":16,"mnemonic":"C.SETRET","semantic_family":"ALU","semantic_group":"ALU","semantic_handler":"SetReturnAddress","semantic_summary":"Materialize an unsigned halfword-scaled TPC-relative return address in ra and captured return state.","status":"accepted"}],"classification":["alu"],"contract":{"block_composition":["Standalone scalar return-address materialization. Fused BSTART.CALL and BSTART.ICALL define call formation separately."],"canonical_assembly":["c.setret uimm, ->ra"],"defaults":["C.SETRET has no omitted field. Encoded uimm5 zero is the real zero displacement and materializes the address of C.SETRET itself."],"encoding_class":"standalone-encoded","examples":["c.setret 0, ->ra","c.setret 31, ->ra"],"exceptions":["All uimm5 values are legal. C.SETRET performs no target dereference and raises no alignment, memory, arithmetic, or block-control exception."],"field_contracts":{},"field_zero_meanings":{"uimm5":"Encoded zero supplies numeric zero for the 5-bit unsigned immediate."},"legality":["Every uimm5 value 0..31 is assigned. The fixed destination is architectural ra (GPR10).","C.SETRET is legal as a standalone scalar operation and does not by itself form a call."],"memory_effects":["none"],"operands":[{"field":"uimm5","role":"unsigned five-bit halfword displacement from the pre-increment TPC"}],"ordering":["Snapshot the pre-increment TPC, compute the target, publish ra and captured return state together, then perform the ordinary two-byte sequential TPC advance."],"standalone_opcode":true,"state_effects":["Compute target = pre-increment TPC + (ZeroExtend(uimm5) << 1) with XLEN wrapping.","Atomically write the same target to GPR10 ra and the captured return-address state; successful dispatch then advances TPC by two bytes.","A later ordinary write to ra does not retroactively change the captured return-address state."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-C-SETRET","mnemonic":"C.SETRET","summary":"Materialize an unsigned halfword-scaled TPC-relative return address in ra and captured return state.","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-C-SETRET-DECISION-BINDING-001// ndf: kind=contract level=L1 layer=scalar status=accepted// C.SETRET MUST implement the mnemonic-local canonical assembly, encoded// legality, defaults, state and memory effects, ordering, and fault boundaries// declared in this owner. The operation region below is the executable binding// for every accepted decision that names this mnemonic.// NDF-END: PTO-C-SETRET-DECISION-BINDING-001// DOC-BEGIN: decodereadonly func InstructionContractOperation_C_SETRET() => ScalarOperationbegin return ScalarOperation_C_SETRET;end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_C_SETRET() => ScalarSemanticHandlerbegin return ScalarHandler_SetReturnAddress;end;
pure func InstructionContractTarget_C_SETRET( tpc: Word, uimm5: bits(5)) => Wordbegin let halfword_offset = ZeroExtend{PTO_XLEN}(uimm5); return tpc + LSL(halfword_offset, 1);end;// DOC-END: operation
C.SETRET is a 16-bit scalar ALU instruction. It forms the halfword-scaled TPC-relative return address and records it in both the return register and captured return state; its current instruction contract defines the result publication path and any additional state effect.
Execution snapshots the encoded inputs, then forms the halfword-scaled TPC-relative return address and records it in both the return register and captured return state, and only afterward performs the destination effects.
uimm5 field carries the unsigned five-bit halfword displacement from the pre-increment TPC.These roles come from the current instruction contract. T/U sources are read and snapshotted without being removed from their queues; exact encoded-zero meanings appear in the generated defaults below.
The return address is computed before the return register and captured return state are updated.
This ALU operation has no memory effect. After its successful architectural effects, TPC advances by 2 bytes.
The operation does not introduce a hidden scalar publication target or an implicit memory access. Architectural changes remain limited to the state effects enumerated by the current contract.
Every encoded immediate is assigned; the instruction does not dereference the target and does not form a call by itself.
The generated legality table is authoritative for assigned field values, reserved encodings, and destination discard codes. Decode and source availability are checked before architectural effects.
This example illustrates the current ASL owner and does not replace the normative operation.
For a small C.SETRET example, pre-increment TPC=0x100 and uimm5=1 produce return address 0x102 in both ra and captured return state.
Bodies come from owning ASL. Dragging or buttons change only this page-session view order.
C.SETRET MUST implement the mnemonic-local canonical assembly, encoded legality, defaults, state and memory effects, ordering, and fault boundaries declared in this owner. The operation region below is the executable binding for every accepted decision that names this mnemonic.
PTO-C-SETRET-DECISION-BINDING-001asl/scalar/alu/C.SETRET.asl29c606a2143d6d42dd0b017f4e20702dc44bcbac3096030e17074b1cdc4f737aa67b15cf5f9c694f735af1d640395370f308137c594e2be403c0478afe7c39d513 matching entries
PTO-AVS-SCALAR-C-SETRET-BOUND-001tests/asl/scalar/alu/C.SETRET/scalar-exec-c-setret-boundary-001.aslc5cfa44f0986fe79fffbe2b021520ae5d492fab407ff686b9f860c43d2b5c1bfPTO-AVS-SCALAR-C-SETRET-DECODE-001tests/asl/scalar/alu/C.SETRET/scalar-decode-c-setret-canonical-001.asl274a42a4ba17e2e73efbc37492e61f6eb8c56704fed5d8957b83bb184ef95300PTO-AVS-SCALAR-C-SETRET-WRAP-001tests/asl/scalar/alu/C.SETRET/scalar-exec-c-setret-wrap-001.asl9d5c87121864dd36a6d1f4a59679957cdfabd8d528bf5842696a3f7cf292d38cPTO-AVS-SCALAR-C-SETRET-ZERO-001tests/asl/scalar/alu/C.SETRET/scalar-bound-c-setret-zero-001.asld179022443011d9418c27acef0b78c3ed4dc265f8b2a27da04bf40a097159149PTO-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-0021…
ADR-0021docs/status/decisions/0021-scalar-pc-relative-and-return-address.md99c06f12ee973312181938672a9e059a0dc5a0c4e08effd666616b8006e5f5f9Loading 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.mdf18d13f735cfaf9f2803c754c5818f4af33d1cc42c489f0d9ce060b07bb3a196Loading ADR-0084…
ADR-0084docs/status/decisions/0084-scalar-system-and-queue-operations.mde068992fa81e2c4ac46e492391a2f784141d68e041bf0b9e0586c37217d1e08c{
"classification": [
"alu"
],
"documentation": "docs/scalar/alu/C.SETRET.md",
"id": "PTO-SCALAR-C-SETRET",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "C.SETRET",
"ndf_clause": "PTO-INST-SCALAR-C-SETRET"
},
"mnemonic": "C.SETRET",
"readiness_subjects": [
"ADR-0021",
"ADR-0026",
"ADR-0059",
"ADR-0084"
],
"semantic_tests": [
"PTO-AVS-SCALAR-C-SETRET-BOUND-001",
"PTO-AVS-SCALAR-C-SETRET-WRAP-001",
"PTO-AVS-SCALAR-C-SETRET-ZERO-001"
],
"source": "asl/scalar/alu/C.SETRET.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-C-SETRET-BOUND-001",
"PTO-AVS-SCALAR-C-SETRET-DECODE-001",
"PTO-AVS-SCALAR-C-SETRET-WRAP-001",
"PTO-AVS-SCALAR-C-SETRET-ZERO-001"
]
}0.58.5 · Release candidate7dc8b7e5b121d2b2499a2273bebff29e2cd8681229c606a2143d6d42dd0b017f4e20702dc44bcbac3096030e17074b1cdc4f737a6764b2988380d4c1dc471879ce8aaebd8d24f36cd7c08310750e8c47132a89a9asl/scalar/alu/C.SETRET.aslasl/scalar/alu/C.SETRET.aslasl/scalar/alu/C.SETRET.asl