Operands and parameters
RegDst- Reg5 destination or discard
SrcL- Reg5 base source
SrcR- Reg5 insertion source
immr- first destination bit
imms- last destination bit
HL.BFI inserts ascending low source bits into an inclusive wrapping destination interval of a snapshotted base value and publishes the XLEN result.
PTO-SCALAR-HL-BFIhl.bfi SrcL, SrcR, M, N, ->{t, u, Rd}| Field | Bits | Signedness | Architectural role | Encoded zero |
|---|---|---|---|---|
RegDst | 5 | encoding-defined | Reg5 destination or discard | Encoded zero discards the result. |
SrcL | 5 | encoding-defined | Reg5 base source | Encoded zero reads the architectural zero GPR base. |
SrcR | 5 | encoding-defined | Reg5 insertion source | Encoded zero reads the architectural zero GPR insertion source. |
immr | 6 | encoding-defined | first destination bit | Encoded zero begins the destination interval at bit zero. |
imms | 6 | encoding-defined | last destination bit | Encoded zero ends the destination interval at bit zero. |
Loading WaveDrom diagram… The encoding table and WaveJSON remain available below.
| Decoded item | Bit range | Value |
|---|---|---|
| Constant | 47:41 | 7'b0000000 |
| SrcR | 40:36 | variable |
| SrcL | 35:31 | variable |
| Constant | 30:28 | 3'b010 |
| RegDst | 27:23 | variable |
| Constant | 22:16 | 7'b1001101 |
| imms | 15:10 | variable |
| immr | 9:4 | variable |
| Constant | 3:0 | 4'b1110 |
{
"reg": [
{
"bits": 4,
"name": "4'b1110"
},
{
"bits": 6,
"name": "immr"
},
{
"bits": 6,
"name": "imms"
},
{
"bits": 7,
"name": "7'b1001101"
},
{
"bits": 5,
"name": "RegDst"
},
{
"bits": 3,
"name": "3'b010"
},
{
"bits": 5,
"name": "SrcL"
},
{
"bits": 5,
"name": "SrcR"
},
{
"bits": 7,
"name": "7'b0000000"
}
],
"config": {
"bits": 48,
"fontsize": 13,
"hspace": 900,
"lanes": 2,
"offset": 0
}
}hl.bfi SrcL, SrcR, M, N, ->{t, u, Rd}
RegDstSrcLSrcRimmrimmsThis Operation comes directly from the instruction owner; the page does not rewrite its behavior.
readonly func InstructionContractOperation_HL_BFI() => ScalarOperationbegin return ScalarOperation_HL_BFI;end;
pure func InstructionContractFirstBit_HL_BFI(encoded_immr: bits(6)) => integer {0..63}begin return UInt(encoded_immr);end;
pure func InstructionContractLastBit_HL_BFI(encoded_imms: bits(6)) => integer {0..63}begin return UInt(encoded_imms);end;readonly func InstructionContractHandler_HL_BFI() => ScalarSemanticHandlerbegin return ScalarHandler_InsertBitfield;end;
pure func InstructionContractResult_HL_BFI( base: Word, source: Word, first: integer {0..63}, last: integer {0..63}) => Wordbegin return InsertBitfield( base, source, first, last);end;// PTO-INSTRUCTION: {"assembly":["hl.bfi SrcL, SrcR, M, N, ->{t, u, Rd}"],"block":[],"catalog_indices":[122],"catalog_records":[{"asm":"hl.bfi SrcL, SrcR, M, N, ->{t, u, Rd}","constraints":[],"encoding":[{"index":0,"mask":"0xfe00707f000f","match":"0x0000204d000e","width_bits":48}],"encoding_kind":"HL48","fields":[{"name":"RegDst","pieces":[{"instruction_lsb":23,"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":"immr","pieces":[{"instruction_lsb":4,"value_lsb":0,"width":6}],"signedness":"encoding-defined","width":6},{"name":"imms","pieces":[{"instruction_lsb":10,"value_lsb":0,"width":6}],"signedness":"encoding-defined","width":6}],"form_id":"hl_bfi_48_8adfd476aacc","length_bits":48,"mnemonic":"HL.BFI","semantic_family":"ALU","semantic_group":"ALU","semantic_handler":"InsertBitfield","semantic_summary":"HL.BFI inserts ascending low source bits into an inclusive wrapping destination interval of a snapshotted base value and publishes the XLEN result.","status":"accepted"}],"classification":["alu"],"contract":{"block_composition":["none"],"canonical_assembly":["hl.bfi SrcL, SrcR, M, N, ->{t, u, Rd}"],"defaults":["SrcL, SrcR, immr, imms, and RegDst are required encoded fields; no field can be omitted.","immr directly encodes the first destination bit from 0 through 63. imms directly encodes the last destination bit from 0 through 63.","When imms precedes immr, the inclusive destination interval wraps through bit 63 to bit 0. Equal endpoints select one destination bit."],"encoding_class":"standalone-encoded","examples":["hl.bfi a0, a1, 8, 15, ->a2","hl.bfi t#1, u#1, 63, 0, ->t","hl.bfi a0, zero, 0, 63, ->a0"],"exceptions":["An unavailable selected T/U source raises Fault_IllegalInstruction before the destination effect and before TPC advances. Both sources are preflighted even when their encoded values are equal.","HL.BFI 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 base.","SrcR":"Encoded zero reads the architectural zero GPR insertion source.","immr":"Encoded zero begins the destination interval at bit zero.","imms":"Encoded zero ends the destination interval at bit zero."},"legality":["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.","RegDst codes 0 and 24..29 discard, codes 1..23 write GPRs, code 30 pushes U, and code 31 pushes T.","Every immr and imms value is assigned. The inclusive wrapping interval has a width from 1 through 64."],"memory_effects":["none"],"operands":[{"field":"RegDst","role":"Reg5 destination or discard"},{"field":"SrcL","role":"Reg5 base source"},{"field":"SrcR","role":"Reg5 insertion source"},{"field":"immr","role":"first destination bit"},{"field":"imms","role":"last destination bit"}],"ordering":["Snapshot both sources before any destination effect, including when RegDst aliases SrcL or SrcR.","Publish the result, then advance TPC by six bytes."],"standalone_opcode":true,"state_effects":["Snapshot the base and insertion sources. Starting with source bit zero, replace ascending bits of the inclusive destination interval from immr through imms, wrapping through bit 63 when required; preserve every base bit outside that interval.","Publish the complete XLEN result through the common Reg5 destination map. Relative sources are non-consuming; only a T or U destination push changes a temporary queue.","No memory, reservation, descriptor, numeric-status, block, privilege, branch-target, or other control state changes. Successful execution advances TPC by six bytes."]},"depends_on":["PTO-BLOCK-MODEL-SCHEMA-PROFILE-ENCODING"],"id":"PTO-SCALAR-HL-BFI","mnemonic":"HL.BFI","summary":"HL.BFI inserts ascending low source bits into an inclusive wrapping destination interval of a snapshotted base value and publishes the XLEN result.","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-HL-BFI-DECISION-BINDING-001// ndf: kind=contract level=L1 layer=scalar status=accepted// HL.BFI 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-HL-BFI-DECISION-BINDING-001// DOC-BEGIN: decodereadonly func InstructionContractOperation_HL_BFI() => ScalarOperationbegin return ScalarOperation_HL_BFI;end;
pure func InstructionContractFirstBit_HL_BFI(encoded_immr: bits(6)) => integer {0..63}begin return UInt(encoded_immr);end;
pure func InstructionContractLastBit_HL_BFI(encoded_imms: bits(6)) => integer {0..63}begin return UInt(encoded_imms);end;// DOC-END: decode// DOC-BEGIN: operationreadonly func InstructionContractHandler_HL_BFI() => ScalarSemanticHandlerbegin return ScalarHandler_InsertBitfield;end;
pure func InstructionContractResult_HL_BFI( base: Word, source: Word, first: integer {0..63}, last: integer {0..63}) => Wordbegin return InsertBitfield( base, source, first, last);end;// DOC-END: operation
HL.BFI is a 48-bit scalar ALU instruction. It inserts ascending low source bits into the selected inclusive wrapping interval of the base value; its current instruction contract defines the result publication path and any additional state effect.
Execution snapshots the encoded inputs, then inserts ascending low source bits into the selected inclusive wrapping interval of the base value, and only afterward performs the destination effects.
RegDst field selects the Reg5 result target or discards the result.SrcL field selects the base value through Reg5.SrcR field selects the insertion bits through Reg5.immr field encodes the inclusive interval first destination bit.imms field encodes the inclusive interval last destination bit.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.
Every scalar source is snapshotted before the destination effect. The completed value is then routed only through RegDst using the current scalar destination map; immr and imms select the insertion interval and are not publication targets.
This ALU operation has no memory effect. After its successful architectural effects, TPC advances by 6 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.
Field selection may wrap from bit 63 to bit 0; the generated defaults and legality tables below give the exact width and starting-position encodings.
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 HL.BFI example, base 0, insertion source 0x7, immr=2, and imms=4 produce result 0x1c.
Bodies come from owning ASL. Dragging or buttons change only this page-session view order.
HL.BFI 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-HL-BFI-DECISION-BINDING-001asl/scalar/alu/HL.BFI.asl5ef936119d4b1988d9a1acdfc5cb8fcd4263e4d18f1aab26cbe49c0335f3f4f743af873e0d006a808b459bc85225bf45cc67bdbea966b38e1783dca2736d5b1612 matching entries
PTO-AVS-SCALAR-HL-BFI-ALIAS-001tests/asl/scalar/alu/HL.BFI/scalar-bound-hl-bfi-alias-001.asl05b8c4cddabdbe70f3ea26c6708723614d649f3d9f1eed3421e2b3ed89cdca85PTO-AVS-SCALAR-HL-BFI-DECODE-001tests/asl/scalar/alu/HL.BFI/scalar-decode-hl-bfi-canonical-001.aslfbba9f1e8d38613b6e05b84a34e3dc0f44b7a60ef8fa423266ae1b0561119fa0PTO-AVS-SCALAR-HL-BFI-READINESS-001tests/asl/scalar/alu/HL.BFI/scalar-fault-hl-bfi-readiness-001.asl1f064e3a3f79b82cba0a13effdf79e286c78213ffe42a69c5c7f406198cb9fa5PTO-AVS-SCALAR-HL-BFI-WRAP-001tests/asl/scalar/alu/HL.BFI/scalar-exec-hl-bfi-wrap-001.aslc7d8487a53434a07c39824b49a21505e7d310b41699b0737d21840e8ff5f2169PTO-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.mdf18d13f735cfaf9f2803c754c5818f4af33d1cc42c489f0d9ce060b07bb3a196Loading ADR-0084…
ADR-0084docs/status/decisions/0084-scalar-system-and-queue-operations.mde068992fa81e2c4ac46e492391a2f784141d68e041bf0b9e0586c37217d1e08c{
"classification": [
"alu"
],
"documentation": "docs/scalar/alu/HL.BFI.md",
"id": "PTO-SCALAR-HL-BFI",
"instruction_contract": {
"artifact": "spec/evidence/instruction-contract-closure.json",
"mnemonic": "HL.BFI",
"ndf_clause": "PTO-INST-SCALAR-HL-BFI"
},
"mnemonic": "HL.BFI",
"readiness_subjects": [
"ADR-0026",
"ADR-0059",
"ADR-0084"
],
"semantic_tests": [
"PTO-AVS-SCALAR-HL-BFI-ALIAS-001",
"PTO-AVS-SCALAR-HL-BFI-READINESS-001",
"PTO-AVS-SCALAR-HL-BFI-WRAP-001"
],
"source": "asl/scalar/alu/HL.BFI.asl",
"surface": "scalar",
"tests": [
"PTO-AVS-SCALAR-HL-BFI-ALIAS-001",
"PTO-AVS-SCALAR-HL-BFI-DECODE-001",
"PTO-AVS-SCALAR-HL-BFI-READINESS-001",
"PTO-AVS-SCALAR-HL-BFI-WRAP-001"
]
}0.58.5 · Release candidate7dc8b7e5b121d2b2499a2273bebff29e2cd868125ef936119d4b1988d9a1acdfc5cb8fcd4263e4d18f1aab26cbe49c0335f3f4f7da6b9097c2636ddeeb433c3d216412ccb9c0f8ab2c4d66f80df4febac2a4e8a2asl/scalar/alu/HL.BFI.aslasl/scalar/alu/HL.BFI.aslasl/scalar/alu/HL.BFI.asl