Skip to content
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

Added Instruction_Decode.v #7

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

Conversation

joon2022park
Copy link
Contributor

Added top level module for the Instruction Decode stage, consisting of:

  • logic for immediate sign extension
  • logic for selecting register rs1, rs2, and rd from instruction
  • logic for selecting funct3 and funct7[5] from instruction
  • instantiating all sub-modules in the stage

Added top level module for the Instruction Decode stage, consisting of:
- logic for immediate sign extension 
- logic for selecting register rs1, rs2, and rd from instruction
- logic for selecting funct3 and funct7[5] from instruction
- instantiating all sub-modules in the stage
Added module for Control FSM of RV32I Processor
Added Verilog modules for the ALU Decoder of the control unit along with the register file of the RV32I processor datapath. Also added is a TCL script generating a waveform of R, I, S, B, J instruction cases
Added Python testbench for the main control FSM of the multicycle RV32I processor, using the CocoTB framework
Copy link
Collaborator

@Eridarus Eridarus left a comment

Choose a reason for hiding this comment

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

The code looks mostly solid and functionally correct - not sure about the cocotb simulations but if you wanted to push some of the results/output files so we can see them as well. Add a separate src/tb directory for testbench code and simulation outputs

Some general comments - things like opcodes or hard-coded constants should generally be avoided - parametrizing them (and using the ../params.vh) to avoid clutter and make sure everyone sees the same parameters is probably for the best in cases like these. Other than that you can add more comments to explain what the outputs/some of the logic is for (especially the input/output ports so people who are interacting with the code know what to do with it)


end

else if (instr[6:0] == 7'b0010011) begin //I-Type (excluding lw)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Parametrizing the 7-bit opcodes here for I-type/S-type/so on will probably help readability and debugging later

input clk,
input regWrite,
input [31:0] dataIn,
output reg [31:0] baseAddr, //data read line #1 - from first source register
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason to name the register outputs this instead of like "regA/regB"?

input wire [31:0] ResultData,
output wire AdrSrc,
output wire IRWrite,
//output wire RegWrite,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Regwrite is commented out in the module header but you assign to it in the code - is this deliberate?


always@(*) begin

if (ALUOp == 2'b00) ALUControl = 3'b000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assigning the ALUControl values to explicitly written binary values (3'b000) should probably be changed to parameters (something like ALU_OPCODE_ADD) so that way we can add more of them later and change them around if need be (since the current ones only cover add/sub/and/or/slt) and a full implementation needs more opcodes (xors/shifts/etc)

Added parameters representing opcodes for I, R, S, B, J, and LW types
Update ALU Decoder RTL code with Daniel's refactor
update Instruction Decode top module by instantiating Daniel's new ALU decoder + editing funct7 and funct3 extraction logic
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.

2 participants