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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_100.vhd] - Blame information for rev 11

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 SN74100N: Dual 4-bit latch                          --
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_100 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '0';
20
    Period   : time           := 150 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_100 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(7 downto 0);   -- Expected & actual results
31
 
32
    subtype quad is std_logic_vector(4 downto 1);
33
    type  biquad is array(2 downto 1) of quad;
34
 
35
    signal R, Q, Z : biquad;
36
    signal G       : std_logic_vector(2 downto 1);
37
 
38
    begin
39
        E <= (Q(2), Q(1));
40
        D <= (Z(2), Z(1));
41
        R <= (quad(BC(7 downto 4)), quad(BC(3 downto 0)));
42
 
43
    process(CLK) is
44
        variable A, B : natural := 0;
45
    begin
46
        if rising_edge(CLK) then
47
            G <= (others => '0');   -- Default
48
            A := A + 1;
49
            B := B + 1;
50
            if (A = 5) then
51
                A := 0;
52
                G(2) <= '1';
53
            end if;
54
            if (B = 7) then
55
                B := 0;
56
                G(1) <= '1';
57
            end if;
58
        elsif falling_edge(CLK) then
59
            G <= (others => '0');
60
        end if;
61
    end process;
62
 
63
    -----------------------------------------------------------------------
64
    -- Standard testbench components
65
    -----------------------------------------------------------------------
66
    TB: TTLBench
67
    generic map(
68
        StimClk  => StimClk,
69
        CheckClk => CheckClk,
70
        Period   => Period,
71
        Finish   => Finish,
72
        SevLevel => SevLevel
73
    )
74
    port map(
75
        J    => JC,
76
        B    => BC,
77
        CLK  => CLK,
78
        RS   => RS,
79
        D    => D,
80
        E    => E
81
    );
82
 
83
    -----------------------------------------------------------------------
84
    -- Generate expected results (with zero delays)
85
    -----------------------------------------------------------------------
86
    process(all) is
87
    begin
88
        for i in G'range loop
89
            if G(i) = '1' then
90
                Z(i) <= R(i);
91
            end if;
92
        end loop;
93
    end process;
94
 
95
    -----------------------------------------------------------------------
96
    -- Device Under Test...                        
97
    -----------------------------------------------------------------------
98
    DUT: SN74100N
99
    port map(
100
                     --
101
    X_2  => R(1)(1), -- 1D1
102
    X_3  => R(1)(2), -- 1D2
103
    X_4  => Q(1)(2), -- 1Q2
104
    X_5  => Q(1)(1), -- 1Q1
105
                     --
106
    X_7  => open,    -- GND
107
    X_8  => Q(2)(1), -- 2Q1
108
    X_9  => Q(2)(2), -- 2Q2
109
    X_10 => R(2)(2), -- 2D2
110
    X_11 => R(2)(1), -- 2D1
111
    X_12 => G(2),    -- 2G
112
                     -- 
113
                     -- 
114
    X_15 => R(2)(3), -- 2D3
115
    X_16 => R(2)(4), -- 2D4
116
    X_17 => Q(2)(4), -- 2Q4
117
    X_18 => Q(2)(3), -- 2Q3
118
    X_19 => Q(1)(3), -- 1Q3
119
    X_20 => Q(1)(4), -- 1Q4
120
    X_21 => R(1)(4), -- 1D4
121
    X_22 => R(1)(3), -- 1D3
122
    X_23 => G(1),    -- 1G
123
    X_24 => open     -- Vcc
124
    );
125
end architecture Test;

powered by: WebSVN 2.1.0

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