Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.27 KB | None | 0 0
  1. -- Code your testbench here
  2. library IEEE;
  3. use IEEE.std_logic_1164.all;
  4.  
  5. -- Declaration de l'entité. Module de test aucune E/S
  6.  entity TestModule2 is
  7.  -- Port ( );
  8.  end TestModule2;
  9.  
  10.  architecture Behavioral of TestModule2 is
  11.  --declaration des variables utilisées et des sous-modules
  12.  component Module2
  13. Port ( a : in STD_LOGIC;
  14.  b : in STD_LOGIC;
  15.  c : in STD_LOGIC;
  16.  d : out STD_LOGIC;
  17.  e : out STD_LOGIC
  18. );
  19.  end component;
  20.  
  21.   signal A : STD_LOGIC :='0';
  22.   signal B : STD_LOGIC :='0';
  23.   signal C : STD_LOGIC :='0';
  24.   signal D : STD_LOGIC;
  25.   signal E : STD_LOGIC;
  26.  -- declaration d'une constante de temps
  27.  constant period:time :=10 ns;
  28.  
  29.  begin
  30.  -- process de generation de toute les cas possible de l'entrée.
  31.  genereSel: process
  32.  begin
  33.  a <='0';
  34.  b <='0';
  35.  c <='0';
  36.  wait for period;
  37.  a <='0';
  38.  b <='0';
  39.  c <='1';
  40.  wait for period;
  41.  a <='0';
  42.  b <='1';
  43.  c <='0';
  44.  wait for period;
  45.  a <='0';
  46.  b <='1';
  47.  c <='1';
  48.  wait for period;
  49.  a <='1';
  50.  b <='0';
  51.  c <='0';
  52.  wait for period;
  53.  a <='1';
  54.  b <='0';
  55.  c <='1';
  56.  wait for period;
  57.  a <='1';
  58.  b <='1';
  59.  c <='0';
  60.  wait for period;
  61.  a <='1';
  62.  b <='1';
  63.  c <='1';
  64.  wait; -- will wait for ever
  65.  end process;
  66.  
  67.  -- process Module1
  68.  Affiche : Module2 PORT MAP(
  69. a,b,c,d,e
  70.  );
  71.  end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement