Advertisement
Glaas2

compnot1.vhdl

Sep 18th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.18 KB | None | 0 0
  1.  
  2. -----makefile con 160ns
  3. --tb_bin
  4.  
  5. entity tb_bin2gray is
  6. end entity tb_bin2gray;
  7.  
  8. architecture beh of tb_bin2gray is
  9. component bin2gray is
  10.  port(
  11.  x:in bit_vector(3 downto 0);
  12.  f:out bit_vector(3 downto 0)
  13. );
  14. end component bin2gray;
  15. signal bx:bit_vector(3 downto 0):=(others =>'0');
  16. signal lf:bit_vector(3 downto 0):=(others =>'0');
  17. begin
  18. uut:bin2gray
  19.  port map(
  20. x(0)=>bx(0),
  21. x(1)=>bx(1),
  22. x(2)=>bx(2),
  23. x(3)=>bx(3),
  24. f(0)=>lf(0),
  25. f(1)=>lf(1),
  26. f(2)=>lf(2),
  27. f(3)=>lf(3)
  28. );
  29. process
  30. begin
  31.   wait for 10 ns;
  32.   bx(0)<= '1';
  33.   wait for 10 ns;
  34.   bx(0)<= '0';
  35. end process;
  36.  
  37. process
  38. begin
  39.   wait for 20 ns;
  40.   bx(1) <= '1';
  41.   wait for 20 ns;
  42.   bx(1) <= '0';
  43. end process;
  44.  
  45. process
  46. begin
  47.   wait for 40 ns;
  48.   bx(2) <= '1';
  49.   wait for 40 ns;
  50.   bx(2) <= '0';
  51. end process;
  52.  
  53. process
  54. begin
  55.   wait for 80 ns;
  56.   bx(3) <= '1';
  57.   wait for 80 ns;
  58.   bx(3) <= '0';
  59. end process;
  60.  
  61. end architecture beh;
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ----------------------------------------------------------------------------------------------
  71. -----------------------------------------------------------------------------------------------
  72.  
  73.  
  74. --Guerra Esquivel Angel
  75.  
  76. entity compnot1 is
  77.     port(
  78.         x:in bit;
  79.         f:out bit
  80.         );
  81. end entity compnot1;
  82.  
  83. architecture behavioral of compnot1 is
  84. --declaracion de componentes y senales
  85. begin
  86.     f <= not x; --sentencia concurrente
  87. end architecture behavioral;
  88.  
  89. -----------------------------------------------------------------------------------
  90. -----------------------------------------------------------------------------------
  91.  
  92. -- tb_compnot
  93. --Guerra Esquivel Angel
  94.  
  95. entity tb_compnot1 is
  96. end entity tb_compnot1;
  97.  
  98. architecture behavioral of tb_compnot1 is
  99.  
  100. component compnot1 is
  101.     port(
  102.         x:in bit;
  103.         f:out bit
  104.         );
  105. end component compnot1;
  106.  
  107. signal boton:bit:='0';
  108. signal led:bit;
  109.  
  110. --declaracion de componentes y senales
  111. begin
  112.     --instancia
  113.     uut:compnot1
  114.     port map(
  115.         x=>boton,
  116.         f=>led
  117.         );
  118.  
  119.     process
  120.     begin
  121.         wait for 10 ns;
  122.         boton <= '1';
  123.         wait for 10 ns;
  124.         boton <= '0';
  125.     end process;
  126.        
  127. end architecture behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement