Browse Source

Commentaires

Paul Faure 2 years ago
parent
commit
d3d3c6da9c

+ 15
- 3
Processeur.srcs/sources_1/new/Compteur_X.vhd View File

@@ -1,22 +1,17 @@
1
-----------------------------------------------------------------------------------
2
-----------------------------------------------------------------------------------
1
+		----------------------------------------------------------------------------------
2
+    -- Company:  INSA-Toulouse
3
+    -- Engineer: Paul Faure
4
+    -- 
5
+		-- Create Date: 05.07.2021 15:20:28
6
+		-- Module Name: Compteur_X - Behavioral
7
+		-- Project Name: Processeur sécurisé
8
+    -- Target Devices: Basys 3 ARTIX7
9
+    -- Tool Versions: Vivado 2016.4
10
+    -- Description: Compteur la coordonnée X du VGA
11
+    -- 
12
+    -- Dependencies: 
13
+    --    - None
14
+    ----------------------------------------------------------------------------------
3 15
 
4 16
 
5 17
 library IEEE;
@@ -57,4 +52,4 @@ begin
57 52
     Value <= current;
58 53
     Carry <= intern_Carry;
59 54
     
60
-end Behavioral;
55
+end Behavioral;

+ 14
- 2
Processeur.srcs/sources_1/new/Compteur_Y.vhd View File

@@ -1,22 +1,17 @@
1
-----------------------------------------------------------------------------------
2
-----------------------------------------------------------------------------------
1
+		----------------------------------------------------------------------------------
2
+    -- Company:  INSA-Toulouse
3
+    -- Engineer: Paul Faure
4
+    -- 
5
+		-- Create Date: 05.07.2021 15:20:28
6
+		-- Module Name: Compteur_Y - Behavioral
7
+		-- Project Name: Processeur sécurisé
8
+    -- Target Devices: Basys 3 ARTIX7
9
+    -- Tool Versions: Vivado 2016.4
10
+    -- Description: Compteur la coordonnée Y du VGA
11
+    -- 
12
+    -- Dependencies: 
13
+    --    - None
14
+    ----------------------------------------------------------------------------------
3 15
 
4 16
 
5 17
 library IEEE;

+ 55
- 34
Processeur.srcs/sources_1/new/Ecran.vhd View File

@@ -1,22 +1,19 @@
1
-----------------------------------------------------------------------------------
2
-----------------------------------------------------------------------------------
1
+		----------------------------------------------------------------------------------
2
+    -- Company:  INSA-Toulouse
3
+    -- Engineer: Paul Faure
4
+    -- 
5
+		-- Create Date: 28.06.2021 09:20:00
6
+		-- Module Name: Ecran - Behavioral
7
+		-- Project Name: Processeur sécurisé
8
+    -- Target Devices: Basys 3 ARTIX7
9
+    -- Tool Versions: Vivado 2016.4
10
+		-- Description: Tableau des caractères à afficher à l'écran 
11
+		-- 		- Ajoute les caractère a la suite les un des autres (comme un fichier avec un curseur)
12
+		-- 		- Prends des coordonnées (X,Y) et renvoi l'état du pixel associé
13
+		-- 
14
+		-- Dependencies: 
15
+  --    - TableASCII
16
+		----------------------------------------------------------------------------------
3 17
 
4 18
 
5 19
 library IEEE;
@@ -28,14 +25,14 @@ use work.font.all;
28 25
 use work.ScreenProperties.all;
29 26
 
30 27
     entity Ecran is
31
-        Port (     CLK            : in STD_LOGIC;
28
+        Port (     CLK            : in STD_LOGIC;                
32 29
                    RST            : in STD_LOGIC;
33
-                   Data_Av        : in STD_LOGIC;
34
-                   Data_IN        : in STD_LOGIC_VECTOR (0 to 6);
30
+                   Data_Av        : in STD_LOGIC;                    -- Un caractère doit être ajouté au tableau
31
+                   Data_IN        : in STD_LOGIC_VECTOR (0 to 6);    -- Caractère à ajouter
35 32
                    
36
-                   X              : in X_T;
37
-                   Y              : in Y_T;
38
-                   OUT_ON         : out STD_LOGIC);
33
+                   X              : in X_T;                          -- Position X
34
+                   Y              : in Y_T;                          -- Position Y
35
+                   OUT_ON         : out STD_LOGIC);                  -- Valeur du pixel (X,Y)
39 36
     end Ecran;
40 37
 
41 38
 architecture Behavioral of Ecran is
@@ -45,32 +42,33 @@ architecture Behavioral of Ecran is
45 42
            Font : out STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1));
46 43
     end component;
47 44
 
48
-    constant Flush : STD_LOGIC_VECTOR (0 to 6) := "0000000";
49
-    constant RetourChariot : STD_LOGIC_VECTOR (0 to 6) := "0001010";
50
-    constant Delete : STD_LOGIC_VECTOR (0 to 6) := "1111111";
45
+		
46
+    constant Flush : STD_LOGIC_VECTOR (0 to 6) := "0000000";           -- Code ASCII du flush
47
+    constant RetourChariot : STD_LOGIC_VECTOR (0 to 6) := "0001010";   -- Code ASCII du retour chariot
48
+    constant Delete : STD_LOGIC_VECTOR (0 to 6) := "1111111";          -- Code ASCII du Delete
51 49
     
52
-    signal Ecran : STD_LOGIC_VECTOR (0 to Ecran_Taille - 1) := (others => '0'); --(0 => '1', 1 => '0', 2 => '0', 3 => '1', 4 => '0', 5 => '0', 6 => '0', others => '0');
50
+    signal Ecran : STD_LOGIC_VECTOR (0 to Ecran_Taille - 1) := (others => '0'); -- Tableau des caractères de l'écran
53 51
     
54
-    signal L : STD_LOGIC_VECTOR (0 to 6) := "0000000";
55
-    signal L_inc : STD_LOGIC_VECTOR (0 to 6);
56
-    signal C : STD_LOGIC_VECTOR (0 to 6) := "0000000";
52
+    signal L : STD_LOGIC_VECTOR (0 to 6) := "0000000"; -- Ligne du tableau dans laquelle il faut écrire (position Y du curseur)
53
+    signal L_inc : STD_LOGIC_VECTOR (0 to 6);          -- L+1 mod Nb_Lignes
54
+    signal C : STD_LOGIC_VECTOR (0 to 6) := "0000000"; -- Colone du tableau dans laquelle il faut écrire (position X du curseur)
57 55
     
58
-    signal InitialL : STD_LOGIC_VECTOR (0 to 6) := "0000000";
59
-    signal InitialL_inc : STD_LOGIC_VECTOR (0 to 6);
60
-    signal Full : STD_LOGIC := '0';
56
+    signal InitialL : STD_LOGIC_VECTOR (0 to 6) := "0000000"; -- Le tableau fonctionne comme un buffer circulaire, il faut donc garder en mémoire la première ligne
57
+    signal InitialL_inc : STD_LOGIC_VECTOR (0 to 6);          -- InitialL+1 mod Nb_Lignes
58
+    signal Full : STD_LOGIC := '0';                           -- Si le tableau est plein
61 59
     
62
-    signal L_Lecture : L_T := 0;
60
+    signal L_Lecture : L_T := 0;                              -- Ligne pour la lecture dans le tableau
63 61
     
64
-    signal point_dereferencement : Natural := 0;
65
-    signal point_dereferencement_ecriture : Natural := 0;
62
+    signal point_dereferencement : Natural := 0;              -- Index dans le tableau ou est stocké le code ASCII correspondant à (X,Y)
63
+    signal point_dereferencement_ecriture : Natural := 0;     -- Index dans le tableau ou la valeur doit être écrite
66 64
     
67
-    signal CurrentCodeASCII : STD_LOGIC_VECTOR (0 to 6) := "0000000";
68
-    signal CurrentFont : STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1) := (others => '0');
65
+    signal CurrentCodeASCII : STD_LOGIC_VECTOR (0 to 6) := "0000000";                                -- Le code ASCII actuellement lu
66
+    signal CurrentFont : STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1) := (others => '0');  -- La font correspondante a ce Code
69 67
     
70
-    signal position_X : X_T := 0;
71
-    signal position_Y : Y_T := 0;
68
+    signal position_X : X_T := 0;    -- Signal pour décaler X de manière a introduire une marge
69
+    signal position_Y : Y_T := 0;    -- Signal pour décaler Y de manière a introduire une marge
72 70
     
73
-    signal active : Boolean := false;
71
+    signal active : Boolean := false;   -- Nous sommes (ou non) dans la zone active de l'écran
74 72
     
75 73
 begin
76 74
 
@@ -82,22 +80,27 @@ begin
82 80
     begin
83 81
         wait until CLK'event and CLK='1';
84 82
         if (RST = '0' or (Data_Av = '1' and Data_IN = Flush)) then
83
+						-- Reset ou FLUSH
85 84
             Ecran <= (others => '0');
86 85
             L <= "0000000";
87 86
             C <= "0000000";
88 87
             InitialL <= "0000000";
89 88
             Full <= '0';
90 89
         elsif (Data_Av = '1') then
90
+						-- Data disponible
91 91
             if (Data_IN = Delete) then
92
+								-- Un Delete, on efface un caractère sur la ligne (Nb : on ne peut effacer que la ligne courante)
92 93
                 if (C > 0) then
93 94
                     C <= C - 1;
94 95
                     Ecran(7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C)) - 1) to 7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C))) - 1) <= "0000000";
95 96
                 end if; 
96 97
             elsif (Data_In /= RetourChariot) then
98
+								-- Un caractère lamda, on l'écrit 
97 99
                 Ecran(point_dereferencement_ecriture to point_dereferencement_ecriture + 6) <= Data_IN;
98 100
                 C <= C + 1; 
99 101
             end if;
100 102
             if (Data_IN = RetourChariot or (C + 1 = C_Blocks and Data_IN /= Delete)) then
103
+								-- Si besoin on saute a la ligne suivant
101 104
                 C <= "0000000";
102 105
                 L <= L_inc;
103 106
                 if (L_inc = "0000000" or Full = '1') then
@@ -109,21 +112,22 @@ begin
109 112
         end if;            
110 113
     end process;
111 114
     
115
+		-- Gestion des signaux d'écriture
112 116
     L_inc <= "0000000" when L + 1 = L_Blocks else L + 1;
113 117
     InitialL_inc <= "0000000" when InitialL + 1 = L_Blocks else InitialL + 1;
114 118
     point_dereferencement_ecriture <= 7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C)));
115 119
     
116 120
     
117 121
     
122
+    -- Gestion des signaux de lecture
123
+    position_X <= X - margin when X >= 0 + margin and X < screen_width  - margin else 0; -- Prise en compte des marges
124
+    position_Y <= Y - margin when Y >= 0 + margin and Y < screen_height - margin else 0; -- Prise en compte des marges
125
+    active <= X >= 0 + margin and X < screen_width  - margin and Y >= 0 + margin and Y < screen_height - margin; -- Fenetre active ?
126
+    L_Lecture <= position_Y/Display_CaracterHeight + to_integer(unsigned(InitialL)) - L_Blocks when (position_Y/Display_CaracterHeight + to_integer(unsigned(InitialL))) >= L_Blocks else position_Y/Display_CaracterHeight + to_integer(unsigned(InitialL));   -- Calcul de la ligne de lecture
127
+    point_dereferencement <= (7 * (C_Blocks * L_Lecture + (position_X/Display_CaracterWidht)));  -- Calcul du point de déréférencement 
118 128
     
119
-    position_X <= X - margin when X >= 0 + margin and X < screen_width  - margin else 0;
120
-    position_Y <= Y - margin when Y >= 0 + margin and Y < screen_height - margin else 0;
121
-    active <= X >= 0 + margin and X < screen_width  - margin and Y >= 0 + margin and Y < screen_height - margin;
122
-    L_Lecture <= position_Y/Display_CaracterHeight + to_integer(unsigned(InitialL)) - L_Blocks when (position_Y/Display_CaracterHeight + to_integer(unsigned(InitialL))) >= L_Blocks else position_Y/Display_CaracterHeight + to_integer(unsigned(InitialL));   
123
-    point_dereferencement <= (7 * (C_Blocks * L_Lecture + (position_X/Display_CaracterWidht)));
124
-    
125
-    CurrentCodeASCII <= Ecran(point_dereferencement to point_dereferencement + 6);
129
+    CurrentCodeASCII <= Ecran(point_dereferencement to point_dereferencement + 6); -- Recupération du code ASCII
126 130
 
127
-    OUT_ON <= CurrentFont(((position_Y mod Display_CaracterHeight) / (Display_CaracterHeight / font_height)) * font_width + ((Display_CaracterWidht - 1) - (position_X mod Display_CaracterWidht)) / (Display_CaracterWidht / font_width)) when active else '0';
131
+    OUT_ON <= CurrentFont(((position_Y mod Display_CaracterHeight) / (Display_CaracterHeight / font_height)) * font_width + ((Display_CaracterWidht - 1) - (position_X mod Display_CaracterWidht)) / (Display_CaracterWidht / font_width)) when active else '0'; -- Calcul de l'état du pixel
128 132
 
129 133
 end Behavioral;

+ 1
- 0
Processeur.srcs/sources_1/new/Etage1_LectureInstruction_NS.vhd View File

@@ -7,7 +7,7 @@
7 7
 -- Project Name: Processeur sécurisé
8 8
 -- Target Devices: Basys 3 ARTIX7
9 9
 -- Tool Versions: Vivado 2016.4
10
+-- Description: Etage 1 du processeur (version non sécurisée)
10 11
 --     - Gestion des instructions, lecture en mémoire
11 12
 --     - Gestion des aléas sur les registres
12 13
 --     - Gestion des sauts et appels de fonction

+ 2
- 1
Processeur.srcs/sources_1/new/Etage4_Memoire_NS.vhd View File

@@ -8,7 +8,7 @@
8 8
 -- Target Devices: Basys 3 ARTIX7
9 9
 -- Tool Versions: Vivado 2016.4
10 10
 --
11
+-- Description: Etage 4 du processeur (non sécurisé)
11 12
 --     - Gestion de la mémoire
12 13
 --     - Gestion de la sauvegarde du contexte et de l'adresse de retour lors des appels de fonction
13 14
 -- 
@@ -188,4 +188,4 @@ begin
188 188
            
189 189
     Addr_MemoireDonnees_EBP <= IN_Addr_MemoireDonnees + EBP;
190 190
            
191
-end Structural;
191
+end Structural;

+ 11
- 6
Processeur.srcs/sources_1/new/Keyboard.vhd View File

@@ -1,36 +1,25 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 01.07.2021 09:09:30
4 6
 -- Module Name: Keyboard - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Composant clavier, intègre le controleur du clavier pour en faire un composant bufferisé
5 12
 -- 
6 13
 -- Dependencies: 
14
+--   - KeyboardControler
15
+--   - KeyboardToASCII
16
+--
17
+-- Comments : Transforme aussi la keycode en code ASCII
7 18
 ----------------------------------------------------------------------------------
8 19
 
9
-
10 20
 library IEEE;
11 21
 use IEEE.STD_LOGIC_1164.ALL;
12 22
 
13
---use IEEE.NUMERIC_STD.ALL;
14
-
15
---library UNISIM;
16
---use UNISIM.VComponents.all;
17
-
18 23
 entity Keyboard is
19 24
     Port (CLK : in STD_LOGIC;
20 25
   

+ 34
- 5
Processeur.srcs/sources_1/new/KeyboardControler.vhd View File

@@ -1,36 +1,24 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 01.07.2021 09:09:30
4 6
 -- Module Name: KeyboardControler - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: ALU 
5 12
 -- 
13
+-- Dependencies: Fait le lien avec le BUS PS2 du clavier, récupère la touche tapée et la renvoi 
14
+--
15
+-- Comments : Il n'y a pas de bufferisation
6 16
 ----------------------------------------------------------------------------------
7 17
 
8 18
 
9 19
 library IEEE;
10 20
 use IEEE.STD_LOGIC_1164.ALL;
11 21
 
12
---use IEEE.NUMERIC_STD.ALL;
13
-
14
---library UNISIM;
15
---use UNISIM.VComponents.all;
16
-
17 22
 entity KeyboardControler is
18 23
   Port (CLK : in STD_LOGIC;
19 24
   
@@ -45,58 +33,80 @@ end KeyboardControler;
45 33
 
46 34
 architecture Behavioral of KeyboardControler is
47 35
 
36
+		-- Compteur pour récupérer la trame PS2
48 37
     subtype compteur_T is Natural range 0 to 10;
49 38
     signal compteur : compteur_T := 0;
39
+
40
+		-- Trame en cours de lecture 
50 41
     signal current_data : STD_LOGIC_VECTOR (0 to 7) := (others => '0');
42
+		-- Denière trame lue
51 43
     signal previous_data : STD_LOGIC_VECTOR (0 to 7) := (others => '0');
44
+		
45
+		-- Signaux pour controler le bit de parité de la trame
52 46
     signal parity : STD_LOGIC := '0';
53 47
     signal intern_alert : STD_LOGIC := '0';
48
+
49
+		-- Signaux pour signaler qu'une touche a été préssée
54 50
     signal intern_Data_av : STD_LOGIC := '0';
55 51
     signal dejaSignale : boolean := false;
56 52
 
57 53
 begin
58 54
     
55
+		-- process de récupération de la trame, synchronisé sur la CLK du bus PS2
56
+		-- A chaque front montant on lit ce qu'il y a a lire et on avance le compteur
59 57
     process 
60 58
     begin
61 59
         wait until PS2Clk'event and PS2Clk = '1';
62 60
         case compteur is
63 61
         when 0 =>
62
+						-- Bit de start : on réinitialise tout
64 63
             parity <= '1'; 
65 64
             intern_alert <= '0';   
66 65
             intern_Data_av <= '0';
67 66
         when 1 =>
67
+						-- Lecture et MAJ de la parité
68 68
             current_data(7) <= PS2Data;
69 69
             parity <= parity XOR PS2Data;
70 70
         when 2 =>
71
+						-- Lecture et MAJ de la parité
71 72
             current_data(6) <= PS2Data;
72 73
             parity <= parity XOR PS2Data;
73 74
         when 3 =>
75
+						-- Lecture et MAJ de la parité
74 76
             current_data(5) <= PS2Data;
75 77
             parity <= parity XOR PS2Data;
76 78
         when 4 =>
79
+						-- Lecture et MAJ de la parité
77 80
             current_data(4) <= PS2Data;
78 81
             parity <= parity XOR PS2Data;
79 82
         when 5 =>
83
+						-- Lecture et MAJ de la parité
80 84
             current_data(3) <= PS2Data;
81 85
             parity <= parity XOR PS2Data;
82 86
         when 6 =>
87
+						-- Lecture et MAJ de la parité
83 88
             current_data(2) <= PS2Data;
84 89
             parity <= parity XOR PS2Data;
85 90
         when 7 =>
91
+						-- Lecture et MAJ de la parité
86 92
             current_data(1) <= PS2Data;
87 93
             parity <= parity XOR PS2Data;
88 94
         when 8 =>
95
+						-- Lecture et MAJ de la parité
89 96
             current_data(0) <= PS2Data;
90 97
             parity <= parity XOR PS2Data;
91 98
         when 9 =>
99
+						-- Check de la parité
92 100
             if (parity = PS2Data) then
93 101
                 intern_alert <= '0';
94 102
             else 
95 103
                 intern_alert <= '1';
96 104
             end if;
97 105
         when 10 =>
106
+						-- Envoi de la touche
98 107
             if (intern_alert = '0') then
99 108
                 previous_data <= current_data;
109
+								-- Elimination des touches non classiques
100 110
                 if (not (previous_data = "11110000" or current_data = "11110000" or previous_data = "11100000")) then
101 111
                     Data <= current_data;
102 112
                     intern_Data_av <= '1';
@@ -107,6 +117,8 @@ begin
107 117
         compteur <= (compteur + 1) mod 11;
108 118
     end process;
109 119
     
120
+
121
+		-- Gestion de l'avertissement de touche
110 122
     process
111 123
     begin
112 124
         wait until CLK'event and CLK = '1';

+ 27
- 14
Processeur.srcs/sources_1/new/KeyboardDriver.vhd View File

@@ -1,21 +1,16 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 13.07.2021 09:30:08
4 6
 -- Module Name: KeyboardDriver - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Driver pour interfacer le clavier avec les besoins du processeur 
5 12
 -- 
13
+-- Dependencies: None
6 14
 ----------------------------------------------------------------------------------
7 15
 
8 16
 
@@ -24,26 +19,21 @@ use IEEE.STD_LOGIC_1164.ALL;
24 19
 use IEEE.STD_LOGIC_UNSIGNED.ALL;
25 20
 use IEEE.NUMERIC_STD.ALL;
26 21
 
27
---use IEEE.NUMERIC_STD.ALL;
28
-
29
---library UNISIM;
30
---use UNISIM.VComponents.all;
31
-
32 22
 entity KeyboardDriver is
33 23
     Generic (Nb_Bits : Natural);
34
-    Port (CLK : in STD_LOGIC;
35
-          Data_read : out STD_LOGIC;
36
-          Data_av : in STD_LOGIC;
37
-          Data : in STD_LOGIC_VECTOR (0 to 6);
38
-          STD_IN : out STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0);
39
-          STD_IN_Av : out STD_LOGIC;
40
-          STD_IN_Request : in STD_LOGIC;
41
-          STD_OUT : out STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0);
42
-          STD_OUT_Av : out STD_LOGIC);
24
+    Port (CLK : in STD_LOGIC; 
25
+
26
+          Data_read : out STD_LOGIC;                            -- ******************************
27
+          Data_av : in STD_LOGIC;                               -- ***** Signaux du clavier *****
28
+          Data : in STD_LOGIC_VECTOR (0 to 6);                  -- ******************************
29
+
30
+          STD_IN : out STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0); -- ******************************
31
+          STD_IN_Av : out STD_LOGIC;                            -- *** Signaux du processeur  ***
32
+          STD_IN_Request : in STD_LOGIC;                        -- ******************************
33
+
34
+          STD_OUT : out STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0);-- ******************************
35
+          STD_OUT_Av : out STD_LOGIC);                          -- **** Signaux d'affichage  ****
36
+
43 37
 end KeyboardDriver;
44 38
 
45 39
 architecture Behavioral of KeyboardDriver is
@@ -64,23 +54,29 @@ begin
64 54
             intern_value <= 0;
65 55
         end if;
66 56
         if STD_IN_Request = '1' then  
57
+						-- Si on nous demande une valeur
67 58
             work_in_progress <= true;
68 59
             if Data_av = '1' then
60
+								-- Si une touche a été appuyée 
69 61
                 if (Data = "1111111") then
62
+										-- Si c'est un Delete, on divide la valeur actuelle par 10
70 63
                     intern_value <= intern_value / 10;
71 64
                     STD_OUT <= Zeros & Data;
72 65
                     STD_OUT_Av <= '1';
73 66
                 elsif (Data = "0001010") then
67
+										-- Si c'est un Enter, on envoi la velaue au processeur
74 68
                     STD_IN <= std_logic_vector(to_unsigned(intern_value, Nb_bits));
75 69
                     STD_IN_Av <= '1';
76 70
                     work_in_progress <= false;
77 71
                     STD_OUT <= Zeros & Data;
78 72
                     STD_OUT_Av <= '1';
79 73
                 elsif (Data >= "0110000" and Data <= "0111001") then
74
+										-- Si c'est un nombre, on décale la valeur d'un chiffre a gauche puis un insere la touche saisie
80 75
                     intern_value <= intern_value * 10 + to_integer(unsigned(Data(3 to 6)));
81 76
                     STD_OUT <= Zeros & Data;
82 77
                     STD_OUT_Av <= '1';
83 78
                 end if;
79
+								-- Toute autre touche est ignorée 
84 80
             end if;
85 81
         end if; 
86 82
     end process;

+ 10
- 0
Processeur.srcs/sources_1/new/KeyboardToASCII.vhd View File

@@ -1,21 +1,18 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 02.07.2021 10:43:18
4 6
 -- Module Name: KeyboardToASCII - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Associe le code ASCII au keycode de la touche 
5 12
 -- 
13
+-- Dependencies: None
14
+--
15
+-- Comments : Assynchrone
6 16
 ----------------------------------------------------------------------------------
7 17
 
8 18
 

+ 7
- 7
Processeur.srcs/sources_1/new/MemoireDonnees.vhd View File

@@ -23,12 +23,12 @@ entity MemoireDonnees is
23 23
     Port ( Addr : in STD_LOGIC_VECTOR (Addr_size-1 downto 0); -- L'adresse a laquelle il faut agir
24 24
            RW : in STD_LOGIC; -- Ce qu'il faut faire ('1' -> Read, '0' -> Write)
25 25
            D_IN : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0); -- Data a ecrire (si RW = 0)
26
-           CALL : in STD_LOGIC; -- '1' -> CALL en cours
27
-           IN_EBP : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0); -- Valeur d'EBP à stocker en cas de CALL
28
-           IN_AddrRet : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0); -- Valeur d'@ de retour à stocker en cas de CALL
29
-           RET : in STD_LOGIC; -- '1' -> RET en cours
30
-           OUT_EBP : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0) := (others => '0'); -- Valeur d'EBP à renvoyer en cas de RET
31
-           OUT_AddrRet : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0) := (others => '0'); -- Valeur d'@ de retour à renvoyer en cas de RET
26
+           CALL : in STD_LOGIC; -- '1' -> CALL en cours (INUTILE POUR LA VERSION SECURISEE)
27
+           IN_EBP : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0); -- Valeur d'EBP à stocker en cas de CALL (INUTILE POUR LA VERSION SECURISEE)
28
+           IN_AddrRet : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0); -- Valeur d'@ de retour à stocker en cas de CALL (INUTILE POUR LA VERSION SECURISEE)
29
+           RET : in STD_LOGIC; -- '1' -> RET en cours (INUTILE POUR LA VERSION SECURISEE)
30
+           OUT_EBP : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0) := (others => '0'); -- Valeur d'EBP à renvoyer en cas de RET (INUTILE POUR LA VERSION SECURISEE)
31
+           OUT_AddrRet : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0) := (others => '0'); -- Valeur d'@ de retour à renvoyer en cas de RET (INUTILE POUR LA VERSION SECURISEE)
32 32
            RST : in STD_LOGIC; -- Reset
33 33
            CLK : in STD_LOGIC; -- Clock
34 34
            D_OUT : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0) := (others => '0')); -- Sortie de la mémoire 
@@ -62,4 +62,4 @@ begin
62 62
                (others => '0'); 
63 63
     OUT_AddrRet <= MEMORY ((to_integer(unsigned(Addr)) * Nb_bits - 1) downto Nb_bits * (to_integer(unsigned(Addr)) - 1)) when (RET = '1') else 
64 64
                    (others => '0');
65
-end Behavioral;
65
+end Behavioral;

+ 11
- 5
Processeur.srcs/sources_1/new/PeripheriqueClavier.vhd View File

@@ -1,36 +1,26 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 13.07.2021 09:30:08
4 6
 -- Module Name: PeripheriqueClavier - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Assemble les composants du clavier pour faire un composant périphérique que l'on peut connecter au processeur
12
+--  - Le clavier (controleur intégré)
13
+--  - Le driver 
5 14
 -- 
6 15
 -- Dependencies: 
16
+--  - Keyboard
17
+--  - KeyboardDriver
7 18
 ----------------------------------------------------------------------------------
8 19
 
9 20
 
10 21
 library IEEE;
11 22
 use IEEE.STD_LOGIC_1164.ALL;
12 23
 
13
---use IEEE.NUMERIC_STD.ALL;
14
-
15
---library UNISIM;
16
---use UNISIM.VComponents.all;
17
-
18 24
 entity PeripheriqueClavier is
19 25
     Generic (Nb_Bits : Natural);
20 26
     Port ( CLK : in STD_LOGIC;

+ 16
- 0
Processeur.srcs/sources_1/new/PeripheriqueEcran.vhd View File

@@ -1,21 +1,25 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 09.07.2021 15:25:56
4 6
 -- Module Name: PeripheriqueEcran - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Assemble les composants de l'écran pour faire un composant périphérique que l'on peut connecter au processeur
12
+--  - Le controleur 
13
+--  - L'écran
14
+--  - Le driver 
5 15
 -- 
6 16
 -- Dependencies: 
17
+--  - VGAControler
18
+--  - Ecran
19
+--  - ScreenDriver
20
+--  - clk_wiz_0
21
+--
22
+-- Comments : la clock doit être accélérée pour atteindre 108Mhz pour le VGA
7 23
 ----------------------------------------------------------------------------------
8 24
 
9 25
 

+ 29
- 18
Processeur.srcs/sources_1/new/Pipeline.vhd View File

@@ -1,49 +1,38 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 19.04.2021 16:57:41
4 6
 -- Module Name: Pipeline - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+-- Description: Version sécurisée du pipeline, connecte les étages et fait avancer les signaux sur le pipeline
5 11
 -- 
6 12
 -- Dependencies: 
13
+--    - Etage1_LectureInstruction
14
+--    - Etage2_5_Registres
15
+--    - Etage3_Calcul
16
+--    - Etage4_Memoire
7 17
 ----------------------------------------------------------------------------------
8 18
 
9 19
 
10 20
 library IEEE;
11 21
 use IEEE.STD_LOGIC_1164.ALL;
12 22
 
13
---use IEEE.NUMERIC_STD.ALL;
14
-
15
---library UNISIM;
16
---use UNISIM.VComponents.all;
17
-
18 23
 entity Pipeline is
19
-    Generic (Nb_bits : Natural := 8;
20
-             Instruction_En_Memoire_Size : Natural := 29;
21
-             Addr_Memoire_Instruction_Size : Natural := 3;
22
-             Memoire_Instruction_Size : Natural := 8;
23
-             Instruction_Bus_Size : Natural := 5;
24
-             Nb_Instructions : Natural := 32;
25
-             Nb_Registres : Natural := 16;
26
-             Addr_registres_size : Natural := 4;
27
-             Memoire_Size : Natural := 32;
28
-             Adresse_mem_size : Natural := 5;
29
-             Memoire_Adresses_Retour_Size : Natural := 16;
30
-             Adresse_Memoire_Adresses_Retour_Size : Natural := 4);
24
+    Generic (Nb_bits : Natural := 8;                       -- Taille d'un mot binaire
25
+             Instruction_En_Memoire_Size : Natural := 29;  -- Taille d'une instruction en mémoire (Taille d'un code instruction + 3*Taille d'un mot binaire)
26
+             Addr_Memoire_Instruction_Size : Natural := 3; -- Nombre de bits pour adresser la mémoire d'instruction
27
+             Memoire_Instruction_Size : Natural := 8;      -- Taille de la mémoire d'instruction (nombre d'instructions stockées)
28
+             Instruction_Bus_Size : Natural := 5;          -- Nombre de bits du bus d'instruction (Taille d'un code instruction)
29
+             Nb_Instructions : Natural := 32;              -- Nombre d'instructions dans le processeur
30
+             Nb_Registres : Natural := 16;                 -- Nombre de registres du processeurs
31
+             Addr_registres_size : Natural := 4;           -- Nombre de bits pour adresser les registres
32
+             Memoire_Size : Natural := 32;                 -- Taille de la mémoire de données
33
+             Adresse_mem_size : Natural := 5;              -- Nombre de bits pour adresser la mémoire
34
+             Memoire_Adresses_Retour_Size : Natural := 16; -- Profondeur d'appel maximale
35
+             Adresse_Memoire_Adresses_Retour_Size : Natural := 4); -- log2(Profondeur d'appel maximale)
31 36
     Port (CLK : in STD_LOGIC;
32 37
           RST : in STD_LOGIC;
33 38
           STD_IN      : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); 
@@ -160,6 +149,8 @@ architecture Behavioral of Pipeline is
160 149
                OUT_Instruction : out STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0));
161 150
     end component;
162 151
     
152
+    
153
+    -- Signaux reliant les étages
163 154
     signal A_from_1 : STD_LOGIC_VECTOR (Nb_bits - 1 downto 0) := (others => '0');
164 155
     signal A_from_2 : STD_LOGIC_VECTOR (Nb_bits - 1 downto 0) := (others => '0');
165 156
     signal A_from_3 : STD_LOGIC_VECTOR (Nb_bits - 1 downto 0) := (others => '0');
@@ -188,6 +179,7 @@ architecture Behavioral of Pipeline is
188 179
     signal Instruction_to_3 : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := (others => '0');
189 180
     signal Instruction_to_4 : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := (others => '0');
190 181
     signal Instruction_to_5 : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := (others => '0');
182
+    -- Sorties de l'ALU
191 183
     signal N : STD_LOGIC := '0';
192 184
     signal Z : STD_LOGIC := '0';
193 185
     signal O : STD_LOGIC := '0';
@@ -195,7 +187,7 @@ architecture Behavioral of Pipeline is
195 187
     
196 188
     signal intern_STD_IN_Request : STD_LOGIC := '0';
197 189
     
198
-    
190
+    -- Constantes de contrôle des MUX et LC
199 191
     constant Bits_Controle_MUX_2_A      : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "11110011101111111111111";
200 192
     constant Bits_Controle_MUX_2_B      : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "11111111000011000000001";
201 193
     constant Bits_Controle_LC_3         : STD_LOGIC_VECTOR (Nb_Instructions * 3 - 1 downto 0) := "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "000" & "111" & "110" & "101" & "100" & "010" & "011" & "001" & "000";
@@ -205,6 +197,8 @@ architecture Behavioral of Pipeline is
205 197
     constant Bits_Controle_MUX_4_IN_EBP : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "11111111011001111111111";
206 198
     constant Bits_Controle_MUX_4_OUT    : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00000000001010000000000";
207 199
     constant Bits_Controle_LC_5         : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00010000001011111111110";
200
+
201
+		-- Code de certaines instructions
208 202
     constant Code_Instruction_JMP  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "01111";
209 203
     constant Code_Instruction_JMZ  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "10000";
210 204
     constant Code_Instruction_PRI  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "10001";
@@ -214,6 +208,7 @@ architecture Behavioral of Pipeline is
214 208
     constant Code_Instruction_RET  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "10101";
215 209
     constant Code_Instruction_STOP  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "10110";
216 210
     
211
+		-- Constantes de contrôle des bulles
217 212
     constant Instructions_critiques_lecture_A : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00001100010000000000000";
218 213
     constant Instructions_critiques_lecture_B : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00000000111100111111110";
219 214
     constant Instructions_critiques_lecture_C : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00000000000000011111110";

+ 2
- 0
Processeur.srcs/sources_1/new/Pipeline_NS.vhd View File

@@ -194,6 +194,8 @@ architecture Behavioral of Pipeline_NS is
194 194
     constant Bits_Controle_MUX_4_IN_EBP : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "10011111011001111111111";
195 195
     constant Bits_Controle_MUX_4_OUT    : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00000000001010000000000";
196 196
     constant Bits_Controle_LC_5         : STD_LOGIC_VECTOR (Nb_Instructions - 1 downto 0) := "111111111" & "00010000001011111111110";
197
+
198
+		-- Code de certaines instructions
197 199
     constant Code_Instruction_JMP  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "01111";
198 200
     constant Code_Instruction_JMZ  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "10000";
199 201
     constant Code_Instruction_PRI  : STD_LOGIC_VECTOR (Instruction_Bus_Size - 1 downto 0) := "10001";

+ 39
- 12
Processeur.srcs/sources_1/new/ScreenDriver.vhd View File

@@ -1,21 +1,18 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 09.07.2021 09:54:12
4 6
 -- Module Name: ScreenDriver - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Fait le lien entre le processeur et l'écran 
5 12
 -- 
13
+-- Dependencies: None
14
+--
15
+-- Comments: Gère la conversion des entiers en hexa pour l'affichage
6 16
 ----------------------------------------------------------------------------------
7 17
 
8 18
 
@@ -24,32 +21,31 @@ use IEEE.STD_LOGIC_1164.ALL;
24 21
 use IEEE.STD_LOGIC_UNSIGNED.ALL;
25 22
 use IEEE.NUMERIC_STD.ALL;
26 23
 
27
---use IEEE.NUMERIC_STD.ALL;
28
-
29
---library UNISIM;
30
---use UNISIM.VComponents.all;
31
-
32 24
 entity ScreenDriver is
33 25
     Generic ( Nb_bits : Natural
34 26
             );
35 27
     Port ( CLK : in STD_LOGIC;
36
-           Value : in STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0);
37
-           ValueAv : in STD_LOGIC;
38
-           IsInt : in STD_LOGIC;
39
-           OutData : out STD_LOGIC_VECTOR (0 to 6);
40
-           OutDataAv : out STD_LOGIC);
28
+
29
+           Value : in STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0);   -- ********************************
30
+           ValueAv : in STD_LOGIC;                               -- ***** Depuis le processeur *****
31
+           IsInt : in STD_LOGIC;                                 -- ********************************
32
+
33
+           OutData : out STD_LOGIC_VECTOR (0 to 6);              -- ********************************
34
+           OutDataAv : out STD_LOGIC);                           -- ********* Vers l'écran *********
41 35
 end ScreenDriver;
42 36
 
43 37
 architecture Behavioral of ScreenDriver is
44 38
 
39
+		-- Signal pour récupérer la valeur entière
45 40
     signal intern_value : STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0) := (others => '0');
41
+		-- 4 bits actuellement en cours de conversion
46 42
     signal current_hexa : STD_LOGIC_VECTOR (3 downto 0) := (others => '0');
43
+
44
+		-- Type pour gérer l'avancement dans la conversion
47 45
     subtype compteur_T is Integer range -2 to Nb_bits/4 - 1;
46
+		-- Signal comptant l'avancement dans la conversion (début a -2, affichage de "0x" puis début de la conversion avec compteur = 0)
48 47
     signal compteur : compteur_T := -2;
48
+		-- Si un digit non nul a été detecté
49 49
     signal first_detected : BOOLEAN := false;
50 50
      
51 51
     
@@ -57,46 +53,60 @@ architecture Behavioral of ScreenDriver is
57 53
     
58 54
 
59 55
 begin
60
-
56
+		-- Récupération des 4 bits en cours de conversion
61 57
     current_hexa <= intern_value(Nb_Bits - 1 - compteur * 4 downto Nb_Bits - compteur * 4 - 4) when compteur >= 0 and compteur < Nb_Bits else "0000";
62 58
 
63 59
     process
64 60
     begin
65 61
         wait until CLK'event and CLK = '1';
62
+				
66 63
         if ValueAv = '1' then  
64
+						-- Si on a une donnée en entier 
67 65
             if IsInt = '0' then
66
+								-- Si c'est un char on la répercute juste 
68 67
                 OutData <= Value (6 downto 0);
69 68
             else 
69
+								-- Si c'est un entier, on récupère la valeur et affiche le 0
70 70
                 intern_value <= Value;
71 71
                 OutData <= Code_ASCII_Zero;
72 72
                 compteur <= compteur + 1;
73 73
             end if;
74
+						-- On signal a l'écran qu'il faut afficher
74 75
             OutDataAv <= '1';
75 76
         elsif compteur = -1 then
77
+						-- Si une conversion est en cours a l'étape -1, on affiche x
76 78
             OutData <= "1111000";
77 79
             compteur <= compteur + 1;
78 80
         elsif compteur >= 0 then
81
+						-- Si on est en phase de conversion 
79 82
             if (current_hexa >= "0000" and current_hexa <= "1001") then
83
+								-- Si on est sur un chiffre (0-9)
80 84
                 if (not(current_hexa = "0000") or first_detected or compteur = Nb_bits/4 - 1 ) then
85
+										-- On l'affiche si ce n'est pas 0, ou qu'un digit a déjà été detecté, ou qu'il s'agit du dernier digit de l'entier
81 86
                     OutData <= "011" & current_hexa;
82 87
                     OutDataAv <= '1';
83 88
                     first_detected <= true;
84 89
                 else
90
+										-- Sinon, le digit est un 0 inutile, on ne l'affiche pas
85 91
                     OutDataAv <= '0';
86 92
                 end if;
87 93
             else 
94
+								-- Si on est sur une lettre (A-F), on l'affiche
88 95
                 OutData <= ("000" & current_hexa) + "0110111";
89 96
                 OutDataAv <= '1';
90 97
                 first_detected <= true;
91 98
             end if;
92 99
         
100
+						
93 101
             if (compteur = Nb_bits/4 - 1) then
102
+								-- Si la conversion est finie on réinitialise
94 103
                 compteur <= -2;   
95 104
                 first_detected  <= false;
96 105
             else 
106
+								-- Sinon on avance le compteur
97 107
                 compteur <= compteur + 1;
98 108
             end if;
99
-        else 
109
+        else
100 110
             OutDataAv <= '0';
101 111
         end if;
102 112
     end process;

+ 33
- 20
Processeur.srcs/sources_1/new/ScreenProperties.vhd View File

@@ -1,35 +1,48 @@
1
+----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
4
+-- 
5
+-- Create Date: 02.07.2021 10:07:41
6
+-- Package Name: ScreenProperties
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Rassemble les propriétés de l'écran et du VGA 
12
+----------------------------------------------------------------------------------
13
+
1 14
 library IEEE;
2 15
 use IEEE.STD_LOGIC_1164.ALL;
3 16
 
4 17
 package ScreenProperties is 
5 18
 
6
-    constant margin : Natural := 64;
19
+    constant margin : Natural := 64; -- Marge laissée de tous les cotés de l'écran
7 20
     
8
-    constant Display_CaracterWidht  : Natural := 64;
9
-    constant Display_CaracterHeight : Natural := 64;
21
+    constant Display_CaracterWidht  : Natural := 64; -- Taille d'affichage d'un caractère (en pixels)
22
+    constant Display_CaracterHeight : Natural := 64; -- Taille d'affichage d'un caractère (en pixels)
10 23
 
11
-    constant screen_width   : natural := 1280;
12
-    constant screen_height  : natural := 1024;
24
+    constant screen_width   : natural := 1280; -- Largeur de l'écran (en pixels)
25
+    constant screen_height  : natural := 1024; -- Longueur de l'écran (en pixels)
13 26
     
14
-    constant X_PulseWidth : Natural := 112;
15
-    constant X_FrontPorch : Natural := 48;
16
-    constant X_BackPorch  : Natural := 248;
17
-    constant Y_PulseWidth : Natural := 3;
18
-    constant Y_FrontPorch : Natural := 1;
19
-    constant Y_BackPorch  : Natural := 38;
27
+    constant X_PulseWidth : Natural := 112; -- Taille de la pulsation de synchronisation horizontale (en pixels)
28
+    constant X_FrontPorch : Natural := 48;  -- Taille du temps avant la pulsation (en pixels)
29
+    constant X_BackPorch  : Natural := 248; -- Taille du temps après la pulsation (en pixels)
30
+    constant Y_PulseWidth : Natural := 3;   -- Taille de la pulsation de synchronisation verticale (en lignes)
31
+    constant Y_FrontPorch : Natural := 1;   -- Taille du temps avant la pulsation (en lignes)
32
+    constant Y_BackPorch  : Natural := 38;  -- Taille du temps après la pulsation (en lignes)
20 33
         
21
-    subtype X_T is Natural range 0 to screen_width  + X_PulseWidth + X_FrontPorch + X_BackPorch - 1;
22
-    subtype Y_T is Natural range 0 to screen_height + Y_PulseWidth + Y_FrontPorch + Y_BackPorch - 1;
34
+    subtype X_T is Natural range 0 to screen_width  + X_PulseWidth + X_FrontPorch + X_BackPorch - 1; -- Type pour les coordonnées
35
+    subtype Y_T is Natural range 0 to screen_height + Y_PulseWidth + Y_FrontPorch + Y_BackPorch - 1; -- Type pour les coordonnées
23 36
     
24
-    constant C_Blocks : Natural := (screen_width - (2 * margin))/Display_CaracterWidht;
25
-    constant L_Blocks : Natural := (screen_height - (2 * margin))/Display_CaracterHeight;
26
-    constant Ecran_Taille : Natural := C_Blocks * L_Blocks * 7;
37
+    constant C_Blocks : Natural := (screen_width - (2 * margin))/Display_CaracterWidht;      -- Nombre de cases par ligne dans l'écran (Nombre de colonnes)
38
+    constant L_Blocks : Natural := (screen_height - (2 * margin))/Display_CaracterHeight;    -- Nombre de cases par colonne dans l'écran (Nombre de lignes)
39
+    constant Ecran_Taille : Natural := C_Blocks * L_Blocks * 7;                              -- Nombre de bits dans l'écran (Nombre cases dans l'écran * 7)
27 40
     
28
-    constant L_Size : Natural := C_Blocks * 7;
41
+    constant L_Size : Natural := C_Blocks * 7;                                               -- Taille en bits d'une ligne
29 42
     
30
-    constant Zero_Line : STD_LOGIC_VECTOR (0 to L_Size - 1) := (others => '0');
43
+    constant Zero_Line : STD_LOGIC_VECTOR (0 to L_Size - 1) := (others => '0');              -- Constante, ligne de '0'
31 44
     
32
-    subtype L_T is Natural range 0 to L_Blocks - 1;
33
-    subtype C_T is Natural range 0 to C_Blocks - 1;
45
+    subtype L_T is Natural range 0 to L_Blocks - 1; -- Type pour les coordonnées
46
+    subtype C_T is Natural range 0 to C_Blocks - 1; -- Type pour les coordonnées
34 47
     
35 48
 end package;

+ 11
- 1
Processeur.srcs/sources_1/new/TableASCII.vhd View File

@@ -1,21 +1,18 @@
1
-----------------------------------------------------------------------------------
1
+-----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 28.06.2021 09:20:00
4 6
 -- Module Name: TableASCII - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Table indexée sur le code ascii contenant la font de chaque caractère 
5 12
 -- 
13
+-- Dependencies: None
14
+--
15
+-- Comments : Assynchrone
6 16
 ----------------------------------------------------------------------------------
7 17
 
8 18
 

+ 16
- 1
Processeur.srcs/sources_1/new/VGAControler.vhd View File

@@ -1,21 +1,18 @@
1 1
 ----------------------------------------------------------------------------------
2
+-- Company:  INSA-Toulouse
3
+-- Engineer: Paul Faure
2 4
 -- 
3 5
 -- Create Date: 28.06.2021 09:20:00
4 6
 -- Module Name: VGAControler - Behavioral
7
+-- Project Name: Processeur sécurisé
8
+-- Target Devices: Basys 3 ARTIX7
9
+-- Tool Versions: Vivado 2016.4
10
+--
11
+-- Description: Controleur du VGA
12
+--    - Crée les signaux VGA 
13
+--    - Demande si le pixel (X,Y) doit être allumé 
14
+--
15
+-- Dependencies: Compteur_X et Compteur_Y
5 16
 ----------------------------------------------------------------------------------
6 17
 
7 18
 
@@ -73,8 +70,11 @@ begin
73 70
                  RST => RST,
74 71
                  Value => Y_pos);
75 72
                  
73
+		-- Test si on est dans l'écran et non dans les zones de FP, BP, SP
76 74
     active <= ((X_pos < screen_width) and (Y_pos < screen_height));
77 75
                  
76
+
77
+		-- Affectation des couleurs et fonction du pixel (0 hors champs, gris si inactif, blanc si actif)
78 78
     VGA_RED   <= "0000" when ((RST = '0') or (not active)) else 
79 79
                  "1000" when (PIXEL_ON = '0') else 
80 80
                  "1111";
@@ -84,7 +84,8 @@ begin
84 84
     VGA_GREEN <= "0000" when ((RST = '0') or (not active)) else 
85 85
                  "1000" when (PIXEL_ON = '0') else 
86 86
                  "1111";
87
-        
87
+    
88
+		-- Création des signaux de synchronisation
88 89
     VGA_HS    <= '0' when ((RST = '0') or (X_pos < screen_width  + X_FrontPorch) or (X_pos >= screen_width  + X_FrontPorch + X_PulseWidth)) else 
89 90
                  '1';
90 91
     VGA_VS    <= '0' when ((RST = '0') or (Y_pos < screen_height + Y_FrontPorch) or (Y_pos >= screen_height + Y_FrontPorch + Y_PulseWidth)) else 

Loading…
Cancel
Save