Advertisement
Henry-Galleguillos

RobotHeart.vhd - Testbench

Oct 19th, 2020
3,063
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.48 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3.  
  4. entity RobotHeart is
  5. end RobotHeart;
  6.  
  7. architecture Behavioral of RobotHeart is
  8.  
  9.     component Sensores
  10.          port (R: in std_logic;
  11.                L: in std_logic;                
  12.                D: in std_logic;  
  13.                T: in std_logic;
  14.                L1: in std_logic;
  15.                L2: in std_logic;
  16.                C1: out std_logic;
  17.                C2: out std_logic;
  18.                C3: out std_logic;
  19.                C4: out std_logic);
  20.     end component;
  21.    
  22.          signal Avanza: std_logic;
  23.          signal Retrocede: std_logic;
  24.          signal SAdelante: std_logic;
  25.          signal SAtras: std_logic;
  26.          signal SIzquierda: std_logic;
  27.          signal SDerecha: std_logic;
  28.          signal Caso1: std_logic;
  29.          signal Caso2: std_logic;
  30.          signal Caso3: std_logic;
  31.          signal Caso4: std_logic;
  32.          
  33. begin
  34.      PROBAR: Sensores port map ( R => Avanza,
  35.                                  L => Retrocede,
  36.                                  D => SAdelante,
  37.                                  T => SAtras,
  38.                                  L1 => SIzquierda,
  39.                                  L2 => SDerecha,
  40.                                  C1 => Caso1,
  41.                                  C2 => Caso2,
  42.                                  C3 => Caso3,
  43.                                  C4 => Caso4);
  44.      PRUEBA: process
  45.          begin
  46.          
  47.     -- El robot se mueve hacia adelante
  48.          Avanza <= '1';
  49.          Retrocede <= '0';
  50.     -- y se topa un obstaculo
  51.          SAdelante <= '1';
  52.          wait for 100ns;
  53.          
  54.     -- El robot se mueve hacia atras
  55.          Avanza <= '0';
  56.          Retrocede <= '1';
  57.     -- y se topa un obstaculo
  58.          SAtras <= '1';
  59.          wait for 100ns;
  60.          
  61.     -- Se detecta un obstaculo lateral (en este caso por la izquierda)
  62.          SIzquierda <= '1';
  63.          SDerecha <= '0';
  64.          wait for 100ns;
  65.          
  66.     -- El robot se detiene
  67.          Avanza <= '0';
  68.          Retrocede <= '0';
  69.     -- y detecta obstaculos en multiples direcciones (ademas se agrega uno por la derecha
  70.          SDerecha <= '1';
  71.          wait for 100ns;
  72.          
  73.     -- El robot se detiene
  74.          Avanza <= '0';
  75.          Retrocede <= '0';
  76.     -- Solo sensor derecha
  77.          SAdelante <= '0';
  78.          SAtras <= '0';
  79.          SIzquierda <= '0';
  80.          SDerecha <= '1';
  81.          wait for 100ns;
  82.          
  83.      end process;
  84.  
  85. end Behavioral;
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement