Skip to content

Latest commit

 

History

History
 
 

simulation4 - JAL, BEQ

Simulation Results

JAL, BEQ (taken)

We conducted a simulation using the instructions provided in the file beqtaken.mif and the testbench tb_top to evaluate the pipeline's functionality.

The obtained result matches the expected outcome, which can be verified below.

Instructions Tested

The simulation included testing the following instructions:

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
addi x7,x0,1
addi x8,x0,2
beq x7,x7,-8
or x4,x2,x0

Registers after each instruction

The following information is extracted from the simulation log and can be interpreted as demonstrated in the example below:

tt: Register [x] written with value: [hhhhhhhh] | [dddddddd]

In the above example, tt represents the simulation time, x represents the register number, hhhhhhhh represents the hexadecimal value stored in the register, and dddddddd represents the same value in decimal.


45: Register [ 7] written with value: [00000001] | [         1]
55: Register [ 2] written with value: [00000004] | [         4]
65: Register [10] written with value: [0000000c] | [        12]
95: Register [ 6] written with value: [00000004] | [         4]
105: Register [ 7] written with value: [00000001] | [         1]
115: Register [ 8] written with value: [00000002] | [         2]
155: Register [ 7] written with value: [00000001] | [         1]
165: Register [ 8] written with value: [00000002] | [         2]
205: Register [ 7] written with value: [00000001] | [         1]
215: Register [ 8] written with value: [00000002] | [         2]
255: Register [ 7] written with value: [00000001] | [         1]
265: Register [ 8] written with value: [00000002] | [         2]
305: Register [ 7] written with value: [00000001] | [         1]
315: Register [ 8] written with value: [00000002] | [         2]
355: Register [ 7] written with value: [00000001] | [         1]
365: Register [ 8] written with value: [00000002] | [         2]
405: Register [ 7] written with value: [00000001] | [         1]
415: Register [ 8] written with value: [00000002] | [         2]
455: Register [ 7] written with value: [00000001] | [         1]
465: Register [ 8] written with value: [00000002] | [         2]
505: Register [ 7] written with value: [00000001] | [         1]

BEQ (not taken)

Instructions Tested

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
addi x7,x0,1
addi x8,x0,2
beq x8,x7,-8
or x4,x2,x0

Registers after each instruction

45: Register [ 7] written with value: [00000001] | [         1]
55: Register [ 2] written with value: [00000004] | [         4]
65: Register [10] written with value: [0000000c] | [        12]
95: Register [ 6] written with value: [00000004] | [         4]
105: Register [ 7] written with value: [00000001] | [         1]
115: Register [ 8] written with value: [00000002] | [         2]
135: Register [ 4] written with value: [00000004] | [         4]

BNE (taken)

Instructions Tested

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
addi x7,x0,1
addi x8,x0,2
bne x8,x7,-8
or x4,x2,x0

Registers after each instruction

45: Register [ 7] written with value: [00000001] | [         1]
55: Register [ 2] written with value: [00000004] | [         4]
65: Register [10] written with value: [0000000c] | [        12]
95: Register [ 6] written with value: [00000004] | [         4]
105: Register [ 7] written with value: [00000001] | [         1]
115: Register [ 8] written with value: [00000002] | [         2]
155: Register [ 7] written with value: [00000001] | [         1]
165: Register [ 8] written with value: [00000002] | [         2]
205: Register [ 7] written with value: [00000001] | [         1]
215: Register [ 8] written with value: [00000002] | [         2]
255: Register [ 7] written with value: [00000001] | [         1]
265: Register [ 8] written with value: [00000002] | [         2]
305: Register [ 7] written with value: [00000001] | [         1]
315: Register [ 8] written with value: [00000002] | [         2]
355: Register [ 7] written with value: [00000001] | [         1]
365: Register [ 8] written with value: [00000002] | [         2]
405: Register [ 7] written with value: [00000001] | [         1]
415: Register [ 8] written with value: [00000002] | [         2]
455: Register [ 7] written with value: [00000001] | [         1]
465: Register [ 8] written with value: [00000002] | [         2]
505: Register [ 7] written with value: [00000001] | [         1]

BLT (taken)

Instructions Tested

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
addi x7,x0,2
addi x8,x0,1
blt x8,x7,-8
or x4,x2,x0

Registers after each instruction

45: Register [ 7] written with value: [00000001] | [         1]
55: Register [ 2] written with value: [00000004] | [         4]
65: Register [10] written with value: [0000000c] | [        12]
95: Register [ 6] written with value: [00000004] | [         4]
105: Register [ 7] written with value: [00000002] | [         2]
115: Register [ 8] written with value: [00000001] | [         1]
155: Register [ 7] written with value: [00000002] | [         2]
165: Register [ 8] written with value: [00000001] | [         1]
205: Register [ 7] written with value: [00000002] | [         2]
215: Register [ 8] written with value: [00000001] | [         1]
255: Register [ 7] written with value: [00000002] | [         2]
265: Register [ 8] written with value: [00000001] | [         1]
305: Register [ 7] written with value: [00000002] | [         2]
315: Register [ 8] written with value: [00000001] | [         1]
355: Register [ 7] written with value: [00000002] | [         2]
365: Register [ 8] written with value: [00000001] | [         1]
405: Register [ 7] written with value: [00000002] | [         2]
415: Register [ 8] written with value: [00000001] | [         1]
455: Register [ 7] written with value: [00000002] | [         2]
465: Register [ 8] written with value: [00000001] | [         1]
505: Register [ 7] written with value: [00000002] | [         2]

BGE (taken)

Instructions Tested

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
addi x7,x0,2
addi x8,x0,1
bge x7,x8,-8
or x4,x2,x0

Registers after each instruction

45: Register [ 7] written with value: [00000001] | [         1]
55: Register [ 2] written with value: [00000004] | [         4]
65: Register [10] written with value: [0000000c] | [        12]
95: Register [ 6] written with value: [00000004] | [         4]
105: Register [ 7] written with value: [00000002] | [         2]
115: Register [ 8] written with value: [00000001] | [         1]
155: Register [ 7] written with value: [00000002] | [         2]
165: Register [ 8] written with value: [00000001] | [         1]
205: Register [ 7] written with value: [00000002] | [         2]
215: Register [ 8] written with value: [00000001] | [         1]
255: Register [ 7] written with value: [00000002] | [         2]
265: Register [ 8] written with value: [00000001] | [         1]
305: Register [ 7] written with value: [00000002] | [         2]
315: Register [ 8] written with value: [00000001] | [         1]
355: Register [ 7] written with value: [00000002] | [         2]
365: Register [ 8] written with value: [00000001] | [         1]
405: Register [ 7] written with value: [00000002] | [         2]
415: Register [ 8] written with value: [00000001] | [         1]
455: Register [ 7] written with value: [00000002] | [         2]
465: Register [ 8] written with value: [00000001] | [         1]
505: Register [ 7] written with value: [00000002] | [         2]

BLTU (taken)

Instructions Tested

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
sub x7,x0,x2
addi x8,x0,1
bltu x8,x7,-8
or x4,x2,x0

Registers after each instruction

55: Register [ 7] written with value: [00000001] | [          1]
65: Register [ 2] written with value: [00000004] | [          4]
75: Register [10] written with value: [0000000c] | [         12]
105: Register [ 6] written with value: [00000004] | [          4]
115: Register [ 7] written with value: [fffffffc] | [         -4]
125: Register [ 8] written with value: [00000001] | [          1]
165: Register [ 7] written with value: [fffffffc] | [         -4]
175: Register [ 8] written with value: [00000001] | [          1]
215: Register [ 7] written with value: [fffffffc] | [         -4]
225: Register [ 8] written with value: [00000001] | [          1]
265: Register [ 7] written with value: [fffffffc] | [         -4]
275: Register [ 8] written with value: [00000001] | [          1]
315: Register [ 7] written with value: [fffffffc] | [         -4]
325: Register [ 8] written with value: [00000001] | [          1]
365: Register [ 7] written with value: [fffffffc] | [         -4]
375: Register [ 8] written with value: [00000001] | [          1]
415: Register [ 7] written with value: [fffffffc] | [         -4]
425: Register [ 8] written with value: [00000001] | [          1]
465: Register [ 7] written with value: [fffffffc] | [         -4]
475: Register [ 8] written with value: [00000001] | [          1]

BGEU (not taken)

Instructions Tested

addi x7,x0,1
addi x2,x0,4
jal x10,8
or x4,x2,x0
add x6,x4,x2
sub x7,x0,x2
addi x8,x0,7
bgeu x8,x7,-8
or x4,x2,x0

Registers after each instruction

55: Register [ 7] written with value: [00000001] | [          1]
65: Register [ 2] written with value: [00000004] | [          4]
75: Register [10] written with value: [0000000c] | [         12]
105: Register [ 6] written with value: [00000004] | [          4]
115: Register [ 7] written with value: [fffffffc] | [         -4]
125: Register [ 8] written with value: [00000007] | [          7]
145: Register [ 4] written with value: [00000004] | [          4]

JALR

Instructions Tested

addi x7,x0,-1
sw x7,0(x0)
lw x9,0(x0)
or x4,x2,x0
add x6,x4,x2
jalr x12,x0,12

Registers/Memory State after each instruction

The following information is extracted from the simulation log and can be interpreted as demonstrated in the example below:

tt: Register [x] written with value: [hhhhhhhh] | [dddddddd]
tt: Memory [x] read with value: [hhhhhhhh] | [dddddddd]
tt: Memory [x] written with value: [hhhhhhhh] | [dddddddd]

In the above example, tt represents the simulation time, x represents the register/memory address number, hhhhhhhh represents the hexadecimal value stored in the register/memory slot, and dddddddd represents the same value in decimal.


55: Register [ 7] written with value: [ffffffff] | [         -1]
55: Memory [  0] written with value: [ffffffff] | [         -1]
65: Memory [  0] read with value: [ffffffff] | [         -1]
75: Register [ 9] written with value: [ffffffff] | [         -1]
85: Register [ 4] written with value: [00000000] | [          0]
95: Register [ 6] written with value: [00000000] | [          0]
105: Register [12] written with value: [00000018] | [         24]
135: Register [ 4] written with value: [00000000] | [          0]
145: Register [ 6] written with value: [00000000] | [          0]
155: Register [12] written with value: [00000018] | [         24]
185: Register [ 4] written with value: [00000000] | [          0]
195: Register [ 6] written with value: [00000000] | [          0]
205: Register [12] written with value: [00000018] | [         24]
235: Register [ 4] written with value: [00000000] | [          0]
245: Register [ 6] written with value: [00000000] | [          0]
255: Register [12] written with value: [00000018] | [         24]
285: Register [ 4] written with value: [00000000] | [          0]
295: Register [ 6] written with value: [00000000] | [          0]
305: Register [12] written with value: [00000018] | [         24]
335: Register [ 4] written with value: [00000000] | [          0]
345: Register [ 6] written with value: [00000000] | [          0]
355: Register [12] written with value: [00000018] | [         24]
385: Register [ 4] written with value: [00000000] | [          0]
395: Register [ 6] written with value: [00000000] | [          0]
405: Register [12] written with value: [00000018] | [         24]
435: Register [ 4] written with value: [00000000] | [          0]
445: Register [ 6] written with value: [00000000] | [          0]
455: Register [12] written with value: [00000018] | [         24]
485: Register [ 4] written with value: [00000000] | [          0]
495: Register [ 6] written with value: [00000000] | [          0]
505: Register [12] written with value: [00000018] | [         24]