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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_257.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
-- December, 2016.  Perth, Australia                                 --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS257N: Quad 2-input mux. (3-state outputs)      --
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_257 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_257 is
27
    signal J, B : unsigned(9 downto 0);         -- Test stimuli
28
    signal D, E : std_logic_vector(3 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(B) is
56
    begin
57
        if B(0) = '1' then
58
            D <= (others => 'Z');
59
        elsif B(1) = '0' then
60
            D <= (B(8), B(6), B(4), B(2));
61
        else
62
            D <= (B(9), B(7), B(5), B(3));
63
        end if;
64
    end process;
65
 
66
    -----------------------------------------------------------------------
67
    -- Device Under Test...                        
68
    -----------------------------------------------------------------------
69
    DUT: SN74LS257N
70
    port map(
71
    X_1  => B(1),  -- S
72
    X_2  => B(2),  -- I0A
73
    X_3  => B(3),  -- I1A
74
    X_4  => E(0),  -- ZA
75
    X_5  => B(4),  -- I0B
76
    X_6  => B(5),  -- I1B
77
    X_7  => E(1),  -- ZB
78
    X_8  => open,  -- GND
79
    X_9  => E(3),  -- ZD
80
    X_10 => B(9),  -- I1D
81
    X_11 => B(8),  -- I0D
82
    X_12 => E(2),  -- ZC
83
    X_13 => B(7),  -- I1C
84
    X_14 => B(6),  -- I0C
85
    X_15 => B(0),  -- E\
86
    X_16 => open   -- Vcc
87
);
88
end architecture Test;

powered by: WebSVN 2.1.0

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