No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Test_Etage4_Memoire.vhd 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 19.04.2021 13:37:04
  6. -- Design Name:
  7. -- Module Name: Test_Etage4_Memoire - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. -- Uncomment the following library declaration if using
  23. -- arithmetic functions with Signed or Unsigned values
  24. --use IEEE.NUMERIC_STD.ALL;
  25. -- Uncomment the following library declaration if instantiating
  26. -- any Xilinx leaf cells in this code.
  27. --library UNISIM;
  28. --use UNISIM.VComponents.all;
  29. entity Test_Etage4_Memoire is
  30. -- Port ( );
  31. end Test_Etage4_Memoire;
  32. architecture Behavioral of Test_Etage4_Memoire is
  33. component Etage4_Memoire is
  34. Generic ( Nb_bits : Natural; -- Taille d'un mot binaire
  35. Mem_size : Natural; -- Taille de la mémoire de donnees (nombre de mots binaires stockables)
  36. Adresse_mem_size : Natural; -- Nombre de bits pour adresser la mémoire de donnees
  37. Instruction_bus_size : Natural; -- Nombre de bits du bus d'instruction (Taille d'un code instruction)
  38. Mem_EBP_size : Natural; -- Taille de la mémoire du contexte (profondeur d'appel maximale)
  39. Adresse_size_mem_EBP : Natural; -- Nombre de bits pour adresser la mémoire de contexte
  40. Bits_Controle_LC : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le Link Controler (cf LC.vhd)
  41. Bits_Controle_MUX_IN : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le multiplexer selectionnant A ou B comme adresse (cf MUX.vhd)
  42. 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)
  43. Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR; -- Vecteur de bit controlant le multiplexer de sortie (cf MUX.vhd)
  44. Code_Instruction_CALL : STD_LOGIC_VECTOR; -- Numéro de l'instruction CALL
  45. Code_Instruction_RET : STD_LOGIC_VECTOR); -- Numéro de l'instruction RET
  46. Port ( CLK : in STD_LOGIC; -- Clock
  47. RST : in STD_LOGIC; -- Reset
  48. IN_A : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Entrée de l'opérande A
  49. IN_B : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Entrée de l'opérande B
  50. IN_Instruction : in STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0); -- Entrée de l'instruction
  51. OUT_A : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Sortie de l'opérande A
  52. OUT_B : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0); -- Sortie de l'opérande B
  53. OUT_Instruction : out STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0)); -- Sortie de l'instruction
  54. end component;
  55. signal my_CLK : STD_LOGIC := '0';
  56. signal my_RST : STD_LOGIC := '1';
  57. signal my_IN_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  58. signal my_IN_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  59. signal my_IN_Instruction : STD_LOGIC_VECTOR (4 downto 0) := (others => '0');
  60. signal my_OUT_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  61. signal my_OUT_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  62. signal my_OUT_Instruction : STD_LOGIC_VECTOR (4 downto 0) := (others => '0');
  63. constant Bits_Controle_LC : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "1111111001011111111111";
  64. constant Bits_Controle_MUX_IN : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "1111111110101111111111";
  65. constant Bits_Controle_MUX_IN_EBP : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "1111111011001111111111";
  66. constant Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR (31 downto 0) := "1111111111" & "0000000001010000000000";
  67. constant Code_Instruction_CALL : STD_LOGIC_VECTOR (4 downto 0) := "10011";
  68. constant Code_Instruction_RET : STD_LOGIC_VECTOR (4 downto 0) := "10100";
  69. constant CLK_period : time := 10 ns;
  70. begin
  71. instance : Etage4_Memoire
  72. generic map( Nb_bits => 8,
  73. Mem_size => 16,
  74. Adresse_mem_size => 4,
  75. Instruction_bus_size => 5,
  76. Mem_EBP_size => 8,
  77. Adresse_size_mem_EBP => 3,
  78. Bits_Controle_LC => Bits_Controle_LC,
  79. Bits_Controle_MUX_IN => Bits_Controle_MUX_IN,
  80. Bits_Controle_MUX_IN_EBP => Bits_Controle_MUX_IN_EBP,
  81. Bits_Controle_MUX_OUT => Bits_Controle_MUX_OUT,
  82. Code_Instruction_CALL => Code_Instruction_CALL,
  83. Code_Instruction_RET => Code_Instruction_RET)
  84. port map( CLK => my_CLK,
  85. RST => my_RST,
  86. IN_A => my_IN_A,
  87. IN_B => my_IN_B,
  88. IN_Instruction => my_IN_Instruction,
  89. OUT_A => my_OUT_A,
  90. OUT_B => my_OUT_B,
  91. OUT_Instruction => my_OUT_Instruction,
  92. OUT_AddrRetour => my_OUT_AddrRetour);
  93. CLK_process :process
  94. begin
  95. my_CLK <= '0';
  96. wait for CLK_period/2;
  97. my_CLK <= '1';
  98. wait for CLK_period/2;
  99. end process;
  100. process
  101. begin
  102. my_IN_A <= "00000000" after 0 ns, "00000001" after 4 ns, "00000010" after 14 ns;
  103. my_IN_B <= "00000000" after 0 ns, "00000001" after 4 ns, "00000010" after 14 ns;
  104. my_IN_Instruction <= "00000" after 0 ns, "01011" after 4 ns, "01011" after 14 ns;
  105. my_RST <= '0' after 125 ns;
  106. wait;
  107. end process;
  108. end Behavioral;