Skip to content

Conversation

Copy link

Copilot AI commented Oct 28, 2025

Instructions with assembly: "" (e.g., fence.i, ebreak, wfi) were missing the Assembly section in the generated instruction appendix due to a conditional check that hid the section entirely when the assembly field was empty.

Changes

  • backends/instructions_appendix/templates/instructions.adoc.erb: Removed conditional that hid Assembly section when inst.assembly was empty
  • All instruction templates: Added .strip to assembly string concatenations to remove trailing whitespace

Result

 == fence.i
 
 Synopsis::
 Instruction fence
 
+Assembly::
+fence.i
+
 Encoding::

Instructions with no variables now display Assembly:: <instruction_name> instead of omitting the section entirely.

Original prompt

This section details on the original issue you should resolve

<issue_title>Assembly is not shown in generated instruction appendix if there are no variables</issue_title>
<issue_description>Describe the bug
When there are no variables in an instruction, the assembly field of the instruction yaml uses "" as the assembly string because the assembly is automatically prefixed with the instruction name. When the assembly field is set to the empty string, it does not appear in the generated instruction appendix.

For example, sext.h produces the following:

[#udb:doc:inst:sext_h]
== sext.h

Synopsis::
Sign-extend halfword

Assembly::
sext.h xd, xs1

Encoding::
[wavedrom, ,svg,subs='attributes',width="100%"]
....
{"reg":[{"bits":7,"name": 0x13,"type":2},{"bits":5,"name": "xd","type":4},{"bits":3,"name": 0x1,"type":2},{"bits":5,"name": "xs1","type":4},{"bits":12,"name": 0x605,"type":2}]}
....

while fence.i produces

[#udb:doc:inst:fence_i]
== fence.i

Synopsis::
Instruction fence

Encoding::
[wavedrom, ,svg,subs='attributes',width="100%"]
....
{"reg":[{"bits":7,"name": 0xf,"type":2},{"bits":5,"name": "xd","type":4},{"bits":3,"name": 0x1,"type":2},{"bits":5,"name": "xs1","type":4},{"bits":12,"name": "imm","type":4}]}
....

An empty assembly string should still produce an assembly section in the output. It should just contain the name of the instruction.
</issue_description>

<agent_instructions>Look at the differente backend/ erb instruction templates and see which ones may produce this bug. then create a PR to fix them all. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@AFOliveira To fix this, we need to change the .erb template that produces that. Can you specify in which document you found that?

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Remove conditional check that hides Assembly section when assembly field is empty.
Now instructions like fence.i will properly show "Assembly:: fence.i" in the
instruction appendix instead of omitting the section entirely.

Co-authored-by: AFOliveira <[email protected]>
Copy link
Collaborator

@AFOliveira AFOliveira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is quite accurate, I'm just not sure if this will show "" instead of emptyness after the instruction name

…templates

- Remove conditional check in instructions_appendix that was hiding Assembly section
- Add .strip to all assembly concatenations to remove trailing whitespace
- Ensures instructions with no variables (like fence.i) properly show Assembly section

Co-authored-by: AFOliveira <[email protected]>
@AFOliveira
Copy link
Collaborator

@jordancarlin Would you be willing to test what our Copilot friend produced? I'm very low on time. I think the first commit may be enough, though

Copilot AI changed the title [WIP] Fix assembly not shown in instruction appendix when empty Fix missing Assembly section for instructions with no variables Oct 28, 2025
Copilot AI requested a review from AFOliveira October 28, 2025 20:49
Copilot finished work on behalf of AFOliveira October 28, 2025 20:49
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.05%. Comparing base (e4e85ce) to head (48755cd).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1212   +/-   ##
=======================================
  Coverage   46.05%   46.05%           
=======================================
  Files          11       11           
  Lines        4942     4942           
  Branches     1345     1345           
=======================================
  Hits         2276     2276           
  Misses       2666     2666           
Flag Coverage Δ
idlc 46.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AFOliveira AFOliveira changed the title Fix missing Assembly section for instructions with no variables fix: missing Assembly section for instructions with no variables Oct 29, 2025
Copy link
Collaborator

@AFOliveira AFOliveira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the failing CI test

@dhower-qc
Copy link
Collaborator

Do you know what triggered this?

@AFOliveira
Copy link
Collaborator

@dhower-qc I'm playing with CoPilot :)

@dhower-qc
Copy link
Collaborator

nifty

@jordancarlin
Copy link
Contributor

@jordancarlin Would you be willing to test what our Copilot friend produced? I'm very low on time. I think the first commit may be enough, though

We should be able to tell if it worked correctly based on how the golden instruction appendix changes in the GitHub diff (though it looks like that wasn’t updated here) without having to test anything locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assembly is not shown in generated instruction appendix if there are no variables

4 participants