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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_45.vhd] - Blame information for rev 4

Go to most recent revision | 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 SN7445N: 1-of-10 decoder/driver (open collector)    --
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_45 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '0';
20
    Period   : time           := 120 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_45 is
27
    signal J, B : unsigned(3 downto 0);         -- Test stimuli
28
    signal D, E : std_logic_vector(9 downto 0); -- Expected & actual results
29
 
30
    begin
31
 
32
    -----------------------------------------------------------------------
33
    -- Standard testbench components
34
    -----------------------------------------------------------------------
35
    TB: TTLBench
36
    generic map(
37
        StimClk  => StimClk,
38
        CheckClk => CheckClk,
39
        Period   => Period,
40
        Finish   => Finish,
41
        SevLevel => SevLevel
42
    )
43
    port map(
44
        J   => J,
45
        B   => B,
46
        CLK => open,
47
        RS  => open,
48
        D   => D,
49
        E   => E
50
    );
51
 
52
    -----------------------------------------------------------------------
53
    -- Generate expected results (with zero delays)
54
    -----------------------------------------------------------------------
55
    process(J) is
56
        variable N : natural;
57
    begin
58
        D <= (others => 'Z');       -- Default
59
        N := TTL_to_integer(J(3 downto 0));
60
        if N < 10 then
61
            D(N) <= '0';
62
        end if;
63
    end process;
64
 
65
    -----------------------------------------------------------------------
66
    -- Device Under Test...                        
67
    -----------------------------------------------------------------------
68
    DUT: SN7445N
69
    port map(
70
    X_1  => E(0),  -- Q0\
71
    X_2  => E(1),  -- Q1\
72
    X_3  => E(2),  -- Q2\
73
    X_4  => E(3),  -- Q3\
74
    X_5  => E(4),  -- Q4\
75
    X_6  => E(5),  -- Q5\
76
    X_7  => E(6),  -- Q6\
77
    X_8  => open,  -- GND
78
    X_9  => E(7),  -- Q7\
79
    X_10 => E(8),  -- Q8\
80
    X_11 => E(9),  -- Q9\
81
    X_12 => J(3),  -- A3
82
    X_13 => J(2),  -- A2
83
    X_14 => J(1),  -- A1
84
    X_15 => J(0),  -- A0
85
    X_16 => open   -- Vcc
86
);
87
end architecture Test;

powered by: WebSVN 2.1.0

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