Makefile global + clean CA + clean Proc

This commit is contained in:
Paul Faure 2021-06-10 18:42:10 +02:00
parent 103916875f
commit a91b7dc79d
7 changed files with 32 additions and 54 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.bin
*.memasm
*.regasm

@ -1 +1 @@
Subproject commit c2a70038eaf9e286fe57234a6e01a45fcb962739
Subproject commit afbc1461c4491222906cdb448ee613a6c2587706

@ -1 +1 @@
Subproject commit 0288b38c67725f98e9f65a195c22c525675b7948
Subproject commit 985bd00388d0d40b521cca640076d6bfc57e3c8a

View file

@ -19,20 +19,35 @@ else ifeq ($(QUOI),null)
@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_asm|load|all]\""
else
ifeq ($(QUOI),compile)
@echo "Compilation"
cat $(SOURCE).c | Compilateur/rondoudou_gcc
mv output.txt $(SOURCE).memasm
@mv output.txt $(SOURCE).memasm
@echo "Compilation terminée"
else ifeq ($(QUOI),cross_asm)
@echo "CrossAssemblage"
cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
mv output.asm $(SOURCE).regasm
mv output.bin $(SOURCE).bin
@mv output.asm $(SOURCE).regasm
@mv output.bin $(SOURCE).bin
@echo "CrossAssemblage terminé"
else ifeq ($(QUOI),load)
@echo "Non encore supporté"
@echo "Chargement du binaire"
@sed -r "s/signal MEMORY : STD_LOGIC_VECTOR \(\(Mem_Size \* Nb_bits\)-1 downto 0\) := \"[01]*\";/signal MEMORY : STD_LOGIC_VECTOR \(\(Mem_Size \* Nb_bits\)-1 downto 0\) := $$(cat $(SOURCE).bin);/g" Processeur/Processeur.srcs/sources_1/new/MemoireInstructions.vhd > $(SOURCE).tmp.vhd
@mv $(SOURCE).tmp.vhd Processeur/Processeur.srcs/sources_1/new/MemoireInstructions.vhd
@echo "Chargement du binaire terminé"
else ifeq ($(QUOI),all)
@echo "Compilation"
cat $(SOURCE).c | Compilateur/rondoudou_gcc
mv output.txt $(SOURCE).memasm
@mv output.txt $(SOURCE).memasm
@echo "Compilation terminée"
@echo "CrossAssemblage"
cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
mv output.asm $(SOURCE).regasm
mv output.bin $(SOURCE).bin
@mv output.asm $(SOURCE).regasm
@mv output.bin $(SOURCE).bin
@echo "CrossAssemblage terminé"
@echo "Chargement du binaire"
@sed -r "s/signal MEMORY : STD_LOGIC_VECTOR \(\(Mem_Size \* Nb_bits\)-1 downto 0\) := \"[01]*\";/signal MEMORY : STD_LOGIC_VECTOR \(\(Mem_Size \* Nb_bits\)-1 downto 0\) := $$(cat $(SOURCE).bin);/g" Processeur/Processeur.srcs/sources_1/new/MemoireInstructions.vhd > $(SOURCE).tmp.vhd
@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_asm|load|all]\""
endif

@ -1 +1 @@
Subproject commit df3b1ecdacb03fd539d18d51983aab2d03493e5d
Subproject commit d57f8a5b375cfef0ca77a7bb6f54cdec19c47b83

44
max.c
View file

@ -1,44 +0,0 @@
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));
}

4
prog.c Normal file
View file

@ -0,0 +1,4 @@
int main() {
int a = 2;
printf(a);
}