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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_245.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 SN74LS245N: Octal bus transceiver (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_245 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_245 is
27
    signal RS       : std_logic;
28
    signal CLK      : std_logic;
29
    signal JC,  BC  : unsigned(7 downto 0);          -- Test stimuli
30
    signal D,   E   : std_logic_vector(15 downto 0); -- Expected & actual results
31
    signal A2B, ENB : std_logic;
32
    signal IA       : std_logic_vector(7 downto 0);
33
 
34
begin
35
    IA  <= std_logic_vector(JC);
36
 
37
    A2B <= BC(0);
38
    ENB <= BC(1);
39
 
40
    -----------------------------------------------------------------------
41
    -- Standard testbench components
42
    -----------------------------------------------------------------------
43
    TB: TTLBench
44
    generic map(
45
        StimClk  => StimClk,
46
        CheckClk => CheckClk,
47
        Period   => Period,
48
        Finish   => Finish,
49
        SevLevel => SevLevel
50
    )
51
    port map(
52
        J    => JC,
53
        B    => BC,
54
        CLK  => CLK,
55
        RS   => RS,
56
        D    => D,
57
        E    => E
58
    );
59
 
60
    -----------------------------------------------------------------------
61
    -- Generate expected results (with zero delays)
62
    -- Special version for bidirectional circuits
63
    -----------------------------------------------------------------------
64
    GG: process(all) is
65
    begin
66
        for j in IA'range loop
67
            D(j)   <= IA(j) when A2B = '0' else 'Z';
68
            D(j+8) <= IA(j) when A2B = '1' else 'Z';
69
 
70
            E(j)   <= IA(j) when A2B = '0' else 'Z';
71
            E(j+8) <= IA(j) when A2B = '1' else 'Z';
72
        end loop;
73
    end process;
74
 
75
    -----------------------------------------------------------------------
76
    -- Device Under Test...                        
77
    -----------------------------------------------------------------------
78
    DUT: SN74LS245N
79
    port map(
80
        X_1  => A2B,   -- A2B
81
        X_2  => E(0),  -- A0
82
        X_3  => E(1),  -- A1
83
        X_4  => E(2),  -- A2
84
        X_5  => E(3),  -- A3
85
        X_6  => E(4),  -- A4
86
        X_7  => E(5),  -- A5
87
        X_8  => E(6),  -- A6
88
        X_9  => E(7),  -- A7
89
        X_10 => open,  -- GND
90
        X_11 => E(15), -- B7
91
        X_12 => E(14), -- B6
92
        X_13 => E(13), -- B5
93
        X_14 => E(12), -- B4
94
        X_15 => E(11), -- B3
95
        X_16 => E(10), -- B2
96
        X_17 => E(9),  -- B1
97
        X_18 => E(8),  -- B0
98
        X_19 => ENB,   -- E\
99
        X_20 => open   -- Vcc
100
    );
101
end architecture Test;

powered by: WebSVN 2.1.0

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