kamilosxd678

[SEM6][ISP]Lab1.vhd

Mar 10th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.42 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    10:41:00 03/03/2015
  6. -- Design Name:
  7. -- Module Name:    top - 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. use IEEE.STD_LOGIC_ARITH.ALL;
  23. use IEEE.STD_LOGIC_SIGNED.ALL;
  24.  
  25. ---- Uncomment the following library declaration if instantiating
  26. ---- any Xilinx primitives in this code.
  27. --library UNISIM;
  28. --use UNISIM.VComponents.all;
  29.  
  30. entity top is
  31.     Port ( pb_i : in  STD_LOGIC;
  32.            sw_i : in  STD_LOGIC_VECTOR (7 downto 0);
  33.               led7_an_o : out STD_LOGIC_VECTOR (3 downto 0);
  34.               led7_seg_o : out STD_LOGIC_VECTOR (7 downto 0);
  35.               led_o : out STD_LOGIC_VECTOR (7 downto 0));
  36. end top;
  37.  
  38. architecture Behavioral of top is
  39.  
  40. signal x : std_logic_vector (3 downto 0);
  41. signal y : std_logic_vector (1 downto 0);
  42. signal is_odd : std_logic;
  43.  
  44. begin
  45. x <= sw_i(7 downto 4) xor sw_i(3 downto 0);
  46. y <= x(3 downto 2) xor x(1 downto 0);
  47. is_odd <= y(1) xor y(0);
  48.  
  49.  
  50. led7_an_o <= "1110";
  51. led7_seg_o <= "01100001" when is_odd = '0' else "00000011";
  52.  
  53. led_o <= "00000000" when pb_i = '1' else "00000000";
  54.  
  55. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment