Skip to content

Zbb extension integration + opcode restructuring#260

Merged
TheDeepestSpace merged 43 commits into
UTOSS:mainfrom
nsinghal06:main
Jul 11, 2026
Merged

Zbb extension integration + opcode restructuring#260
TheDeepestSpace merged 43 commits into
UTOSS:mainfrom
nsinghal06:main

Conversation

@nsinghal06

Copy link
Copy Markdown
Contributor

No description provided.

@TheDeepestSpace

Copy link
Copy Markdown
Member

for ci.yaml workflow:

  - name: Run RISCOF
-         run: |
-          if make riscof_run UTOSS_RISCV_CONFIG=${{ matrix.config }}; then
-            :
-          else
-            case "${{ matrix.config }}" in
-              *B*)
-                echo "RISCOF failed for B-containing config; allowing failure."
-                ;;
-              *)
-                exit 1
-                ;;
-            esac
-          fi
+         run: make riscof_run UTOSS_RISCV_CONFIG=${{ matrix.config }}

Comment thread src/modules/Instruction_Decode/Instruction_Decode.sv
Comment on lines +159 to +161
//verilator lint_off UNUSEDSIGNAL

//verilator lint_on UNUSEDSIGNAL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can probably remove those

Suggested change
//verilator lint_off UNUSEDSIGNAL
//verilator lint_on UNUSEDSIGNAL

@TheDeepestSpace TheDeepestSpace changed the title Zbb extension Zbb extension integration Jul 7, 2026
@TheDeepestSpace TheDeepestSpace linked an issue Jul 7, 2026 that may be closed by this pull request
Comment thread src/ext/b/decoder.sv
localparam bit [6:0] FUNCT7_ZBA = 7'b0010000;
localparam bit [6:0] FUNCT7_ZBB__LOGICAL = 7'b0100000;
localparam bit [6:0] FUNCT7_ZBB__MINMAX = 7'b0000101;
localparam bit [6:0] FUNCT7_ZBB__SEXT = 7'b0110000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why are we removing this one? i guess its not technically and operations since its either .B or .H, but i think we have the same patter for other instructions that get grouped by opcode

Comment thread src/ext/b/decoder.sv Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ohh i think i understand why you added rs2 to the main decoder, lemme take a closer look at that and get back to you. this is a bit confusing to me since clz for example is an I-type instruction and is not supposed to have an rs2, but this is where the instruction designation is stored.

@TheDeepestSpace TheDeepestSpace changed the title Zbb extension integration Zbb extension integration + opcode restructuring Jul 10, 2026
@TheDeepestSpace TheDeepestSpace linked an issue Jul 10, 2026 that may be closed by this pull request
Comment thread src/headers/params.svh Outdated
Comment thread src/headers/params.svh Outdated
, AUIPC = 7'b0010111 //U-type
, LUI = 7'b0110111 //U-type
, MISC_MEM = 7'b0001111 //FENCE
} opcode_name_t;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
} opcode_name_t;
} opcode_t;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed //typedef logic [6:0] opcode_t; from src/headers/types.svh
in Instruction_Decode.sv: +assign opcode = opcode_t'(instr[6:0]);

Comment thread src/headers/params.svh Outdated
Comment on lines +6 to +16
{ OP = 7'b0110011 //R-type
, OP_IMM = 7'b0010011 //I-type logic
, LOAD = 7'b0000011 //I-type load
, STORE = 7'b0100011 //S-type
, BRANCH = 7'b1100011 //B-type
, JAL = 7'b1101111 //J-type
, JALR = 7'b1100111 //I-type jump
, AUIPC = 7'b0010111 //U-type
, LUI = 7'b0110111 //U-type
, MISC_MEM = 7'b0001111 //FENCE
} opcode_name_t;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd prepend each entiry in the enaum with OPCODE_ for consistency with the way we define other enums (to avoid collisions) even though we will have OPCODE_OP which sounds tautological.

Comment thread src/stages/decode_stage.sv Outdated
Comment on lines +115 to +117
`ifdef UTOSS_RISCV_ENABLE_B_EXT
assign id_to_ex.b_alu_control = b_alu_control;
`endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nitpick: could move that to the bottom of the assignment list for consistency

Comment thread src/stages/execute_stage.sv Outdated
Comment on lines +91 to +99
`ifdef UTOSS_RISCV_ENABLE_B_EXT
zbb u_zbb
( .a ( alu_input_a )
, .b ( alu_input_b )
, .b_alu_control ( id_to_ex.b_alu_control )
, .out ( zbb_result )
, .zeroE ( zbb_zero_flag )
);
`endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also a nitpick: i'd move this instantiation logic above the combinational block that decides on the final alu result

Comment thread src/ext/b/decoder.sv Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lets use our new enum here!

Suggested change
, input opcode_t opcode

Comment thread src/headers/types.svh
@TheDeepestSpace
TheDeepestSpace merged commit c886a44 into UTOSS:main Jul 11, 2026
12 checks passed
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.

Organize opcode naming Integrate B extension into the core

2 participants