feat(qc_iu): Add Xqccmi custom compressed instruction lookup table extension#1802
Merged
ThinkOpenly merged 12 commits intoriscv:mainfrom May 4, 2026
Merged
feat(qc_iu): Add Xqccmi custom compressed instruction lookup table extension#1802ThinkOpenly merged 12 commits intoriscv:mainfrom
ThinkOpenly merged 12 commits intoriscv:mainfrom
Conversation
…tension Introduces the Xqccmi extension for the qc_iu configuration. Xqccmi improves code density by replacing frequently-used 32-bit (and wider) instructions with a single 16-bit lookup instruction, qc.cm.ilut, that fetches and executes the original instruction from a table in memory. The table (Instruction Lookup Table, ILUT) is an array of entries in memory whose base address is configured by a new CSR, qc.itba. A linker or post-processing tool populates the table with the most-used instruction encodings and replaces each occurrence in the code stream with a 16-bit qc.cm.ilut instruction carrying an 11-bit index (0..2047) into the table. The net effect is that a 32-bit or wider instruction is replaced by a 16-bit one wherever it appears, reducing code size. Each table entry can hold one or two packed instructions: - A 32-bit entry holds one 32-bit instruction, or two 16-bit instructions - A 64-bit entry (double entry) holds combinations up to 64 bits total, including 48-bit Xqci instructions. The number of leading 64-bit entries is configured by a second new CSR, qc.itdec. When a table entry contains two instructions and the second instruction causes an exception or double trap, bit 0 of mepc (or mnepc) is set to 1. This allows software to identify which instruction within the entry was the source of the fault, enabling precise exception handling and software emulation of absent instructions. qc.cm.ilut uses the same encoding as c.fld and is therefore mutually exclusive with the Zcd extension. Key changes: - Added extension definition: spec/custom/isa/qc_iu/ext/Xqccmi.yaml - Added instruction: spec/custom/isa/qc_iu/inst/Xqccmi/qc.cm.ilut.yaml - Added CSR qc.itba (0x800): spec/custom/isa/qc_iu/csr/Xqccmi/qc.itba.yaml - Added CSR qc.itdec (0x801): spec/custom/isa/qc_iu/csr/Xqccmi/qc.itdec.yaml - Updated cfgs/qc_iu.yaml to include Xqccmi v0.1.0 Signed-off-by: Albert Yosher <181945086+ayosher@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1802 +/- ##
=======================================
Coverage 72.21% 72.21%
=======================================
Files 52 52
Lines 27740 27740
Branches 6012 6012
=======================================
Hits 20033 20033
Misses 7707 7707
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dhower-qc
approved these changes
Apr 29, 2026
ThinkOpenly
reviewed
Apr 29, 2026
Collaborator
Author
|
Hi,
I know, and I did for some bitfields.
In the specific case, I want to declare these bits as "mode" to be forward compatible and visible in the generated PDF doc.
Is this an issue?
Albert
________________________________
From: Paul Clarke ***@***.***>
Sent: Wednesday, April 29, 2026 9:24 PM
To: riscv/riscv-unified-db ***@***.***>
Cc: Albert Yosher (QUIC) ***@***.***>; Author ***@***.***>
Subject: Re: [riscv/riscv-unified-db] feat(qc_iu): Add Xqccmi custom compressed instruction lookup table extension (PR #1802)
WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.
@ThinkOpenly commented on this pull request.
________________________________
In spec/custom/isa/qc_iu/csr/Xqccmi/qc.itba.yaml<#1802 (comment)>:
+ mode:
+ location: 5-0
+ type: RO
+ reset_value: 0
+ description: |
+ Reserved for future use. Always reads as zero. Writes are ignored.
You probably don't need to specify this. Undefined bits default to reserved, read-only.
—
Reply to this email directly, view it on GitHub<#1802 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BLMEF7WF43BL64XEPAQOSCT4YJCGZAVCNFSM6AAAAACYD4U7SSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DCOJZGY2DKOBQG4>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
ThinkOpenly
reviewed
Apr 29, 2026
Custom extensions in development state are never formally ratified; the `ratification_date` field is not applicable. Remove it per review feedback. Signed-off-by: Albert Yosher <ayosher@qti.qualcomm.com>
auto-merge was automatically disabled
April 29, 2026 18:55
Head branch was pushed to by a user without write access
ThinkOpenly
reviewed
Apr 29, 2026
ThinkOpenly
reviewed
Apr 29, 2026
ThinkOpenly
reviewed
Apr 29, 2026
ThinkOpenly
reviewed
Apr 29, 2026
ThinkOpenly
reviewed
Apr 29, 2026
qc.itba: use location_rv32/location_rv64 instead of a single location field for the BASE field, matching the description text "bits[XLEN-1:6]" and the pattern used in the standard jvt.yaml. qc.itdec: replace variable name N with DEC throughout the description text to avoid using two names for the same field. qc.cm.ilut: add PC-relative instruction detection and proper mepc/mnepc bit 0 encoding for exception slot attribution: - Add is_pc_relative_inst?() to qc_iu globals.isa: detects forbidden PC-relative instructions in ILUT entries across all encoding widths: 16-bit compressed (c.j, c.jal, c.jr, c.jalr, c.beqz, c.bnez), 32-bit (auipc, jal, jalr, branches), and 48-bit Xqci (qc.e.j, qc.e.jal, qc.e.beqi/bnei/blti/bgei/ bltui/bgeui). Implemented as a named reusable function rather than inline opcode checks, so future instructions are handled by updating one place. - Add ilut_second_inst global boolean and raise_ilut() function to qc_iu globals.isa. raise_ilut() is a simplified M-mode-only variant of raise_precise() that sets mepc.PC (or mnepc.PC for a double-trap) to $pc | (ilut_second_inst ? 1 : 0), encoding which packed instruction slot caused the exception in bit 0. - Replace all raise() calls in qc.cm.ilut operation() with raise_ilut(), setting ilut_second_inst appropriately before each call: false for the first instruction slot (48-bit doesn't fit, first PC-relative check, first instruction execution), true for the second instruction slot (second PC-relative check, second instruction execution). - Add mepc.yaml and Smrnmi/mnepc.yaml overlays for qc_iu to remove the standard bit-0 mask on sw_write and sw_read, allowing raise_ilut() to preserve bit 0 of mepc/mnepc. All changes validated: test:schema, test:inst_encodings, test:idl CFG=qc_iu, and bin/regress --tag smoke (11/11) pass. Signed-off-by: Albert Yosher <181945086+ayosher@users.noreply.github.com>
ThinkOpenly
reviewed
May 1, 2026
ThinkOpenly
reviewed
May 1, 2026
ThinkOpenly
reviewed
May 1, 2026
ThinkOpenly
reviewed
May 1, 2026
ThinkOpenly
reviewed
May 1, 2026
- Xqccmi.yaml: add top-level requirements to express mutual exclusivity with Zcd extension - qc.cm.ilut.yaml: initialize entry_hi = 32'b0 (remove else branch); rename has_second -> has_second_inst with inline comment; rename ilut_second_inst -> executing_second_inst throughout; clean up duplicate/stale comments in execution blocks; clarify that IDL cannot express dynamic instruction dispatch - globals.isa: rename ilut_second_inst -> executing_second_inst; update declaration comment to reflect new name and purpose Files modified: - spec/custom/isa/qc_iu/ext/Xqccmi.yaml - spec/custom/isa/qc_iu/inst/Xqccmi/qc.cm.ilut.yaml - spec/custom/isa/qc_iu/isa/globals.isa
ThinkOpenly
reviewed
May 4, 2026
ThinkOpenly
reviewed
May 4, 2026
ThinkOpenly
reviewed
May 4, 2026
Signing off review comment requested change Co-authored-by: Paul Clarke <ThinkOpenly@gmail.com> Signed-off-by: ayosher <181945086+ayosher@users.noreply.github.com>
Signing off review comment requested change Co-authored-by: Paul Clarke <ThinkOpenly@gmail.com> Signed-off-by: ayosher <181945086+ayosher@users.noreply.github.com>
ThinkOpenly
reviewed
May 4, 2026
- qc.cm.ilut.yaml: mark unpredictable() calls as TO-DO to make clear they are placeholders pending a real execute_instruction() builtin - globals.isa: fix bug in is_pc_relative_inst?() — c.jr, c.jalr, and 32-bit jalr are register-indirect jumps, not PC-relative; remove them from the forbidden instruction list and update the description Signed-off-by: Albert Yosher <181945086+ayosher@users.noreply.github.com>
ThinkOpenly
reviewed
May 4, 2026
ThinkOpenly
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces the Xqccmi extension for the qc_iu configuration. Xqccmi improves code density by replacing frequently-used 32-bit (and wider) instructions with a single 16-bit lookup instruction, qc.cm.ilut, that fetches and executes the original instruction from a table in memory.
The table (Instruction Lookup Table, ILUT) is an array of entries in memory whose base address is configured by a new CSR, qc.itba. A linker or post-processing tool populates the table with the most-used instruction encodings and replaces each occurrence in the code stream with a 16-bit qc.cm.ilut instruction carrying an 11-bit index (0..2047) into the table. The net effect is that a 32-bit or wider instruction is replaced by a 16-bit one wherever it appears, reducing code size.
Each table entry can hold one or two packed instructions:
When a table entry contains two instructions and the second instruction causes an exception or double trap, bit 0 of mepc (or mnepc) is set to
qc.cm.ilut uses the same encoding as c.fld and is therefore mutually exclusive with the Zcd extension.
Key changes: