OpenCores
URL https://opencores.org/ocsvn/opencpu32/opencpu32/trunk

Subversion Repositories opencpu32

[/] [opencpu32/] [trunk/] [hdl/] [opencpu32/] [testTriStateBuffer.vhd] - Blame information for rev 13

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 leonardoar
--! @file
2
--! @brief Testbench for TriStateBuffer
3
 
4
--! Use standard library and import the packages (std_logic_1164,std_logic_unsigned,std_logic_arith)
5
LIBRARY ieee;
6
use ieee.std_logic_1164.all;
7
use ieee.std_logic_unsigned.all;
8
use ieee.std_logic_arith.all;
9
 
10
--! Use CPU Definitions package
11
use work.pkgOpenCPU32.all;
12
 
13
ENTITY testTriStateBuffer IS
14
END testTriStateBuffer;
15
 
16
--! @brief TriStateBuffer Testbench file
17
--! @details Test TriStateBuffer by enabling/disabling the sel signal
18
ARCHITECTURE behavior OF testTriStateBuffer IS
19
 
20
    -- Component Declaration for the Unit Under Test (UUT)
21
 
22
    COMPONENT TriStateBuffer
23
    generic (n : integer := nBits - 1);                         --! Generic value (Used to easily change the size of the Alu on the package)
24
         PORT(
25
                        A : IN  std_logic_vector(n downto 0);            --! Buffer Input
26
         sel : IN  typeEnDis;                                                           --! Enable or Disable the output
27
         S : OUT  std_logic_vector(n downto 0)           --! Enable or Disable the output
28
        );
29
    END COMPONENT;
30
 
31
 
32
   --Inputs
33
   signal A : std_logic_vector((nBits - 1) downto 0) := (others => '0');
34
   signal sel : typeEnDis := disable;
35
 
36
        --Outputs
37
   signal S : std_logic_vector((nBits - 1) downto 0);
38
 
39
BEGIN
40
        --!Instantiate the Unit Under Test (Multiplexer2_1) (Doxygen bug if it's not commented!)
41
   uut: TriStateBuffer PORT MAP (
42
          A => A,
43
          sel => sel,
44
          S => S
45
        );
46
 
47
   --! Process that will change sel signal and verify the Mux outputs
48
   stim_proc: process
49
   begin
50
      -- Sel disable ---------------------------------------------------------------------------
51
                wait for 1 ps;
52
                REPORT "Test tristate on disable mode" SEVERITY NOTE;
53
                sel <= disable;
54
                A <= conv_std_logic_vector(10, nBits);
55
                wait for 1 ns;  -- Wait to stabilize the response
56
                assert S = ((others => 'Z')) report "Output should be high impedance..." severity FAILURE;
57
 
58
                -- Sel disable ---------------------------------------------------------------------------
59
                wait for 1 ps;
60
                REPORT "Test tristate on enable mode" SEVERITY NOTE;
61
                sel <= enable;
62
                A <= conv_std_logic_vector(10, nBits);
63
                wait for 1 ns;  -- Wait to stabilize the response
64
                assert S = (conv_std_logic_vector(10, nBits)) report "Output should be high impedance..." severity FAILURE;
65
 
66
      wait;
67
   end process;
68
 
69
END;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.