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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_139.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 SN74LS139N: Dual 1-of-4 decoder                     --
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_139 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_139 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
    signal RS      : std_logic;
30
 
31
    begin
32
    Z <= (not B) when RS = '1' else (others => '1');     -- Should start with enables high
33
 
34
    -----------------------------------------------------------------------
35
    -- Standard testbench components
36
    -----------------------------------------------------------------------
37
    TB: TTLBench
38
    generic map(
39
        StimClk  => StimClk,
40
        CheckClk => CheckClk,
41
        Period   => Period,
42
        Finish   => Finish,
43
        SevLevel => SevLevel
44
    )
45
    port map(
46
        J   => J,
47
        B   => B,
48
        CLK => open,
49
        RS  => RS,
50
        D   => D,
51
        E   => E
52
    );
53
 
54
    -----------------------------------------------------------------------
55
    -- Generate expected results (with zero delays)
56
    -----------------------------------------------------------------------
57
 
58
    process(Z) is
59
        variable N : natural range 3 downto 0;
60
    begin
61
        D <= (others => '1');
62
 
63
        if Z(0) = '0' then      -- EA
64
            N := TTL_to_integer(Z(5 downto 4));
65
            D(N) <= '0';
66
        end if;
67
 
68
        if Z(1) = '0' then      -- EB
69
            N := TTL_to_integer(Z(3 downto 2));
70
            D(4+N) <= '0';
71
        end if;
72
    end process;
73
 
74
    -----------------------------------------------------------------------
75
    -- Device Under Test...                        
76
    -----------------------------------------------------------------------
77
    DUT: SN74LS139N
78
    port map(
79
    X_1  => Z(0),  -- EA\
80
    X_2  => Z(4),  -- A0A
81
    X_3  => Z(5),  -- A1A
82
    X_4  => E(0),  -- O0A\
83
    X_5  => E(1),  -- O1A\
84
    X_6  => E(2),  -- O2A\
85
    X_7  => E(3),  -- O3A\
86
    X_8  => open,  -- GND
87
    X_9  => E(7),  -- O3B\
88
    X_10 => E(6),  -- O2B\
89
    X_11 => E(5),  -- O1B\
90
    X_12 => E(4),  -- O0B\
91
    X_13 => Z(3),  -- A1B
92
    X_14 => Z(2),  -- A0B
93
    X_15 => Z(1),  -- EB\
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.