Skip to content

Branch if equals implementation #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

TheDeepestSpace
Copy link
Contributor

@TheDeepestSpace TheDeepestSpace commented Apr 5, 2025

This PR contains the implementation of beq instruction. It is built off of the unconditional branching setup in #20 .

This is a significant PR since it starts to integrate together our main modules: InstructionDecode, ControlFSM, fetch, and ALU.

This is the first attempt at integration and only wires up the signals necessary for beq.

This is a pretty large PR, so I would not be opposed to breaking it up into smaller chunks, especially since there have been quite a bit of peripheral changes.

Notable changes aside from the integration in top.v:

  • wired up ALUOp signal as per the book
  • since we have not yet switched to pipelining, PCUpdate is set to TRUE unconditionally
  • wired up zero flag from the ALU to Control FSM, which basically just feeds back into PCSrc signal to pick the next PC value
  • exposed ImmExt from Instruction Decode for consumption by the Fetch module
  • made register file read fully combinational to ensure beq can be performed in one cycle

Comment on lines +3 to +9
`include "src/types.svh"

module extend ( input wire [11:0] in
, output imm_t imm_ext
);
assign imm_ext = {{20{in[11]}}, in};
endmodule
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was added in #20, remove it since we are no longer using it (the logic is part of InstructionDecode)

@TheDeepestSpace TheDeepestSpace marked this pull request as ready for review April 6, 2025 19:26
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.

1 participant