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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_137.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 SN74LS137N: 1-of-8 decoder/demux. (input latches)   --
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_137 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '0';
20
    Period   : time           := 100 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_137 is
27
    signal J, B, Z : unsigned(5 downto 0);         -- Test stimuli
28
    signal D, E    : std_logic_vector(7 downto 0); -- Expected & actual results
29
 
30
    alias A  is Z(2 downto 0);
31
    alias LE is Z(3);
32
    alias E1 is Z(4);
33
    alias E2 is Z(5);
34
 
35
    begin
36
    Z <= not B;
37
 
38
    -----------------------------------------------------------------------
39
    -- Standard testbench components
40
    -----------------------------------------------------------------------
41
    TB: TTLBench
42
    generic map(
43
        StimClk  => StimClk,
44
        CheckClk => CheckClk,
45
        Period   => Period,
46
        Finish   => Finish,
47
        SevLevel => SevLevel
48
    )
49
    port map(
50
        J   => J,
51
        B   => B,
52
        CLK => open,
53
        RS  => open,
54
        D   => D,
55
        E   => E
56
    );
57
 
58
    -----------------------------------------------------------------------
59
    -- Generate expected results (with zero delays)
60
    -----------------------------------------------------------------------
61
    process(Z) is
62
        variable chn : natural range 7 downto 0;
63
    begin
64
        E <= (others => '1');
65
 
66
        if LE = '0' then
67
            chn := TTL_to_integer(A);
68
        end if;
69
        if (E2 and not E1) = '1' then
70
            E(chn) <= '0';
71
        end if;
72
    end process;
73
 
74
    -----------------------------------------------------------------------
75
    -- Device Under Test...                        
76
    -----------------------------------------------------------------------
77
    DUT: SN74LS137N
78
    port map(
79
    X_1  => A(0),  -- A0
80
    X_2  => A(1),  -- A1
81
    X_3  => A(2),  -- A2
82
    X_4  => LE,    -- LE\
83
    X_5  => E1,    -- E1\
84
    X_6  => E2,    -- E2
85
    X_7  => D(7),  -- O7\
86
    X_8  => open,  -- GND
87
    X_9  => D(6),  -- O6\
88
    X_10 => D(5),  -- O5\
89
    X_11 => D(4),  -- O4\
90
    X_12 => D(3),  -- O3\
91
    X_13 => D(2),  -- O2\
92
    X_14 => D(1),  -- O1\
93
    X_15 => D(0),  -- O0\
94
    X_16 => open   -- Vcc
95
);
96
end architecture Test;

powered by: WebSVN 2.1.0

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