Compare commits
24
Commits
605de84e6a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55a0856b5f | ||
|
|
1d6b45b324 | ||
|
|
7094593bd4 | ||
|
|
4723f7ffaa | ||
|
|
5856ab3d7c | ||
|
|
9eb9bde62f | ||
|
|
f59d067abe | ||
|
|
aca0b2ca60 | ||
|
|
f1a8741911 | ||
|
|
990408862d | ||
|
|
a14af4090b | ||
|
|
7454586413 | ||
|
|
b0d1314278 | ||
|
|
c02b6708f1 | ||
|
|
6d812677d4 | ||
|
|
b558beb69f | ||
|
|
0eace93dfd | ||
|
|
62b1cbd48d | ||
|
|
00ef7a32ed | ||
|
|
4f30a3ef6b | ||
|
|
dcc53bba3c | ||
|
|
a33802a191 | ||
|
|
51a87a5dac | ||
|
|
49a639f69a |
@@ -9,3 +9,8 @@ __pycache__/
|
||||
|
||||
# Cadence/Xcelium simulation output
|
||||
sim/behav/WORKSPACE/
|
||||
|
||||
# Submission packaging
|
||||
*-dd-fall26.zip
|
||||
regress.log
|
||||
submission.stamp
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
# Fill these in before running make submit, for example:
|
||||
# MEMBER_NAME = George Burdell
|
||||
# GT_USERNAME = gburdell3
|
||||
# DISCORD_NAME = gburdell67discord
|
||||
MEMBER_NAME =
|
||||
GT_USERNAME =
|
||||
DISCORD_NAME =
|
||||
export MEMBER_NAME
|
||||
|
||||
PYTHON ?= python3
|
||||
TEST ?= ebreak
|
||||
TEST_DIR := tests/$(TEST)
|
||||
@@ -6,13 +15,14 @@ CROSSBAR_TIMEOUT ?= 20
|
||||
|
||||
TEST_NAMES := $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard tests/*/program.asm)))))
|
||||
|
||||
.PHONY: help generate smoke test regress clean clean-generated
|
||||
.PHONY: help generate smoke test regress submit clean clean-generated
|
||||
|
||||
help:
|
||||
@echo "make generate TEST=<name> Assemble a test and generate golden files"
|
||||
@echo "make smoke Test build/TB wiring with a mock DUT"
|
||||
@echo "make test TEST=<name> Generate and run one RTL test"
|
||||
@echo "make regress Run every test, print PASS/FAIL summary (logs in tests/<name>/sim.log)"
|
||||
@echo "make submit Run regress and zip your sources, tests and log for checkoff"
|
||||
@echo "make clean Remove generated test and simulator files"
|
||||
@echo "Available tests: $(TEST_NAMES)"
|
||||
|
||||
@@ -54,6 +64,22 @@ regress:
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
submit:
|
||||
@if [ -z "$(strip $(MEMBER_NAME))" ] || [ -z "$(strip $(GT_USERNAME))" ] || [ -z "$(strip $(DISCORD_NAME))" ]; then \
|
||||
echo "Fill in MEMBER_NAME, GT_USERNAME and DISCORD_NAME at the top of the Makefile first."; \
|
||||
exit 2; \
|
||||
fi
|
||||
@submission="$$(printf '%s' "$$MEMBER_NAME" | tr -d "[:space:]'.,-")-$(strip $(GT_USERNAME))-$(strip $(DISCORD_NAME))-dd-fall26.zip"; \
|
||||
rm -f "$$submission" regress.log submission.stamp; \
|
||||
scripts/sjstamp submission.stamp regress.log src sim/behav/Include tests -- $(MAKE) --no-print-directory regress; \
|
||||
status=$$?; \
|
||||
if [ $$status -eq 125 ]; then echo "Could not stamp the submission, nothing was zipped."; exit 1; fi; \
|
||||
zip -qr "$$submission" src sim/behav/Include tests regress.log submission.stamp \
|
||||
-x '*.DS_Store' 'tests/*/program.o' 'tests/*/program.hex' 'tests/*/sim.log'; \
|
||||
echo "----------------------------------------"; \
|
||||
if [ $$status -ne 0 ]; then echo "WARNING: not all tests pass, see regress.log"; fi; \
|
||||
echo "Wrote $$submission"
|
||||
|
||||
clean:
|
||||
$(MAKE) -C sim/behav clean
|
||||
$(MAKE) --no-print-directory clean-generated
|
||||
|
||||
@@ -273,10 +273,12 @@ Disclaimer: We will be running some back end AI and software similarity checkers
|
||||
|
||||
In Person Submissions:
|
||||
- We will ask you to walk through the logic and answer a few random questions on must-know concepts.
|
||||
- You still need to run `make submit` and send the zip to the sjcheckoffs Discord Account, same as an online submission.
|
||||
|
||||
Additional Instructions For Online Submissions:
|
||||
- Include a screenshot of all your tests passing with your gt username somewhere in the terminal in the screenshot
|
||||
- **submit a zip of the src folder to the sjcheckoffs Discord Account** <img width="417" height="422" alt="image" src="https://github.gatech.edu/user-attachments/assets/1c271294-ba6a-4314-beb2-e4c76c7e97db" />
|
||||
- fill in your name, GT username and Discord username at the top of the `Makefile`, then run `make submit` to run every test and build the zip
|
||||
- **submit the zip that `make submit` wrote to the sjcheckoffs Discord Account** <img width="417" height="422" alt="image" src="https://github.gatech.edu/user-attachments/assets/1c271294-ba6a-4314-beb2-e4c76c7e97db" />
|
||||
- Include any supporting documentation you may have used (diagrams, drawings, state machines)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
instructions needed (R, I, S, B)
|
||||
ops needed:
|
||||
NOP (I) opcode: 001 0011, funct3: 000 note: same encoding as addi x0, x0, 0
|
||||
ADD (R) opcode: 011 0011, funct3: 000, funct7: 000 0000
|
||||
SUB (R) opcode: 011 0011, funct3: 000, funct7: 010 0000
|
||||
SLL (R) opcode: 011 0011, funct3: 001, funct7: 000 0000
|
||||
SRL (R) opcode: 011 0011, funct3: 101, funct7: 000 0000
|
||||
ADDI (I) opcode: 001 0011, funct3: 000
|
||||
LOAD (I) opcode: 000 0011, funct3: 010
|
||||
STORE (S) opcode: 010 0011, funct3: 010
|
||||
BEQ (B) opcode: 110 0011, funct3: 000
|
||||
EBREAK (I) opcode: 111 0011, funct3: 000
|
||||
|
||||
- opcode [6:0]
|
||||
- funct3 [14:12]
|
||||
- rs1 [19:15]
|
||||
|
||||
R type
|
||||
- opcode: 011 0011
|
||||
- funct7 [31:25]
|
||||
- rs2 [24:20]
|
||||
- rs1 [19:15]
|
||||
- funct3 [14:12]
|
||||
- rd [11:7]
|
||||
- opcode [6:0]
|
||||
|
||||
I type
|
||||
- opcode: 001 0011 | 000 0011
|
||||
- imm [31:20]
|
||||
- rs1 [19:15]
|
||||
- funct3 [14:12]
|
||||
- rd [11:7]
|
||||
- opcode [6:0]
|
||||
|
||||
S type
|
||||
- opcode: 010 0011
|
||||
- imm [31:25]
|
||||
- rs2 [24:20]
|
||||
- rs1 [19:15]
|
||||
- funct3 [14:12]
|
||||
- imm [11:7]
|
||||
- opcode [6:0]
|
||||
|
||||
B type
|
||||
- opcode: 110 0011
|
||||
- imm [31:25]
|
||||
- rs2 [24:20]
|
||||
- rs1 [19:15]
|
||||
- funct3 [14:12]
|
||||
- imm [11:7]
|
||||
- opcode [6:0]
|
||||
|
||||
main decoder truth table
|
||||
instr opcode regwrite immsrc alusrc memwrite resultsrc branch aluop
|
||||
add 0110011 1 xx 0 0 0 0 10
|
||||
sub 0110011 1 xx 0 0 0 0 10
|
||||
sll 0110011 1 xx 0 0 0 0 10
|
||||
srl 0110011 1 xx 0 0 0 0 10
|
||||
addi 0010011 1 00 1 0 0 0 10
|
||||
lw 0000011 1 00 1 0 1 0 00
|
||||
sw 0100011 0 01 1 1 x 0 00
|
||||
beq 1100011 0 10 0 0 x 1 01
|
||||
ebreak 1110011 x xx 0 0 0 1 01
|
||||
|
||||
|
||||
alu decoder truth table
|
||||
aluop funct3 {op[5], funct7[5]} alucontrol instruction
|
||||
00 x x 00 (add) lw, sw
|
||||
01 x x 01 (sub) beq
|
||||
10 000 00, 01, 10 00 (add) add, addi
|
||||
000 11 01 (sub) sub
|
||||
001 x 10 (sll) sll
|
||||
101 x 11 (srl) srl
|
||||
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
@@ -8,6 +8,7 @@ module main_decoder (
|
||||
output logic [1:0] imm_src_o, //
|
||||
output logic reg_write_o, // write to register or not
|
||||
output logic [1:0] alu_op_o, // operation for alu to perform
|
||||
output logic load_stall_o,
|
||||
output logic instr_invld_o // invalid or unsupported instruction
|
||||
);
|
||||
|
||||
@@ -20,6 +21,7 @@ module main_decoder (
|
||||
mem_write_o = 1'b0;
|
||||
alu_src_o = 1'b0;
|
||||
alu_op_o = 1'b00;
|
||||
load_stall_o = 1'b0;
|
||||
|
||||
case (opcode_i)
|
||||
// lw
|
||||
@@ -31,6 +33,7 @@ module main_decoder (
|
||||
result_src_o = 1'b1;
|
||||
branch_o = 1'b0;
|
||||
alu_op_o = 2'b00;
|
||||
load_stall_o = 1'b1;
|
||||
end
|
||||
// sw
|
||||
7'b0100011: begin
|
||||
@@ -146,6 +149,7 @@ module control_unit (
|
||||
output logic [1:0] imm_src_o,
|
||||
output logic reg_write_o,
|
||||
output logic [1:0] alu_control_o,
|
||||
output logic load_stall_o,
|
||||
output logic instr_invld_o,
|
||||
output logic ebreak_o
|
||||
);
|
||||
@@ -173,7 +177,8 @@ module control_unit (
|
||||
.reg_write_o(reg_write_o),
|
||||
.mem_write_o(mem_write_o),
|
||||
.alu_op_o(alu_op),
|
||||
.instr_invld_o(instr_invld_md)
|
||||
.instr_invld_o(instr_invld_md),
|
||||
.load_stall_o(load_stall_o)
|
||||
);
|
||||
|
||||
alu_decoder ad (
|
||||
|
||||
@@ -58,8 +58,25 @@ module cpu_top (
|
||||
assign result = result_src ? dsram_rdata_i : alu_result;
|
||||
|
||||
logic ebreak_latch;
|
||||
logic load_stall;
|
||||
logic load_stall_cycle;
|
||||
logic load_stall_ff;
|
||||
|
||||
assign stall_core = ebreak_latch | halted_o | ~en_i; //when else would you stall?
|
||||
assign load_stall_ff = (load_stall & ~load_stall_cycle);
|
||||
|
||||
assign stall_core = ebreak_latch | halted_o | ~en_i | load_stall_ff;
|
||||
|
||||
always_ff @(posedge clk_i) begin
|
||||
if (rst_i) begin
|
||||
halted_o <= 1'b0;
|
||||
load_stall_cycle <= 1'b0;
|
||||
end else if (ebreak_latch) halted_o <= 1'b1;
|
||||
else if (load_stall & ~load_stall_cycle) begin
|
||||
load_stall_cycle <= 1'b1;
|
||||
end else if (load_stall & load_stall_cycle) begin
|
||||
load_stall_cycle <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// === Instruction Fetch === //
|
||||
// certain ports are tied off bc they depend on modulees you need to implement.
|
||||
@@ -99,17 +116,13 @@ module cpu_top (
|
||||
.imm_ext_o(imm_ext),
|
||||
.rs1_data_o(rs1_data),
|
||||
.rs2_data_o(rs2_data),
|
||||
.load_stall_o(load_stall),
|
||||
.load_stall_ff_i(load_stall_ff),
|
||||
.instr_invld_o(instr_invld_decode),
|
||||
.reg_values_o(reg_crossbar_o),
|
||||
.ebreak_o(ebreak_latch)
|
||||
);
|
||||
|
||||
always_ff @(posedge clk_i) begin
|
||||
if (rst_i) halted_o <= 1'b0;
|
||||
else if (ebreak_latch) halted_o <= 1'b1;
|
||||
end
|
||||
|
||||
|
||||
always_comb begin
|
||||
if (pc_target[31:12] == '0) begin
|
||||
branch_vld = '1;
|
||||
|
||||
@@ -5,6 +5,7 @@ module decode (
|
||||
input logic instr_vld_i, // is instruction passed valid
|
||||
input logic alu_zero_i,
|
||||
input logic [31:0] rd_data_i,
|
||||
input logic load_stall_ff_i,
|
||||
|
||||
output logic pc_src_o,
|
||||
output logic result_src_o,
|
||||
@@ -14,6 +15,7 @@ module decode (
|
||||
output logic [31:0] imm_ext_o,
|
||||
output logic [31:0] rs1_data_o,
|
||||
output logic [31:0] rs2_data_o,
|
||||
output logic load_stall_o,
|
||||
output logic instr_invld_o,
|
||||
output logic ebreak_o,
|
||||
output logic [31:0] reg_values_o[32] //Register Values Output
|
||||
@@ -36,6 +38,7 @@ module decode (
|
||||
.imm_src_o(imm_src),
|
||||
.reg_write_o(reg_write),
|
||||
.alu_control_o(alu_control_o),
|
||||
.load_stall_o(load_stall_o),
|
||||
.instr_invld_o(cu_invld),
|
||||
.ebreak_o(ebreak_o)
|
||||
);
|
||||
@@ -47,7 +50,7 @@ module decode (
|
||||
.rs2_addr_i(instr_i[24:20]),
|
||||
.rs1_data_o(rs1_data_o),
|
||||
.rs2_data_o(rs2_data_o),
|
||||
.rd_write_en_i(reg_write),
|
||||
.rd_write_en_i(reg_write & ~load_stall_ff_i),
|
||||
.rd_addr_i(instr_i[11:7]),
|
||||
.rd_data_i(rd_data_i),
|
||||
.reg_values_o(reg_values_o)
|
||||
|
||||
@@ -14,10 +14,10 @@ module reg_file (
|
||||
input logic [31:0] rd_data_i,
|
||||
|
||||
// Read-only architectural state exposed to the debug crossbar.
|
||||
output logic [31:0] reg_values_o[32] //Register Values Output
|
||||
output logic [31:0] reg_values_o [0:31] //Register Values Output
|
||||
);
|
||||
|
||||
logic [31:0] registers[32];
|
||||
logic [31:0] registers [0:31];
|
||||
integer i; //used for generate loops in systemverilog
|
||||
|
||||
always_comb begin
|
||||
@@ -27,16 +27,17 @@ module reg_file (
|
||||
|
||||
assign reg_values_o[0] = 32'd0;
|
||||
generate
|
||||
for (
|
||||
genvar register_index = 1; register_index < 32; register_index++
|
||||
) begin : gen_debug_register_values
|
||||
for (genvar register_index = 1;
|
||||
register_index < 32;
|
||||
register_index++) begin : gen_debug_register_values
|
||||
assign reg_values_o[register_index] = registers[register_index];
|
||||
end
|
||||
endgenerate
|
||||
|
||||
always_ff @(posedge clk_i) begin
|
||||
if (rst_i) begin
|
||||
for (i = 0; i < 32; i = i + 1) registers[i] <= 32'd0;
|
||||
for (i = 0; i < 32; i = i + 1)
|
||||
registers[i] <= 32'd0;
|
||||
end else if (rd_write_en_i && (rd_addr_i != 5'd0)) begin
|
||||
registers[rd_addr_i] <= rd_data_i;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user