diff --git a/Processeur.srcs/sim_1/new/Test_Etage4_Memoire.vhd b/Processeur.srcs/sim_1/new/Test_Etage4_Memoire.vhd
index b9afea5..4a80863 100644
--- a/Processeur.srcs/sim_1/new/Test_Etage4_Memoire.vhd
+++ b/Processeur.srcs/sim_1/new/Test_Etage4_Memoire.vhd
@@ -37,34 +37,44 @@ end Test_Etage4_Memoire;
architecture Behavioral of Test_Etage4_Memoire is
component Etage4_Memoire is
- Generic ( Nb_bits : Natural;
- Mem_size : Natural;
- Instruction_bus_size : Natural;
- Bits_Controle_LC : STD_LOGIC_VECTOR;
- Bits_Controle_MUX_IN : STD_LOGIC_VECTOR;
- Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR);
- Port ( CLK : in STD_LOGIC;
- RST : in STD_LOGIC;
- IN_A : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
- IN_B : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
- IN_Instruction : in STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0);
- OUT_A : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
- OUT_B : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
- OUT_Instruction : out STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0));
+ Generic ( Nb_bits : Natural; -- Taille d'un mot binaire
+ Mem_size : Natural; -- Taille de la mémoire de donnees (nombre de mots binaires stockables)
+ Adresse_mem_size : Natural; -- Nombre de bits pour adresser la mémoire de donnees
+ Instruction_bus_size : Natural; -- Nombre de bits du bus d'instruction (Taille d'un code instruction)
+ Mem_EBP_size : Natural; -- Taille de la mémoire du contexte (profondeur d'appel maximale)
+ Adresse_size_mem_EBP : Natural; -- Nombre de bits pour adresser la mémoire de contexte
+ Bits_Controle_LC : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le Link Controler (cf LC.vhd)
+ Bits_Controle_MUX_IN : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le multiplexer selectionnant A ou B comme adresse (cf MUX.vhd)
+ Bits_Controle_MUX_IN_EBP : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le multiplexer selectionnant si on doit ajouter ou non EBP à l'adresse (cf MUX.vhd)
+ Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le multiplexer de sortie (cf MUX.vhd)
+ Code_Instruction_CALL : STD_LOGIC_VECTOR; -- Numéro de l'instruction CALL
+ Code_Instruction_RET : STD_LOGIC_VECTOR); -- Numéro de l'instruction RET
+ Port ( CLK : in STD_LOGIC; -- Clock
+ RST : in STD_LOGIC; -- Reset
+ IN_A : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Entrée de l'opérande A
+ IN_B : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Entrée de l'opérande B
+ IN_Instruction : in STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0); -- Entrée de l'instruction
+ OUT_A : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Sortie de l'opérande A
+ OUT_B : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Sortie de l'opérande B
+ OUT_Instruction : out STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0)); -- Sortie de l'instruction
end component;
signal my_CLK : STD_LOGIC := '0';
signal my_RST : STD_LOGIC := '1';
signal my_IN_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
signal my_IN_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
- signal my_IN_Instruction : STD_LOGIC_VECTOR (2 downto 0) := (others => '0');
+ signal my_IN_Instruction : STD_LOGIC_VECTOR (4 downto 0) := (others => '0');
signal my_OUT_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
signal my_OUT_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
- signal my_OUT_Instruction : STD_LOGIC_VECTOR (2 downto 0) := (others => '0');
+ signal my_OUT_Instruction : STD_LOGIC_VECTOR (4 downto 0) := (others => '0');
- constant Bits_Controle_LC : STD_LOGIC_VECTOR (7 downto 0) := "01111111";
- constant Bits_Controle_MUX_IN : STD_LOGIC_VECTOR (7 downto 0) := "10111111";
- constant Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR (7 downto 0) := "01000000";
+ constant Bits_Controle_LC : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "1111111001011111111111";
+ constant Bits_Controle_MUX_IN : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "1111111110101111111111";
+ constant Bits_Controle_MUX_IN_EBP : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "1111111011001111111111";
+ constant Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "0000000001010000000000";
+
+ constant Code_Instruction_CALL : STD_LOGIC_VECTOR (4 downto 0) := "10011";
+ constant Code_Instruction_RET : STD_LOGIC_VECTOR (4 downto 0) := "10100";
constant CLK_period : time := 10 ns;
@@ -72,11 +82,17 @@ begin
instance : Etage4_Memoire
generic map( Nb_bits => 8,
- Mem_size => 256,
- Instruction_bus_size => 3,
+ Mem_size => 16,
+ Adresse_mem_size => 4,
+ Instruction_bus_size => 5,
+ Mem_EBP_size => 8,
+ Adresse_size_mem_EBP => 3,
Bits_Controle_LC => Bits_Controle_LC,
Bits_Controle_MUX_IN => Bits_Controle_MUX_IN,
- Bits_Controle_MUX_OUT => Bits_Controle_MUX_OUT)
+ Bits_Controle_MUX_IN_EBP => Bits_Controle_MUX_IN_EBP,
+ Bits_Controle_MUX_OUT => Bits_Controle_MUX_OUT,
+ Code_Instruction_CALL => Code_Instruction_CALL,
+ Code_Instruction_RET => Code_Instruction_RET)
port map( CLK => my_CLK,
RST => my_RST,
IN_A => my_IN_A,
@@ -96,9 +112,9 @@ begin
process
begin
- my_IN_A <= "01011111" after 0 ns, "11111111" after 124 ns;
- my_IN_B <= "10100110" after 0 ns, "01011111" after 124 ns;
- my_IN_Instruction <= "000" after 0 ns, "001" after 10 ns, "010" after 20 ns, "011" after 30 ns, "100" after 40 ns, "101" after 50 ns, "110" after 60 ns, "111" after 70 ns, "000" after 80 ns, "110" after 100 ns, "111" after 110 ns, "110" after 120 ns;
+ my_IN_A <= "00000000" after 0 ns, "00000001" after 4 ns, "00000010" after 14 ns;
+ my_IN_B <= "00000000" after 0 ns, "00000001" after 4 ns, "00000010" after 14 ns;
+ my_IN_Instruction <= "00000" after 0 ns, "01011" after 4 ns, "01011" after 14 ns;
my_RST <= '0' after 125 ns;
wait;
end process;
diff --git a/Processeur.srcs/sources_1/new/MemoireInstructions.vhd b/Processeur.srcs/sources_1/new/MemoireInstructions.vhd
index 43743d5..881477e 100644
--- a/Processeur.srcs/sources_1/new/MemoireInstructions.vhd
+++ b/Processeur.srcs/sources_1/new/MemoireInstructions.vhd
@@ -32,7 +32,7 @@ end MemoireInstructions;
architecture Behavioral of MemoireInstructions is
-- Do not touch until (-- Skadoosh)
-- Do not add any Skadoosh
- signal MEMORY : STD_LOGIC_VECTOR ((Mem_Size * Nb_bits)-1 downto 0) := "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000010001000000000000000000000000000110000000000000000000000010100100000001000000010000000001001000000000000000000000000";
+ signal MEMORY : STD_LOGIC_VECTOR ((Mem_Size * Nb_bits)-1 downto 0) := "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101010000000000000000000000001000100000000000000000000000001010000000000000101000000000100110001110000001010000000000101100001011000000000000000001001000000000000101000000000011100000101000000011000000000100100000011000000000000000010101000000110000000000000000011110111001100000000000000000100000000010000000100000000000001000000100000001000000000010010000000000000001000000000100000000010000000100000000010101000000010000000000000000100010000001000000000000000000100100000010010101010000000010101000000010000000000000000100010000001000000000000000000100100000010101010100000000010000100000010000000000000000000110000001100000011000000100100100000011000000000000000000101000000100000001000000000010010000000000000101000000000100000000010000000100000000001000000000100000001000000000010010000001000000000000000000111101010110000000000000000001000000000100000001000000000000010000001000000010000000000100100000000000000010000000001000000000100000001000000000010100000001000001010000000000110100000000000000010000000001010000000010000110000000000010100000000000001011000000001001100000001000011000000000001011000011010000001100000000010110000110000000010000000000101100001011000000010000000001011000010100000000000000000000010000001000000001000000100101000000001000010110000000000010000000100000001100000010010010000001100000001000000000100000000010000000000000000001110000010110000001100000000010010000001100000000000000001000001101110000000000000000000011000000110000001100000001010010000001100000000000000000010100000001000000010000001001001000000100000101000000000010000000000100000000000000000100100000000000000000000000010100000000000000000000000000010110000010000000010000000000101100000011000000110000000001011000000100000000000000000010110000000000000001000000000100000000001000000100000000001011000001010000000100000000010000000001000000011000000000111100100011000000000000000001000000000000000001000000000000010000001000000010000000010100100000001000000010000000001000000000100000000000000000010100000000000000010000000000101100000111000000000000000001111010000110000000000000000010000000001100000001000000000110000000001000000010000000000001000000010000001000000001010100000001000000110000000000101100000100000000100000000000010000000010000000000000001010010000000000000001000000000111000000110000000000000000001001000000000000000000000000010000000000100000011000000000101000000011000000100000000010000010000110000000000000000000110000001100000011000000100100100000011000000000000000001011000001100000001100000000001100000001000000010000000010100000000001000000000000000001010000000000000001100000000011000000001000000010000000000000100000010000000010000001001010000000010000010100000000000100000001000000011000000100100100000011000000010000000001110000001010000001100000000010010000001100000000000000000100000000010000000000000000001010000000000000001000000000100000100101000000000000000000001100000000000000000000001001001000000000000000000000000010110000001000000000000000000010100000010000000100000000101000000000010000001100000000010110000001100000001000000000101000000011000000010000000001000000000100000000000000000010010000000100000000000000000100100000000000000000000000010100000000000000000000000000010110000001000000010000000000101100000001000000010000000001011000000000000000000000000010000000000000000001000000000100000000001000000000000000001000000000000000000100000000100100000000100000000000000001010100001111000000000000000001111000001010000000000000000010000000000000000001000000000000100000001000000010000001001001000000100000000100000000010000000000100000000000000001010100000001000000000000000010001000000010000000000000000010010000000111111111000000001010100000001000000000000000010001000000010000000000000000010010000000100000000000000001000000010011000000000000000000011000000110000001100000001010010000001100000000000000000010100000001000000010000001001001000000100000010100000000010000000000100000000000000000100100000000000000000000000001111010100100000000000000000";
-- Skadoosh
begin
D_OUT <= MEMORY (((to_integer(unsigned(Addr)) + 1) * Nb_bits) - 1 downto Nb_bits * to_integer(unsigned(Addr)));
diff --git a/Processeur.xpr b/Processeur.xpr
index 98f1206..14a8def 100644
--- a/Processeur.xpr
+++ b/Processeur.xpr
@@ -32,7 +32,7 @@
-
+
@@ -233,9 +233,14 @@
+
+
+
+
+
-
+
@@ -243,6 +248,7 @@
+
diff --git a/SimulationsConfig/Test_Etage4_Memoire_behav.wcfg b/SimulationsConfig/Test_Etage4_Memoire_behav.wcfg
new file mode 100644
index 0000000..05f5248
--- /dev/null
+++ b/SimulationsConfig/Test_Etage4_Memoire_behav.wcfg
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ my_CLK
+ my_CLK
+
+
+ my_RST
+ my_RST
+
+
+ my_IN_A[7:0]
+ my_IN_A[7:0]
+
+
+ my_IN_B[7:0]
+ my_IN_B[7:0]
+
+
+ my_IN_Instruction[4:0]
+ my_IN_Instruction[4:0]
+
+
+ my_OUT_A[7:0]
+ my_OUT_A[7:0]
+
+
+ my_OUT_B[7:0]
+ my_OUT_B[7:0]
+
+
+ my_OUT_Instruction[4:0]
+ my_OUT_Instruction[4:0]
+
+
+ Addr[3:0]
+ Addr[3:0]
+
+
+ D_IN[7:0]
+ D_IN[7:0]
+
+
+ RW
+ RW
+
+
+ MEMORY[127:0]
+ MEMORY[127:0]
+ HEXRADIX
+
+
+ Addr_MemoireDonnees[3:0]
+ Addr_MemoireDonnees[3:0]
+
+
+ IN_Addr_MemoireDonnees[3:0]
+ IN_Addr_MemoireDonnees[3:0]
+
+
+ Addr_MemoireDonnees_EBP[3:0]
+ Addr_MemoireDonnees_EBP[3:0]
+
+
+ Addr[3:0]
+ Addr[3:0]
+
+
+ RW
+ RW
+
+
+ D_IN[7:0]
+ D_IN[7:0]
+
+
+ RST
+ RST
+
+
+ CLK
+ CLK
+
+
+ D_OUT[7:0]
+ D_OUT[7:0]
+
+
+ MEMORY[127:0]
+ MEMORY[127:0]
+
+
+ Nb_bits
+ Nb_bits
+
+
+ Addr_size
+ Addr_size
+
+
+ Mem_size
+ Mem_size
+
+