diff --git a/software/code/add.S b/software/code/add.S index 4822574..3d8582e 100644 --- a/software/code/add.S +++ b/software/code/add.S @@ -2,8 +2,8 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 add a3, a1, a2 # Soma a1 e a2, armazena o resultado em a3 add a4, a3, a2 diff --git a/software/code/addi.S b/software/code/addi.S index 94fce25..8c4ee5a 100644 --- a/software/code/addi.S +++ b/software/code/addi.S @@ -1,7 +1,7 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 add a3, a1, a2 # Soma a1 e a2, armazena o resultado em a3 diff --git a/software/code/and.S b/software/code/and.S index 333f80f..d4d56cc 100644 --- a/software/code/and.S +++ b/software/code/and.S @@ -1,8 +1,8 @@ .global _start _start: - addi x10, x0, 5; - addi x11, x0, 3; + addi x10, zero, 5; + addi x11, zero, 3; add x12, x10, x11; and x9, x10, x10; diff --git a/software/code/andi.S b/software/code/andi.S index aaab12a..140796a 100644 --- a/software/code/andi.S +++ b/software/code/andi.S @@ -1,7 +1,7 @@ .global _start _start: - addi x10, x0, 5; + addi x10, zero, 5; andi x9, x10, 5; andi x8, x10, 3; diff --git a/software/code/beq.S b/software/code/beq.S index 208d8c6..0dede92 100644 --- a/software/code/beq.S +++ b/software/code/beq.S @@ -1,22 +1,22 @@ .global _start _start: - addi x12, x0, 1; - addi x9, x0, 1; + addi x12, zero, 1; + addi x9, zero, 1; beq x12, x9, desvio; - addi x13, x0, 5; + addi x13, zero, 5; add x14, x12, x13; sw x14, 0(x12); lw x14, 0(x12); sub x11, x13, x12; - addi x10, x0, 25; + addi x10, zero, 25; addi x10, x10, -15; and x15, x12, x13; or x15, x12, x13; - addi x10, x0, 100; + addi x10, zero, 100; desvio: - addi x16, x0, 17; + addi x16, zero, 17; andi x16, x16, 17; diff --git a/software/code/beq2.S b/software/code/beq2.S index 835f1f6..cc8df36 100644 --- a/software/code/beq2.S +++ b/software/code/beq2.S @@ -1,22 +1,22 @@ .global _start _start: - addi x12, x0, 1; - addi x9, x0, 2; + addi x12, zero, 1; + addi x9, zero, 2; beq x12, x9, desvio; - addi x13, x0, 5; + addi x13, zero, 5; add x14, x12, x13; sw x14, 0(x12); lw x14, 0(x12); sub x11, x13, x12; - addi x10, x0, 25; + addi x10, zero, 25; addi x10, x10, -15; and x15, x12, x13; or x15, x12, x13; - addi x10, x0, 100; + addi x10, zero, 100; desvio: - addi x16, x0, 17; + addi x16, zero, 17; andi x16, x16, 17; diff --git a/software/code/beq3.S b/software/code/beq3.S index 6ee43a8..6dc732b 100644 --- a/software/code/beq3.S +++ b/software/code/beq3.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 beq x1, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/beq4.S b/software/code/beq4.S index 080ef13..8104d3e 100644 --- a/software/code/beq4.S +++ b/software/code/beq4.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 beq x1, x2, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bge.S b/software/code/bge.S index ad566b3..73463d5 100644 --- a/software/code/bge.S +++ b/software/code/bge.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bge x1, x2, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bge2.S b/software/code/bge2.S index fca3b90..84c9a6a 100644 --- a/software/code/bge2.S +++ b/software/code/bge2.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bge x2, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bgeu.S b/software/code/bgeu.S index ac55727..6b28203 100644 --- a/software/code/bgeu.S +++ b/software/code/bgeu.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bgeu x1, x2, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bgeu2.S b/software/code/bgeu2.S index 9e9f23a..222e300 100644 --- a/software/code/bgeu2.S +++ b/software/code/bgeu2.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bgeu x2, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/blt.S b/software/code/blt.S index ac13320..5720284 100644 --- a/software/code/blt.S +++ b/software/code/blt.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 blt x1, x2, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/blt2.S b/software/code/blt2.S index 69885fe..ca4122a 100644 --- a/software/code/blt2.S +++ b/software/code/blt2.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 blt x2, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bltu.S b/software/code/bltu.S index 91fcf55..0d83a6a 100644 --- a/software/code/bltu.S +++ b/software/code/bltu.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bltu x1, x2, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bltu2.S b/software/code/bltu2.S index 3fa5500..60b964a 100644 --- a/software/code/bltu2.S +++ b/software/code/bltu2.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bltu x2, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bne.S b/software/code/bne.S index 056cd2d..16f7c37 100644 --- a/software/code/bne.S +++ b/software/code/bne.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bne x2, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/bne2.S b/software/code/bne2.S index d02df45..cdd4517 100644 --- a/software/code/bne2.S +++ b/software/code/bne2.S @@ -1,13 +1,13 @@ .global _start _start: - addi x1, x0, 1 - addi x2, x0, 2 + addi x1, zero, 1 + addi x2, zero, 2 bne x1, x1, desvio - addi x3, x0, 10 + addi x3, zero, 10 desvio: - addi x4, x0, 15 + addi x4, zero, 15 add x4, x4, x2 diff --git a/software/code/fpga_test.S b/software/code/fpga_test.S index b2d8e98..e0728d5 100644 --- a/software/code/fpga_test.S +++ b/software/code/fpga_test.S @@ -2,19 +2,19 @@ .global _start; _start: - addi x2, x0, 2047; + addi x2, zero, 2047; slli x2, x2, 15; - addi x15, x0, 9; + addi x15, zero, 9; # beq x1, x1, loop; # #loop: -# addi x15, x0, 1; +# addi x15, zero, 1; # # beq x1, x1, time; # #time: -# addi x3, x0, x1; +# addi x3, zero, x1; # # blt x3, x3, time; diff --git a/software/code/jal.S b/software/code/jal.S index c2a7d53..e9370a4 100644 --- a/software/code/jal.S +++ b/software/code/jal.S @@ -1,12 +1,12 @@ .global _start _start: - addi a3, x0, 3; + addi a3, zero, 3; jal subrotina - addi a4, x0, 5; + addi a4, zero, 5; subrotina: - addi a5, x0, 10; + addi a5, zero, 10; diff --git a/software/code/jalr.S b/software/code/jalr.S index a791c3f..6a12fcb 100644 --- a/software/code/jalr.S +++ b/software/code/jalr.S @@ -1,15 +1,15 @@ .global _start _start: - addi a3, x0, 3; + addi a3, zero, 3; add a3, a3, a3; la x1, subrotina; jalr a2, x1, 0; - addi a4, x0, 7; + addi a4, zero, 7; subrotina: - addi a5, x0, 10; + addi a5, zero, 10; jalr zero, ra, 0; diff --git a/software/code/jalr2.S b/software/code/jalr2.S index 33f446a..fbb0aae 100644 --- a/software/code/jalr2.S +++ b/software/code/jalr2.S @@ -1,13 +1,13 @@ .global _start _start: - addi a3, x0, 3; + addi a3, zero, 3; add a3, a3, a3; jal ra, subrotina; - addi a4, x0, 7; + addi a4, zero, 7; subrotina: - addi a5, x0, 10; + addi a5, zero, 10; jalr zero, ra, 0; diff --git a/software/code/loop.S b/software/code/loop.S index f19d41d..063a4e2 100644 --- a/software/code/loop.S +++ b/software/code/loop.S @@ -1,8 +1,8 @@ .global _start _start: - addi x2, x0, 10; - beq x0, x0, loop; + addi x2, zero, 10; + beq zero, zero, loop; loop: addi x15, x15, 1; @@ -12,4 +12,4 @@ loop: beq x15, x15, loop; end: - addi x3, x0, 5; + addi x3, zero, 5; diff --git a/software/code/or.S b/software/code/or.S index 3132d0b..ac138ce 100644 --- a/software/code/or.S +++ b/software/code/or.S @@ -1,8 +1,8 @@ .global _start _start: - addi x10, x0, 5; - addi x11, x0, 3; + addi x10, zero, 5; + addi x11, zero, 3; add x12, x10, x11; or x9, x10, x10; diff --git a/software/code/ori.S b/software/code/ori.S index 2838ff6..5c013a6 100644 --- a/software/code/ori.S +++ b/software/code/ori.S @@ -1,7 +1,7 @@ .global _start _start: - addi x10, x0, 5; + addi x10, zero, 5; ori x9, x10, 5; ori x8, x10, 3; diff --git a/software/code/sll.S b/software/code/sll.S index 1b10a7d..0abfb97 100644 --- a/software/code/sll.S +++ b/software/code/sll.S @@ -1,9 +1,9 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 - addi a3, x0, 1 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 + addi a3, zero, 1 sll a4, a1, a3 sll a5, a2, a3 diff --git a/software/code/slt.S b/software/code/slt.S index 7257c51..d308f59 100644 --- a/software/code/slt.S +++ b/software/code/slt.S @@ -1,8 +1,8 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 slt a3, a1, a2 slt a4, a2, a1 diff --git a/software/code/slti.S b/software/code/slti.S index 0a740f1..bb8457c 100644 --- a/software/code/slti.S +++ b/software/code/slti.S @@ -1,8 +1,8 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 slti a3, a1, 5 slti a4, a2, 23 diff --git a/software/code/sltiu.S b/software/code/sltiu.S index 8a8bb92..6f7b0f6 100644 --- a/software/code/sltiu.S +++ b/software/code/sltiu.S @@ -1,8 +1,18 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 - sltiu a3, a1, 15 - sltiu a4, a2, 10 + sltiu a3, a1, 15 # rs1 < imm + sltiu a4, a2, 10 # rs2 < imm + + li a5, 0xFFFFFFFF + li a6, 0x00000DFF + li a0, 0x00000000 + + sltiu a7, a5, 00000000 # 0 rs1 < imm + sltiu t0, a6, -2048 # 1 + sltiu t1, a0, 0 # 0 + sltiu t2, a5, 0 # 0 + sltiu t3, a0, -2048 # 1 diff --git a/software/code/sltu.S b/software/code/sltu.S index e600b11..9007ce2 100644 --- a/software/code/sltu.S +++ b/software/code/sltu.S @@ -1,8 +1,18 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 - sltu a3, a1, a2 - sltu a4, a2, a1 + sltu a3, a1, a2 # 1 + sltu a4, a2, a1 # 0 + + li a5, 0xFFFFFFFF + li a6, 0xDFFFFFFF + li a0, 0x00000000 + + sltu a7, a5, a6 # 0 rs1 < rs2 + sltu t0, a6, a5 # 1 + sltu t1, a0, a0 # 0 + sltu t2, a5, a0 # 0 + sltu t3, a0, a5 # 1 diff --git a/software/code/sra.S b/software/code/sra.S index 9654f90..5ab6220 100644 --- a/software/code/sra.S +++ b/software/code/sra.S @@ -7,3 +7,10 @@ _start: sra a3, a1, a5 sra a4, a2, a5 + + li a6, -2; + + sra a7, a6, a5 + + li a6, -1000; + sra t0, a6, a5 diff --git a/software/code/srl.S b/software/code/srl.S index 6359446..7488868 100644 --- a/software/code/srl.S +++ b/software/code/srl.S @@ -1,9 +1,9 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 - addi a5, x0, 1 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 + addi a5, zero, 1 srl a3, a1, a5 srl a4, a2, a5 diff --git a/software/code/sub.S b/software/code/sub.S index 69bcdac..9f4476f 100644 --- a/software/code/sub.S +++ b/software/code/sub.S @@ -1,8 +1,8 @@ .global _start _start: - addi a1, x0, 10 # Carrega o primeiro número (10) em a1 - addi a2, x0, 20 # Carrega o segundo número (20) em a2 + addi a1, zero, 10 # Carrega o primeiro número (10) em a1 + addi a2, zero, 20 # Carrega o segundo número (20) em a2 sub a3, a2, a1 # Soma a1 e a2, armazena o resultado em a3 sub a4, a3, a2 diff --git a/software/code/xor.S b/software/code/xor.S index 68c2a96..e56c9d0 100644 --- a/software/code/xor.S +++ b/software/code/xor.S @@ -1,8 +1,8 @@ .global _start _start: - addi x10, x0, 5; - addi x11, x0, 3; + addi x10, zero, 5; + addi x11, zero, 3; add x12, x10, x11; xor x9, x10, x10; diff --git a/software/code/xori.S b/software/code/xori.S index 88cc076..2904af6 100644 --- a/software/code/xori.S +++ b/software/code/xori.S @@ -1,8 +1,8 @@ .global _start _start: - addi x10, x0, 5; - addi x11, x0, 3; + addi x10, zero, 5; + addi x11, zero, 3; add x12, x10, x11; xori x9, x10, 7; diff --git a/software/memory/sltiu.hex b/software/memory/sltiu.hex index 3544677..5b5771c 100644 --- a/software/memory/sltiu.hex +++ b/software/memory/sltiu.hex @@ -2,3 +2,12 @@ 01400613 00f5b693 00a63713 +fff00793 +00001837 +dff80813 +00000513 +0007b893 +80083293 +00053313 +0007b393 +80053e13 diff --git a/software/memory/sltu.hex b/software/memory/sltu.hex index bdeee74..67315dd 100644 --- a/software/memory/sltu.hex +++ b/software/memory/sltu.hex @@ -2,3 +2,12 @@ 01400613 00c5b6b3 00b63733 +fff00793 +e0000837 +fff80813 +00000513 +0107b8b3 +00f832b3 +00a53333 +00a7b3b3 +00f53e33 diff --git a/software/memory/sra.hex b/software/memory/sra.hex index 43cf423..c4946d4 100644 --- a/software/memory/sra.hex +++ b/software/memory/sra.hex @@ -3,3 +3,7 @@ 00100793 40f5d6b3 40f65733 +ffe00813 +40f858b3 +c1800813 +40f852b3