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.

ALU_test.vhd 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE ieee.numeric_std.ALL;
  4. ENTITY ALU_test IS
  5. END ALU_test;
  6. ARCHITECTURE behavior OF ALU_test IS
  7. -- Component Declaration for the Unit Under Test (UUT)
  8. COMPONENT ALU
  9. PORT(
  10. A : IN std_logic_vector(7 downto 0);
  11. B : IN std_logic_vector(7 downto 0);
  12. S : OUT std_logic_vector(7 downto 0);
  13. O : OUT std_logic;
  14. Z : OUT std_logic;
  15. C : OUT std_logic;
  16. Ctrl : IN std_logic_vector(1 downto 0)
  17. );
  18. END COMPONENT;
  19. --Inputs
  20. signal A : std_logic_vector(7 downto 0) := (others => '0');
  21. signal B : std_logic_vector(7 downto 0) := (others => '0');
  22. signal Ctrl : std_logic_vector(1 downto 0) := (others => '0');
  23. --Outputs
  24. signal S : std_logic_vector(7 downto 0);
  25. signal O : std_logic;
  26. signal Z : std_logic;
  27. signal C : std_logic;
  28. BEGIN
  29. -- Instantiate the Unit Under Test (UUT)
  30. uut: ALU PORT MAP (
  31. A => A,
  32. B => B,
  33. S => S,
  34. O => O,
  35. Z => Z,
  36. C => C,
  37. Ctrl => Ctrl
  38. );
  39. -- Stimulus process
  40. stim_proc: process
  41. begin
  42. A <=
  43. "00000001",
  44. "11111000" after 1 ms,
  45. "00000010" after 2 ms,
  46. "11001100" after 3 ms,
  47. "00000011" after 4 ms,
  48. "00000001" after 5 ms;
  49. B <=
  50. "00000011",
  51. "10000000" after 1 ms,
  52. "00000011" after 2 ms,
  53. "01100101" after 3 ms,
  54. "00000001" after 4 ms,
  55. "00000011" after 5 ms;
  56. Ctrl <=
  57. "01",
  58. "11" after 2 ms,
  59. "10" after 4 ms,
  60. "00" after 6 ms,
  61. "00" after 7 ms;
  62. wait;
  63. end process;
  64. END;