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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_69.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 SN74LS69N: Dual 4-bit binary counter                --
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_69 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      :=  '0';
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_69 is
27
    signal RS, C0 : std_logic;
28
    signal CLK    : std_logic;
29
    signal J,  B  : unsigned(1 downto 0);           -- Test stimuli
30
    signal D,  E  : std_logic_vector(7 downto 0);   -- Expected & actual results
31
 
32
    begin
33
    -----------------------------------------------------------------------
34
    -- Standard testbench components
35
    -----------------------------------------------------------------------
36
    TB: TTLBench
37
    generic map(
38
        StimClk  => StimClk,
39
        CheckClk => CheckClk,
40
        Period   => Period,
41
        Finish   => Finish,
42
        SevLevel => SevLevel
43
    )
44
    port map(
45
        J   => J,
46
        B   => B,
47
        CLK => CLK,
48
        RS  => RS,
49
        D   => D,
50
        E   => E
51
    );
52
 
53
    -----------------------------------------------------------------------
54
    -- Generate expected results (with zero delays)
55
    -----------------------------------------------------------------------
56
 
57
    -- Low bits: the 2+8 counter
58
    process(B, RS) is
59
        variable Q0 : std_logic;
60
    begin
61
        if    RS = '0' then
62
            Q0 := '0';
63
        elsif falling_edge(B(0)) then
64
            Q0 := not Q0;
65
        end if;
66
        D(0) <= Q0;
67
    end process;
68
 
69
    process(D, RS) is
70
        variable Q31 : unsigned(2 downto 0);
71
    begin
72
        if    RS = '0' then
73
            Q31 := (others => '0');
74
        elsif falling_edge(D(0)) then
75
            Q31 := Q31 + 1;
76
        end if;
77
        D(3 downto 1) <= std_logic_vector(Q31);
78
    end process;
79
 
80
    -- High bits: straight binary counter
81
    process(B, RS) is
82
        variable Q30 : unsigned(3 downto 0);
83
    begin
84
        if    RS = '0' then
85
            Q30 := (others => '0');
86
        elsif falling_edge(B(1)) then
87
            Q30 := Q30 + 1;
88
        end if;
89
        D(7 downto 4) <= std_logic_vector(Q30);
90
    end process;
91
 
92
    -----------------------------------------------------------------------
93
    -- Device Under Test...                        
94
    -----------------------------------------------------------------------
95
    DUT: SN74LS69N
96
    port map(
97
    X_1  => B(0),  -- 1CLKA
98
    X_2  => E(1),  -- 1QB
99
    X_3  => E(3),  -- 1QD
100
    X_4  => RS,    -- \1CLR
101
    X_5  => E(6),  -- 2QC
102
                   -- 
103
    X_7  => E(4),  -- 2QA
104
    X_8  => open,  -- GND
105
    X_9  => B(1),  -- 2CLK
106
    X_10 => E(5),  -- 2QB
107
    X_11 => RS,    -- \2CLR
108
    X_12 => E(7),  -- 2QD
109
    X_13 => E(2),  -- 1QC
110
    X_14 => C0,    -- 1QA
111
    X_15 => C0,    -- 1CLKB
112
    X_16 => open   -- Vcc
113
);
114
    E(0) <= C0;
115
 
116
end architecture Test;

powered by: WebSVN 2.1.0

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