File tree Expand file tree Collapse file tree 4 files changed +621
-16
lines changed Expand file tree Collapse file tree 4 files changed +621
-16
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ module data_memory(
1515 end
1616
1717 always @(posedge clk) begin
18- if (address > 1016 ) begin
18+ if (address > 1016 && mem_write ) begin
1919 $fatal(1 , "\n\n Error: Invalid memory address %d\n " , address);
2020 end
2121 if (mem_write && address <= 1016 ) begin
@@ -31,7 +31,7 @@ module data_memory(
3131 end
3232
3333 always @(* ) begin
34- if (address > 1016 ) begin
34+ if (address > 1016 && mem_read ) begin
3535 $fatal(1 , "\n\n Error: Invalid memory address %d\n " , address);
3636 end
3737 if (mem_read && address <= 1016 ) begin
Original file line number Diff line number Diff line change 11begin:
2- beq x0, x0, end
2+ beq x0, x0, L1
3+ addi x6, x0, 4
4+
5+ L2:
6+ addi x7, x0, 8
37
48L1:
59 addi x5, x0, 4
610
7- L2 :
8- addi x6, x0, 4
11+ end :
12+ nop
913
10- L3:
11- addi x7, x0, 4
1214
13- end:
14- nop
15+ # only x5
Original file line number Diff line number Diff line change 1- nb `timescale 1ns/ 1ps
1+ `timescale 1ns/ 1ps
22
33module testbench_sequential ();
44 reg clk;
@@ -26,10 +26,10 @@ module testbench_sequential();
2626 );
2727
2828 initial begin
29- cpu.imem.memory[0 ] = 32'b00000000000000000000100001100011 ;
30- cpu.imem.memory[1 ] = 32'b00000000010000000000001010010011 ;
31- cpu.imem.memory[2 ] = 32'b00000000010000000000001100010011 ;
32- cpu.imem.memory[3 ] = 32'b00000000010000000000001110010011 ;
29+ cpu.imem.memory[0 ] = 32'b00000000000000000000011001100011 ;
30+ cpu.imem.memory[1 ] = 32'b00000000010000000000001100010011 ;
31+ cpu.imem.memory[2 ] = 32'b00000000100000000000001110010011 ;
32+ cpu.imem.memory[3 ] = 32'b00000000010000000000001010010011 ;
3333 cpu.imem.memory[4 ] = 32'b00000000000000000000000000000000 ;
3434 end
3535
You can’t perform that action at this time.
0 commit comments