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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_156.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 david237
-----------------------------------------------------------------------
2
-- Bipolar TTL models (VHDL)                                         --
3
-- David R Brooks                                                    --
4
-- June, 2016.  Perth, Australia                                     --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS156N: Dual 1-of-4 decoder/demux (o/c)         --
7
-----------------------------------------------------------------------
8
 
9
library ieee;
10
    use ieee.std_logic_1164.all;
11
    use ieee.std_logic_misc.all;
12
    use ieee.numeric_std.all;
13
    use work.LSTTL.all;
14
    use work.TTLPrivate.all;
15
 
16
entity Testbench_156 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           :=  50 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_156 is
27
    signal J, B : unsigned(5 downto 0);         -- Test stimuli
28
    signal D, E : std_logic_vector(7 downto 0); -- Expected & actual results
29
 
30
    begin
31
    -----------------------------------------------------------------------
32
    -- Standard testbench components
33
    -----------------------------------------------------------------------
34
    TB: TTLBench
35
    generic map(
36
        StimClk  => StimClk,
37
        CheckClk => CheckClk,
38
        Period   => Period,
39
        Finish   => Finish,
40
        SevLevel => SevLevel
41
    )
42
    port map(
43
        J   => J,
44
        B   => B,
45
        CLK => open,
46
        RS  => open,
47
        D   => D,
48
        E   => E
49
    );
50
 
51
    -----------------------------------------------------------------------
52
    -- Generate expected results (with zero delays)
53
    -----------------------------------------------------------------------
54
 
55
    process(B) is
56
        variable N      : natural range 3 downto 0;
57
        variable EA, EB : std_logic;
58
        variable X      : std_logic_vector(7 downto 0);
59
    begin
60
        N  := TTL_to_integer(B(5 downto 4));
61
        EA := B(0) and not B(1);
62
        EB := not(B(2) or B(3));
63
 
64
        X := (others => '1');
65
        X(N+4) := not EB;
66
        X(N)   := not EA;
67
 
68
        for i in X'range loop
69
            D(i) <= TTL_OC(X(i));
70
        end loop;
71
    end process;
72
 
73
    -----------------------------------------------------------------------
74
    -- Device Under Test...                        
75
    -----------------------------------------------------------------------
76
    DUT: SN74LS156N
77
    port map(
78
    X_1  => B(0),  -- EA
79
    X_2  => B(1),  -- EA\
80
    X_3  => B(5),  -- A1
81
    X_4  => E(3),  -- O3A\
82
    X_5  => E(2),  -- O2A\
83
    X_6  => E(1),  -- O1A\
84
    X_7  => E(0),  -- O0A\
85
    X_8  => open,  -- GND
86
    X_9  => E(4),  -- O0B\
87
    X_10 => E(5),  -- O1B\
88
    X_11 => E(6),  -- O2B\
89
    X_12 => E(7),  -- O3B\
90
    X_13 => B(4),  -- A0
91
    X_14 => B(3),  -- EB2\
92
    X_15 => B(2),  -- EB1\
93
    X_16 => open   -- Vcc
94
);
95
end architecture Test;

powered by: WebSVN 2.1.0

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