Skip to content

Commit cefbda9

Browse files
committed
Added some fixes to cpu_pipelined.v, BUG TO FIX:PC starts at 0 and starts incrementing even before the reset becomes 0
1 parent 2a47c6d commit cefbda9

File tree

13 files changed

+42186
-59
lines changed

13 files changed

+42186
-59
lines changed

pipelined/modules/data_memory.hex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// 0x00000000
2-
28
32
00
43
00
54
00
65
00
76
00
87
00
98
00
10-
0a
9+
00
10+
00
1111
00
1212
00
1313
00
@@ -16,15 +16,15 @@
1616
00
1717
00
1818
// 0x00000010
19-
3e
2019
00
2120
00
2221
00
2322
00
2423
00
2524
00
2625
00
27-
12
26+
00
27+
00
2828
00
2929
00
3030
00
@@ -33,15 +33,15 @@
3333
00
3434
00
3535
// 0x00000020
36-
3e
3736
00
3837
00
3938
00
4039
00
4140
00
4241
00
4342
00
44-
12
43+
00
44+
00
4545
00
4646
00
4747
00

pipelined/modules/param_register.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module param_register #(parameter WIDTH = 1) (
88
output reg [WIDTH-1:0] q
99
);
1010

11-
always @(posedge clk or posedge rst) begin
12-
if (rst)
11+
always @(posedge clk or posedge reset) begin
12+
if (reset)
1313
q <= {WIDTH{1'b0}};
1414
else if (en)
1515
q <= d;

pipelined/reset_memory.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
cp modules/memory_reset.hex modules/data_memory.hex

pipelined/simulations/simulation_results.log

Whitespace-only changes.

pipelined/simulations/simulation_waveform.vcd

Whitespace-only changes.

pipelined/test_sequential.sh renamed to pipelined/test_pipelined.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ python3 testcases/assembler.py "$TEST_FILE"
1414

1515
echo "Compiling Verilog files..."
1616
iverilog -o test_results/cpu_test \
17-
verilog/cpu_sequential.v \
18-
verilog/testbench_sequential.v \
17+
verilog/cpu_pipelined.v \
18+
verilog/testbench_pipelined.v \
1919
-I modules/
2020

2121

@@ -27,20 +27,13 @@ if [ $? -eq 0 ]; then
2727
vvp test_results/cpu_test | tee test_results/simulation_output.txt
2828

2929
# if you wanna generate waveforms bruhhhh
30-
if [ -f test_results/cpu_sequential_test.vcd ]; then
30+
if [ -f test_results/cpu_pipelined_test.vcd ]; then
3131
echo "Generating waveform..."
32-
gtkwave test_results/cpu_sequential_test.vcd &
32+
gtkwave test_results/cpu_pipelined_test.vcd &
3333
else
3434
echo "Error: Waveform file not generated"
3535
fi
3636

37-
# visualization
38-
echo "Generating visualization data..."
39-
python3 visualization/data_converter.py test_results/simulation_output.txt
40-
41-
echo "Opening visualization in browser..."
42-
xdg-open visualization/index.html 2>/dev/null || open visualization/index.html 2>/dev/null || echo "Please open visualization/index.html in your browser"
43-
4437
else
4538
echo "Error: Compilation failed"
4639
exit 1

0 commit comments

Comments
 (0)