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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_182.vhd] - Blame information for rev 10

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
-- July, 2016.  Perth, Australia                                     --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS182N: Fast carry unit for 4 x LS181           --
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_182 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           := 50 ns;
21
    Finish   : time           := 30 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_182 is
27
    signal JC, BC : unsigned(8 downto 0);           -- Test stimuli
28
    signal D, E   : std_logic_vector(4 downto 0);   -- Expected & actual results
29
 
30
    alias Cn is JC(0);
31
    alias G0 is JC(1);
32
    alias G1 is JC(2);
33
    alias G2 is JC(3);
34
    alias G3 is JC(4);
35
    alias P0 is JC(5);
36
    alias P1 is JC(6);
37
    alias P2 is JC(7);
38
    alias P3 is JC(8);
39
 
40
    begin
41
 
42
    -----------------------------------------------------------------------
43
    -- Standard testbench components
44
    -----------------------------------------------------------------------
45
    TB: TTLBench
46
    generic map(
47
        StimClk  => StimClk,
48
        CheckClk => CheckClk,
49
        Period   => Period,
50
        Finish   => Finish,
51
        SevLevel => SevLevel
52
    )
53
    port map(
54
        J    => JC,
55
        B    => BC,
56
        CLK  => open,
57
        RS   => open,
58
        D    => D,
59
        E    => E
60
    );
61
 
62
    -----------------------------------------------------------------------
63
    -- Generate expected results (with zero delays)
64
    -----------------------------------------------------------------------
65
    process(all) is
66
        variable L1  : std_logic;
67
        variable L2  : std_logic;
68
        variable L3  : std_logic;
69
        variable L4  : std_logic;
70
        variable L5  : std_logic;
71
        variable L6  : std_logic;
72
        variable L7  : std_logic;
73
        variable L8  : std_logic;
74
        variable L9  : std_logic;
75
        variable L10 : std_logic;
76
        variable L11 : std_logic;
77
        variable L12 : std_logic;
78
        variable L13 : std_logic;
79
        variable N1  : std_logic;
80
    begin
81
        N1   := NOT ( CN );
82
        L1   := ( G3 AND G2 AND G1 AND G0 );
83
        L2   := ( P1 AND G3 AND G2 AND G1 );
84
        L3   := ( P2 AND G3 AND G2 );
85
        L4   := ( P3 AND G3 );
86
        L5   := ( G2 AND G1 AND G0 AND N1 );
87
        L6   := ( P0 AND G2 AND G1 AND G0 );
88
        L7   := ( P1 AND G2 AND G1 );
89
        L8   := ( P2 AND G2 );
90
        L9   := ( G1 AND G0 AND N1 );
91
        L10  := ( P0 AND G1 AND G0 );
92
        L11  := ( P1 AND G1 );
93
        L12  := ( G0 AND N1 );
94
        L13  := ( P0 AND G0 );
95
        D(4) <= ( P3 OR P2 OR P1 OR P0 );
96
        D(3) <= ( L1 OR L2 OR L3 OR L4 );
97
        D(2) <= NOT ( L5 OR L6 OR L7 OR L8 );
98
        D(1) <= NOT ( L9 OR L10 OR L11 );
99
        D(0) <= NOT ( L12 OR L13 );
100
    end process;
101
 
102
    -----------------------------------------------------------------------
103
    -- Device Under Test...                        
104
    -----------------------------------------------------------------------
105
    DUT: SN74LS182N
106
    port map(
107
        X_1  => G1,   -- G1
108
        X_2  => P1,   -- P1
109
        X_3  => G0,   -- G0
110
        X_4  => P0,   -- P0
111
        X_5  => G3,   -- G3
112
        X_6  => P3,   -- P3
113
        X_7  => E(4), -- P
114
        X_8  => open, -- GND
115
        X_9  => E(2), -- Cnz
116
        X_10 => E(3), -- G
117
        X_11 => E(1), -- Cny
118
        X_12 => E(0), -- Cnx
119
        X_13 => Cn,   -- Cn
120
        X_14 => G2,   -- G2
121
        X_15 => P2,   -- P2
122
        X_16 => open  -- Vcc
123
    );
124
end architecture Test;

powered by: WebSVN 2.1.0

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