Interpreteur terminé, processeur terminé, taf tester deux version proc, tester interpreteur, faire compilateur sur proc non secu

This commit is contained in:
Paul Faure 2021-06-18 09:32:43 +02:00
parent e53f904e23
commit 00d38d91fd
8 changed files with 89 additions and 11 deletions

3
.gitmodules vendored
View file

@ -7,3 +7,6 @@
[submodule "Compilateur"]
path = Compilateur
url = https://git.etud.insa-toulouse.fr/pfaure/Compilateur.git
[submodule "Interpreteur"]
path = Interpreteur
url = https://git.etud.insa-toulouse.fr/pfaure/Interpreteur.git

@ -1 +1 @@
Subproject commit bbd3585d9618fa0ca824cb5e6e63342296312a09
Subproject commit 7718e9c861a78b48272d5d8a759a922594e25a16

@ -1 +1 @@
Subproject commit 74647c41de4366a587e2dbb1789d4dab27bd8790
Subproject commit 96a7569291b22cc8f7339081be431554c83f86fc

1
Interpreteur Submodule

@ -0,0 +1 @@
Subproject commit 9c38352e612609ceb06ea82c10c31790e89feae8

View file

@ -6,7 +6,7 @@ default:
compile:
ifeq ($(QUOI),null)
@echo "USAGE : make compile QUOI=\"[compilateur|cross_assembleur|all]\""
@echo "USAGE : make compile QUOI=\"[compilateur|interpreteur|cross_assembleur|all]\""
else
ifeq ($(QUOI),compilateur)
@echo "Compilation du compilateur"
@ -16,33 +16,45 @@ else ifeq ($(QUOI),cross_asembleur)
@echo "Compilation du CrossAssembleur"
$(MAKE) -C CrossAssembleur build
@echo "Compilation terminée"
else ifeq ($(QUOI),interpreteur)
@echo "Compilation de l'interpreteur"
$(MAKE) -C Interpreteur build
@echo "Compilation terminée"
else ifeq ($(QUOI),all)
@echo "Compilation du compilateur"
$(MAKE) -C Compilateur build
@echo "Compilation terminée"
@echo "Compilation de l'interpreteur"
$(MAKE) -C Interpreteur build
@echo "Compilation terminée"
@echo "Compilation du CrossAssembleur"
$(MAKE) -C CrossAssembleur build
@echo "Compilation terminée"
else
@echo "USAGE : make compile QUOI=\"[compilateur|cross_assembleur|all]\""
@echo "USAGE : make compile QUOI=\"[compilateur|interpreteur|cross_assembleur|all]\""
endif
endif
clean:
$(MAKE) -C Compilateur clean
$(MAKE) -C Interpreteur clean
$(MAKE) -C CrossAssembleur clean
exec:
ifeq ($(SOURCE),null)
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_assemble|load|all]\""
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|interprete|cross_assemble|load|all]\""
else ifeq ($(QUOI),null)
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_assemble|load|all]\""
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|interprete|cross_assemble|load|all]\""
else
ifeq ($(QUOI),compile)
@echo "Compilation"
cat $(SOURCE).c | Compilateur/rondoudou_gcc
@mv output.txt $(SOURCE).memasm
@echo "Compilation terminée"
else ifeq ($(QUOI),interprete)
@echo "Interpretation"
cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
@echo "Interpretation terminée"
else ifeq ($(QUOI),cross_assemble)
@echo "CrossAssemblage"
cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
@ -59,6 +71,9 @@ else ifeq ($(QUOI),all)
cat $(SOURCE).c | Compilateur/rondoudou_gcc
@mv output.txt $(SOURCE).memasm
@echo "Compilation terminée"
@echo "Interpretation"
cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
@echo "Interpretation terminée"
@echo "CrossAssemblage"
cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
@mv output.asm $(SOURCE).regasm
@ -69,7 +84,7 @@ else ifeq ($(QUOI),all)
@mv $(SOURCE).tmp.vhd Processeur/Processeur.srcs/sources_1/new/MemoireInstructions.vhd
@echo "Chargement du binaire terminé"
else
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_assemble|load|all]\""
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|interprete|cross_assemble|load|all]\""
endif
endif

@ -1 +1 @@
Subproject commit 402e684461fbf9ee503dfece6e4d6154acc135f7
Subproject commit 5663419784db4c244ec440af70ed1b5b3a1fcebc

44
max.c Normal file
View file

@ -0,0 +1,44 @@
int get_value() {
int i = 0;
while (i<5) {
printf(0);
stop(1);
printf(255);
stop(1);
i = i+1;
}
stop(15);
i = get();
return i;
}
int max(int * tab, int size) {
int i = 0;
int max = 0;
while (i<size) {
if (tab[i] > max) {
max = tab[i];
}
i = i+1;
}
return max;
}
int main() {
int tab[10];
int i = 0;
while (i<10) {
tab[i] = get_value();
i = i+1;
}
i = 0;
while (i<5) {
printf(170);
stop(1);
printf(85);
stop(1);
i = i+1;
}
stop(3);
printf(max(tab, 10));
}

21
prog.c
View file

@ -1,4 +1,19 @@
int main() {
int a = 2;
printf(a);
int max(int * tab, int size) {
int i = 0;
int max = 0;
printf(size);
while (i<size) {
printf(tab[i]);
if (tab[i] > max) {
max = tab[i];
printf(200);
}
i = i+1;
}
return max;
}
int main() {
int tab[10] = {1,2,3,4,5,6,7,8,9,0};
printf(max(tab, 10));
}