Browse Source

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

Paul Faure 2 years ago
parent
commit
00d38d91fd
8 changed files with 88 additions and 10 deletions
  1. 3
    0
      .gitmodules
  2. 1
    1
      Compilateur
  3. 1
    1
      CrossAssembleur
  4. 1
    0
      Interpreteur
  5. 20
    5
      Makefile
  6. 1
    1
      Processeur
  7. 44
    0
      max.c
  8. 17
    2
      prog.c

+ 3
- 0
.gitmodules View File

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

+ 1
- 1
Compilateur

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

+ 1
- 1
CrossAssembleur

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

+ 1
- 0
Interpreteur

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

+ 20
- 5
Makefile View File

@@ -6,7 +6,7 @@ default:
6 6
 
7 7
 compile: 
8 8
 ifeq ($(QUOI),null)
9
-	@echo "USAGE : make compile QUOI=\"[compilateur|cross_assembleur|all]\""
9
+	@echo "USAGE : make compile QUOI=\"[compilateur|interpreteur|cross_assembleur|all]\""
10 10
 else
11 11
 ifeq ($(QUOI),compilateur)
12 12
 	@echo "Compilation du compilateur"
@@ -16,33 +16,45 @@ else ifeq ($(QUOI),cross_asembleur)
16 16
 	@echo "Compilation du CrossAssembleur"
17 17
 	$(MAKE) -C CrossAssembleur build
18 18
 	@echo "Compilation terminée"
19
+else ifeq ($(QUOI),interpreteur)
20
+	@echo "Compilation de l'interpreteur"
21
+	$(MAKE) -C Interpreteur build
22
+	@echo "Compilation terminée"
19 23
 else ifeq ($(QUOI),all)
20 24
 	@echo "Compilation du compilateur"
21 25
 	$(MAKE) -C Compilateur build
22 26
 	@echo "Compilation terminée"
27
+	@echo "Compilation de l'interpreteur"
28
+	$(MAKE) -C Interpreteur build
29
+	@echo "Compilation terminée"
23 30
 	@echo "Compilation du CrossAssembleur"
24 31
 	$(MAKE) -C CrossAssembleur build
25 32
 	@echo "Compilation terminée"
26 33
 else 
27
-	@echo "USAGE : make compile QUOI=\"[compilateur|cross_assembleur|all]\""
34
+	@echo "USAGE : make compile QUOI=\"[compilateur|interpreteur|cross_assembleur|all]\""
28 35
 endif
29 36
 endif
30 37
 
31 38
 clean:
32 39
 	$(MAKE) -C Compilateur clean
40
+	$(MAKE) -C Interpreteur clean
33 41
 	$(MAKE) -C CrossAssembleur clean
34 42
 
35 43
 exec:
36 44
 ifeq ($(SOURCE),null)
37
-	@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_assemble|load|all]\""
45
+	@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|interprete|cross_assemble|load|all]\""
38 46
 else ifeq ($(QUOI),null)
39
-	@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_assemble|load|all]\""
47
+	@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|interprete|cross_assemble|load|all]\""
40 48
 else
41 49
 ifeq ($(QUOI),compile)
42 50
 	@echo "Compilation"
43 51
 	cat $(SOURCE).c | Compilateur/rondoudou_gcc
44 52
 	@mv output.txt $(SOURCE).memasm
45 53
 	@echo "Compilation terminée"
54
+else ifeq ($(QUOI),interprete)
55
+	@echo "Interpretation"
56
+	cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
57
+	@echo "Interpretation terminée"
46 58
 else ifeq ($(QUOI),cross_assemble)
47 59
 	@echo "CrossAssemblage"
48 60
 	cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
@@ -59,6 +71,9 @@ else ifeq ($(QUOI),all)
59 71
 	cat $(SOURCE).c | Compilateur/rondoudou_gcc
60 72
 	@mv output.txt $(SOURCE).memasm
61 73
 	@echo "Compilation terminée"
74
+	@echo "Interpretation"
75
+	cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
76
+	@echo "Interpretation terminée"
62 77
 	@echo "CrossAssemblage"
63 78
 	cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
64 79
 	@mv output.asm $(SOURCE).regasm
@@ -69,7 +84,7 @@ else ifeq ($(QUOI),all)
69 84
 	@mv $(SOURCE).tmp.vhd Processeur/Processeur.srcs/sources_1/new/MemoireInstructions.vhd
70 85
 	@echo "Chargement du binaire terminé"
71 86
 else 
72
-	@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|cross_assemble|load|all]\""
87
+	@echo "USAGE : make exec SOURCE=\"file_name\" QUOI=\"[compile|interprete|cross_assemble|load|all]\""
73 88
 endif
74 89
 endif
75 90
 

+ 1
- 1
Processeur

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

+ 44
- 0
max.c View File

@@ -0,0 +1,44 @@
1
+int get_value() {
2
+	int i = 0;
3
+	while (i<5) {
4
+		printf(0);
5
+		stop(1);
6
+		printf(255);
7
+		stop(1);
8
+		i = i+1;
9
+	}
10
+	stop(15);
11
+	i = get();
12
+	return i;
13
+}
14
+
15
+int max(int * tab, int size) {
16
+	int i = 0;
17
+	int max = 0;
18
+	while (i<size) {
19
+		if (tab[i] > max) {
20
+			max = tab[i];
21
+		}
22
+		i = i+1;
23
+	}
24
+	return max;
25
+}
26
+
27
+int main() {
28
+	int tab[10];
29
+	int i = 0;
30
+	while (i<10) {
31
+		tab[i] = get_value();
32
+		i = i+1;
33
+	}
34
+	i = 0;
35
+	while (i<5) {
36
+		printf(170);
37
+		stop(1);
38
+		printf(85);
39
+		stop(1);
40
+		i = i+1;
41
+	}
42
+	stop(3);
43
+	printf(max(tab, 10));
44
+}

+ 17
- 2
prog.c View File

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

Loading…
Cancel
Save