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_Etage2_5_Registres.vhd 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 19.04.2021 14:31:37
  6. -- Design Name:
  7. -- Module Name: Test_Etage2_5_Registres - 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_Etage2_5_Registres is
  30. -- Port ( );
  31. end Test_Etage2_5_Registres;
  32. architecture Behavioral of Test_Etage2_5_Registres is
  33. component Etage2_5_Registres is
  34. Generic ( Nb_bits : Natural;
  35. Nb_registres : Natural;
  36. Instruction_bus_size : Natural;
  37. Bits_Controle_LC_5 : STD_LOGIC_VECTOR;
  38. Bits_Controle_MUX_2 : STD_LOGIC_VECTOR);
  39. Port ( CLK : in STD_LOGIC;
  40. RST : in STD_LOGIC;
  41. IN_2_A : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  42. IN_2_B : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  43. IN_2_C : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  44. IN_2_Instruction : in STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0);
  45. OUT_2_A : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  46. OUT_2_B : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  47. OUT_2_C : out STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  48. OUT_2_Instruction : out STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0);
  49. IN_5_A : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  50. IN_5_B : in STD_LOGIC_VECTOR (Nb_bits - 1 downto 0);
  51. IN_5_Instruction : in STD_LOGIC_VECTOR (Instruction_bus_size - 1 downto 0));
  52. end component;
  53. signal my_CLK : STD_LOGIC := '0';
  54. signal my_RST : STD_LOGIC := '1';
  55. signal my_IN_2_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  56. signal my_IN_2_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  57. signal my_IN_2_C : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  58. signal my_IN_2_Instruction : STD_LOGIC_VECTOR (2 downto 0) := (others => '0');
  59. signal my_OUT_2_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  60. signal my_OUT_2_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  61. signal my_OUT_2_C : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  62. signal my_OUT_2_Instruction : STD_LOGIC_VECTOR (2 downto 0) := (others => '0');
  63. signal my_IN_5_A : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  64. signal my_IN_5_B : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
  65. signal my_IN_5_Instruction : STD_LOGIC_VECTOR (2 downto 0) := (others => '0');
  66. constant Bits_Controle_LC_5 : STD_LOGIC_VECTOR (7 downto 0) := "01111110";
  67. constant Bits_Controle_MUX_2 : STD_LOGIC_VECTOR (7 downto 0) := "01100001";
  68. constant CLK_period : time := 10 ns;
  69. begin
  70. instance : Etage2_5_Registres
  71. generic map( Nb_bits => 8,
  72. Nb_Registres => 16,
  73. Instruction_bus_size => 3,
  74. Bits_Controle_LC_5 => Bits_Controle_LC_5,
  75. Bits_Controle_MUX_2 => Bits_Controle_MUX_2)
  76. port map( CLK => my_CLK,
  77. RST => my_RST,
  78. IN_2_A => my_IN_2_A,
  79. IN_2_B => my_IN_2_B,
  80. IN_2_C => my_IN_2_C,
  81. IN_2_Instruction => my_IN_2_Instruction,
  82. OUT_2_A => my_OUT_2_A,
  83. OUT_2_B => my_OUT_2_B,
  84. OUT_2_C => my_OUT_2_C,
  85. OUT_2_Instruction => my_OUT_2_Instruction,
  86. IN_5_A => my_IN_5_A,
  87. IN_5_B => my_IN_5_B,
  88. IN_5_Instruction => my_IN_5_Instruction);
  89. CLK_process :process
  90. begin
  91. my_CLK <= '1';
  92. wait for CLK_period/2;
  93. my_CLK <= '0';
  94. wait for CLK_period/2;
  95. end process;
  96. process
  97. begin
  98. my_RST <= '0' after 33 ns;
  99. my_IN_2_A <= "01011111" after 0 ns;
  100. my_IN_2_B <= "00000011" after 0 ns, "00000100" after 40 ns;
  101. my_IN_2_C <= "00000001" after 0 ns, "00000000" after 40 ns;
  102. my_IN_2_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;
  103. my_IN_5_A <= "00000010" after 0 ns, "00000000" after 10 ns, "00000011" after 20 ns, "00000010" after 30 ns;
  104. my_IN_5_B <= "11111111" after 0 ns, "11111110" after 10 ns, "11111101" after 20 ns, "11111100" after 30 ns;
  105. my_IN_5_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;
  106. wait;
  107. end process;
  108. end Behavioral;