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.

Etage4_Memoire.vhd 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 18.04.2021 21:19:41
  6. -- Design Name:
  7. -- Module Name: 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 Etage4_Memoire is
  30. Generic ( Nb_bits : Natural;
  31. Mem_size : Natural;
  32. Instruction_bus_size : Natural;
  33. Bits_Controle_LC : STD_LOGIC_VECTOR;
  34. Bits_Controle_MUX_IN : STD_LOGIC_VECTOR;
  35. Bits_Controle_MUX_OUT : STD_LOGIC_VECTOR);
  36. Port ( CLK : in STD_LOGIC;
  37. RST : in STD_LOGIC;
  38. IN_A : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  39. IN_B : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  40. IN_Instruction : in STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0);
  41. OUT_A : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  42. OUT_B : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  43. OUT_Instruction : out STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0));
  44. end Etage4_Memoire;
  45. architecture Structural of Etage4_Memoire is
  46. component MemoireDonnees is
  47. Generic (Nb_bits : Natural;
  48. Addr_size : Natural;
  49. Mem_size : Natural);
  50. Port ( Addr : in STD_LOGIC_VECTOR (Addr_size-1 downto 0);
  51. RW : in STD_LOGIC;
  52. D_IN : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0);
  53. RST : in STD_LOGIC;
  54. CLK : in STD_LOGIC;
  55. D_OUT : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0) := (others => '0'));
  56. end component;
  57. component LC is
  58. Generic (Instruction_Vector_Size : Natural;
  59. Command_size : Natural;
  60. Bits_Controle : STD_LOGIC_VECTOR);
  61. Port ( Instruction : in STD_LOGIC_VECTOR (Instruction_Vector_Size - 1 downto 0);
  62. Commande : out STD_LOGIC_VECTOR (Command_size - 1 downto 0));
  63. end component;
  64. component MUX is
  65. Generic (Nb_bits : Natural;
  66. Instruction_Vector_Size : Natural;
  67. Bits_Controle : STD_LOGIC_VECTOR);
  68. Port ( Instruction : in STD_LOGIC_VECTOR (Instruction_Vector_Size - 1 downto 0);
  69. IN1 : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  70. IN2 : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  71. OUTPUT : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0));
  72. end component;
  73. signal Addr_MemoireDonnees : STD_LOGIC_VECTOR (Nb_bits - 1 downto 0) := (others => '0');
  74. signal Commande_MemoireDonnees : STD_LOGIC_VECTOR (0 downto 0) := "0";
  75. signal Sortie_MemoireDonnees : STD_LOGIC_VECTOR (Nb_bits - 1 downto 0) := (others => '0');
  76. signal intern_OUT_B : STD_LOGIC_VECTOR (Nb_bits - 1 downto 0) := (others => '0');
  77. begin
  78. instance_LC : LC
  79. generic map (Instruction_Vector_Size => Instruction_bus_size,
  80. Command_size => 1,
  81. Bits_Controle => Bits_Controle_LC)
  82. port map ( Instruction => IN_Instruction,
  83. Commande => Commande_MemoireDonnees);
  84. instance_MUX_IN : MUX
  85. generic map (Nb_bits => Nb_bits,
  86. Instruction_Vector_Size => Instruction_bus_size,
  87. Bits_Controle => Bits_Controle_MUX_IN)
  88. port map ( Instruction => IN_Instruction,
  89. IN1 => IN_A,
  90. IN2 => IN_B,
  91. OUTPUT => Addr_MemoireDonnees);
  92. instance_MUX_OUT : MUX
  93. generic map (Nb_bits => Nb_bits,
  94. Instruction_Vector_Size => Instruction_bus_size,
  95. Bits_Controle => Bits_Controle_MUX_OUT)
  96. port map ( Instruction => IN_Instruction,
  97. IN1 => Sortie_MemoireDonnees,
  98. IN2 => IN_B,
  99. OUTPUT => intern_OUT_B);
  100. instance_MemoireDonnees : MemoireDonnees
  101. generic map (Nb_bits => Nb_bits,
  102. Addr_size => Nb_bits,
  103. Mem_size => Mem_size)
  104. port map ( Addr => Addr_MemoireDonnees,
  105. RW => Commande_MemoireDonnees(0),
  106. D_IN => IN_B,
  107. RST => RST,
  108. CLK => CLK,
  109. D_OUT => Sortie_MemoireDonnees);
  110. OUT_A <= (others => '0') when RST = '0' else
  111. IN_A;
  112. OUT_B <= (others => '0') when RST = '0' else
  113. intern_OUT_B;
  114. OUT_Instruction <= (others => '0') when RST = '0' else
  115. IN_Instruction;
  116. end Structural;