Advertisement
Picko

cv2

Oct 10th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 3.07 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:   16:05:01 10/07/2013
  6. -- Design Name:  
  7. -- Module Name:   C:/Users/TEMP.WIN-XLYL2SP2PLD.014/Desktop/-p/cvikoMoje/dekoder/decodertest.vhd
  8. -- Project Name:  dekoder
  9. -- Target Device:  
  10. -- Tool versions:  
  11. -- Description:  
  12. --
  13. -- VHDL Test Bench Created by ISE for module: dekoder
  14. --
  15. -- Dependencies:
  16. --
  17. -- Revision:
  18. -- Revision 0.01 - File Created
  19. -- Additional Comments:
  20. --
  21. -- Notes:
  22. -- This testbench has been automatically generated using types std_logic and
  23. -- std_logic_vector for the ports of the unit under test.  Xilinx recommends
  24. -- that these types always be used for the top-level I/O of a design in order
  25. -- to guarantee that the testbench will bind correctly to the post-implementation
  26. -- simulation model.
  27. --------------------------------------------------------------------------------
  28. LIBRARY ieee;
  29. USE ieee.std_logic_1164.ALL;
  30.  
  31. -- Uncomment the following library declaration if using
  32. -- arithmetic functions with Signed or Unsigned values
  33. --USE ieee.numeric_std.ALL;
  34.  
  35. ENTITY decodertest IS
  36. END decodertest;
  37.  
  38. ARCHITECTURE behavior OF decodertest IS
  39.  
  40.     -- Component Declaration for the Unit Under Test (UUT)
  41.  
  42.  signal T_I: std_logic_vector(1 downto 0):="00";
  43.   signal T_O: std_logic_vector(3 downto 0);
  44.  
  45.     COMPONENT dekoder
  46.     PORT(
  47.          I : IN  std_logic_vector(1 downto 0);
  48.          O : OUT  std_logic_vector(3 downto 0)
  49.         );
  50.     END COMPONENT;
  51.    
  52.  
  53.    --Inputs
  54.    signal I : std_logic_vector(1 downto 0) := (others => '0');
  55.  
  56.     --Outputs
  57.    signal O : std_logic_vector(3 downto 0);
  58.    -- No clocks detected in port list. Replace <clock> below with
  59.    -- appropriate port name
  60.  
  61.    constant <clock>_period : time := 10 ns;
  62.  
  63. BEGIN
  64.  
  65.     -- Instantiate the Unit Under Test (UUT)
  66.    uut: dekoder PORT MAP (
  67.           T_I,T_O
  68.         );
  69.           process
  70.           variable err_ent : integer :=0;
  71.             begin
  72.                  -- case "00"
  73.                  wait for 10 ns;
  74.                  T_I <= "00";
  75.                  wait for 1 ns;
  76.                  assert (T_0="0001") report "chyba pri 00"
  77.                  severity report;
  78.                  if (T_0/="0001") then err_cnt:=err_cnt + 1;
  79.                  end if;
  80.                  
  81.                  -- case "01"
  82.                  wait for 10 ns;
  83.                  T_I <= "01";
  84.                  wait for 1 ns;
  85.                  assert (T_0="0010") report "chyba pri 01"
  86.                  severity report;
  87.                  if (T_0/="0010") then err_cnt:=err_cnt + 1;
  88.                  end if;
  89.                  
  90.                  -- case "10"
  91.                  wait for 10 ns;
  92.                  T_I <= "10";
  93.                  wait for 1 ns;
  94.                  assert (T_0="0110") report "chyba pri 10"
  95.                  severity report;
  96.                  if (T_0/="0110") then err_cnt:=err_cnt + 1;
  97.                  end if;
  98.                  
  99.                  -- case "11"
  100.                  wait for 10 ns;
  101.                  T_I <= "11";
  102.                  wait for 1 ns;
  103.                  assert (T_0="0000") report "chyba pri 11"
  104.                  severity report;
  105.                  if (T_0/="0000") then err_cnt:=err_cnt + 1;
  106.                  end if;
  107.                  
  108.             if (err_cnt = 0) then
  109.             assert false
  110.             report "vsetko ok"
  111.             severity note;
  112.             else
  113.             assert true;
  114.             report "nejaka chyba"
  115.             severity error;
  116.             end if;
  117.       wait;
  118.    end process;
  119.  
  120. END behavior;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement