ONGOING: Test programs

This commit is contained in:
François Autin
2023-02-08 15:01:41 +00:00
parent 54a20296f9
commit fe930e4a0d
15 changed files with 167 additions and 0 deletions

View File

@ -0,0 +1,2 @@
TOPDIR = ../
include $(TOPDIR)/Makefile.objdumps

View File

@ -0,0 +1,15 @@
int main() {
int x = 0;
int y = 1;
while (x <= y) {
if (x > y) {
x += 1;
} else if (x == y) {
x += y;
} else if (x < y) {
y += 1;
} else {
return;
}
}
}

View File

@ -0,0 +1,10 @@
int main() {
int x = 1;
if (x == 1 && x > 0) {
x = 2;
} else if (x || x == 0 ) {
x = 3;
} else {
x = 0;
}
}

View File

@ -0,0 +1,7 @@
int main() {
int x = 0;
switch(1) {
case 1: x = 1; break;
default: return;
}
}

View File

@ -0,0 +1,7 @@
int test() {
return 1;
}
int main() {
int x = test();
}

View File

@ -0,0 +1,3 @@
int main() {
return 1;
}

View File

@ -0,0 +1,15 @@
# Simple arithmetics program
These allow to check whether the following instructions are correctly implemented.
- addi
- sd
- sw
- li
- sw
- lw
- mv
- addw
- nop
- ld
- ret

View File

@ -0,0 +1,6 @@
// EXPECTS TWO VARIABLES WITH A VALUE OF UNSIGNED 1
void main() {
unsigned int x = 0;
unsigned int y = 1;
x = x + y;
}

View File

@ -0,0 +1,6 @@
// Expecting two variables with a value of two
void main() {
unsigned int x = 4;
unsigned int y = 2;
x = x / y;
}

View File

@ -0,0 +1,6 @@
// EXPECTS TWO VARIABLES WITH A VALUE OF UNSIGNED 2
void main() {
unsigned int x = 1;
unsigned int y = 2;
x = x * y;
}

View File

@ -0,0 +1,6 @@
// EXPECTS TWO VARIABLES WITH A VALUE OF UNSIGNED 1
void main() {
unsigned int x = 1;
unsigned int y = 1;
x = x - y;
}