Skip to content

Add m extension control and hazard - #261

Open
tandr3w wants to merge 3 commits into
mainfrom
m_extension-control
Open

Add m extension control and hazard#261
tandr3w wants to merge 3 commits into
mainfrom
m_extension-control

Conversation

@tandr3w

@tandr3w tandr3w commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Close #245
Updated hazard unit to allow for DIV
Updated execute to select the MUL or DIV module instead of the ALU when needed
Added mul and div instructions to the interface between decode and execute

Note that I didn't actually use div_cancel since it wasn't in the diagram in the planning doc. Also, it seems unnececssary after thinking about it a little? Since a branch instruction should never be in ex at the same time as a div.

I also assumed that the modules would look like the diagrams, and I might've accidentally done some of the integration work as well since I didn't really know how to separate it

@tandr3w tandr3w self-assigned this Jul 2, 2026

@DanielTaoHuang123 DanielTaoHuang123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

connect is_div and is_mul to the feature flags; everything else seems OK

@DanielTaoHuang123 DanielTaoHuang123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pretty good overall; fix the two commented lines and resolve conflict and I think it will be good to merge

Comment thread Makefile Outdated
UTOSS_RISCV_CONFIG ?= RV32I
UTOSS_RISCV_ENABLE_MUL ?= $(if $(findstring M,$(UTOSS_RISCV_CONFIG)),1,0)
UTOSS_RISCV_ENABLE_DIV ?= $(if $(findstring M,$(UTOSS_RISCV_CONFIG)),1,0)
UTOSS_RISCV_ENABLE_M := $(if $(filter 1,$(UTOSS_RISCV_ENABLE_MUL) $(UTOSS_RISCV_ENABLE_DIV)),1,0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably want to change this logic from OR to AND, since when running RV32M riscof test both mul and div are tested; if only one of them is enabled the other reports error

Comment thread src/stages/execute_stage.sv
@tandr3w
tandr3w force-pushed the m_extension-control branch from a05fa74 to 22fc75f Compare August 13, 2026 18:22
@tandr3w
tandr3w marked this pull request as ready for review August 13, 2026 18:25
@tandr3w

tandr3w commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the two comments and rebased but we probably need to wait for the decoder and mul/div unit to be done before merging.

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.

Implement changes to control unit and hazard unit for M extension

2 participants