Skip to content

Commit

Permalink
Atualizando testes em assembly
Browse files Browse the repository at this point in the history
Substituindo x0 por zer nos codigos e inclementando testes sltu e sltiu
  • Loading branch information
JN513 committed Apr 26, 2024
1 parent 762519b commit 5277b33
Show file tree
Hide file tree
Showing 38 changed files with 159 additions and 110 deletions.
4 changes: 2 additions & 2 deletions software/code/add.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions software/code/addi.S
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions software/code/and.S
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion software/code/andi.S
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.global _start

_start:
addi x10, x0, 5;
addi x10, zero, 5;

andi x9, x10, 5;
andi x8, x10, 3;
Expand Down
12 changes: 6 additions & 6 deletions software/code/beq.S
Original file line number Diff line number Diff line change
@@ -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;
12 changes: 6 additions & 6 deletions software/code/beq2.S
Original file line number Diff line number Diff line change
@@ -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;
8 changes: 4 additions & 4 deletions software/code/beq3.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/beq4.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bge.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bge2.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bgeu.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bgeu2.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/blt.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/blt2.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bltu.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bltu2.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bne.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/bne2.S
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions software/code/fpga_test.S
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 3 additions & 3 deletions software/code/jal.S
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 3 additions & 3 deletions software/code/jalr.S
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 3 additions & 3 deletions software/code/jalr2.S
Original file line number Diff line number Diff line change
@@ -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;
Loading

0 comments on commit 5277b33

Please sign in to comment.