Skip to content

Add Zcmp extension#1026

Open
SamuelRiedel wants to merge 11 commits intochipsalliance:masterfrom
SamuelRiedel:zcmp-extension
Open

Add Zcmp extension#1026
SamuelRiedel wants to merge 11 commits intochipsalliance:masterfrom
SamuelRiedel:zcmp-extension

Conversation

@SamuelRiedel
Copy link
Contributor

@SamuelRiedel SamuelRiedel commented Dec 18, 2025

This PR adds support for the Zcmp extension, which introduces cm.push/pop and double move (cm.mv) instructions.

Because the push/pop instructions modify multiple registers and have significant side effects, this PR implements a specialized test class to generate valid sequences in a dedicated instruction stream. This class builds blocks of push and pop instructions that operate within a given stack size. Multiple blocks are generated and linked in a random order, using popret/popretz instructions to jump between them.

Note: This PR depends on PRs #1024 and #1025 and should be rebased and merged after they land. New changes from this PR: review only new commits

Those tests are used in Ibex's verification: lowRISC/ibex#2324

SamuelRiedel and others added 9 commits December 15, 2025 12:33
This commit is a cherry-pick of only the Zcb extension from Jonathan
Jonssons's commit: 5e72708

Zcb (code reduction):
since no gcc support is in the mainline assembler yet these instructions are
injected as raw data. Coverage class has been extended with these
instructions and the illegal instruction class should not be able to
generate legal Zcb instruction if the extension is enabled.

load_store_instr_lib:
Added the Zcb load and store instructions to this class.

Co-authored-by: Samuel Riedel <sriedel@lowrisc.org>"
Those registers overwrite registers other than the `rd` register. This
can lead to infinite loops. This ensures that we don't use any loop
registers for all registers modified by those instructions.
@SamuelRiedel SamuelRiedel marked this pull request as ready for review December 18, 2025 12:05
@SamuelRiedel SamuelRiedel mentioned this pull request Dec 18, 2025
Since the push/pop instructions have so many side effects, test them in
a dedicated instruction stream. This class builds blocks of push and pop
instructions, which operate withing a given stack size. Multiple such
blocks are generated and linked in a random order. To jump between these
blocks, we use the popret/popretz instructions.
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.

3 participants