Browse Source

Version fonctionnelle processeur sécurisé

Paul Faure 2 years ago
parent
commit
496ec68147
9 changed files with 52 additions and 17 deletions
  1. 3
    0
      .gitmodules
  2. 1
    1
      Compilateur
  3. 1
    1
      CrossAssembleur
  4. 1
    1
      Interpreteur
  5. 1
    0
      InterpreteurRegistres
  6. 18
    8
      Makefile
  7. 1
    1
      Processeur
  8. 24
    5
      max.c
  9. 2
    0
      prog.c

+ 3
- 0
.gitmodules View File

@@ -10,3 +10,6 @@
10 10
 [submodule "Interpreteur"]
11 11
 	path = Interpreteur
12 12
 	url = https://git.etud.insa-toulouse.fr/pfaure/Interpreteur.git
13
+[submodule "InterpreteurRegistres"]
14
+	path = InterpreteurRegistres
15
+	url = https://git.etud.insa-toulouse.fr/pfaure/InterpreteurRegistres.git

+ 1
- 1
Compilateur

@@ -1 +1 @@
1
-Subproject commit b501ce3389db4142df557e6bca95434e591741f6
1
+Subproject commit 5eaffa4453e7258dd79040a10d7d7b7205eaefab

+ 1
- 1
CrossAssembleur

@@ -1 +1 @@
1
-Subproject commit 96a7569291b22cc8f7339081be431554c83f86fc
1
+Subproject commit 712e317901212d1917739b90577e715154e09afe

+ 1
- 1
Interpreteur

@@ -1 +1 @@
1
-Subproject commit c9c60001de4ae1f8e379dbc210b7a70a6b2dd934
1
+Subproject commit 725e0125079b6bde8ad032a3be21910980900ec4

+ 1
- 0
InterpreteurRegistres

@@ -0,0 +1 @@
1
+Subproject commit bff261fa01129da9135f95f16bf4124366ea24fe

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

+ 1
- 1
Processeur

@@ -1 +1 @@
1
-Subproject commit 5663419784db4c244ec440af70ed1b5b3a1fcebc
1
+Subproject commit ca762f57c7c544656eaea97ec391a5efd4ec401b

+ 24
- 5
max.c View File

@@ -1,4 +1,26 @@
1
+int print_alarm1() {
2
+	int j = 0;
3
+	while (j<5) {
4
+		printf(255);
5
+		stop(2);
6
+		printf(0);
7
+		j = j+1;
8
+	}
9
+}
10
+
11
+int print_alarm2() {
12
+	int j = 0;
13
+	while (j<5) {
14
+		printf(170);
15
+		stop(2);
16
+		printf(85);
17
+		j = j+1;
18
+	}
19
+}
20
+
1 21
 int get_value() {
22
+	print_alarm2();
23
+	stop(10);
2 24
 	int i = get();
3 25
 	return i;
4 26
 }
@@ -22,10 +44,7 @@ int main() {
22 44
 		tab[i] = get_value();
23 45
 		i = i+1;
24 46
 	}
25
-	i = 0;
26
-	while (i<10) {
27
-		printf(tab[i]);
28
-		i = i+1;
29
-	}
47
+
48
+	print_alarm1();
30 49
 	printf(max(tab, 10));
31 50
 }

+ 2
- 0
prog.c View File

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

Loading…
Cancel
Save