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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_92.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 SN74LS92N: Divide-by-12 counter (ripple)            --
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_92 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '0';
19
    CheckClk : std_logic      := '1';
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_92 is
27
    signal RS, NRS, 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(3 downto 0);  -- Expected & actual results
31
 
32
    begin
33
    RS <= not NRS;
34
 
35
    -----------------------------------------------------------------------
36
    -- Standard testbench components
37
    -----------------------------------------------------------------------
38
    TB: TTLBench
39
    generic map(
40
        StimClk  => StimClk,
41
        CheckClk => CheckClk,
42
        Period   => Period,
43
        Finish   => Finish,
44
        SevLevel => SevLevel
45
    )
46
    port map(
47
        J    => J,
48
        B    => B,
49
        CLK  => CLK,
50
        RS   => NRS,
51
        D    => D,
52
        E    => E
53
    );
54
 
55
    -----------------------------------------------------------------------
56
    -- Generate expected results (with zero delays)
57
    -----------------------------------------------------------------------
58
 
59
    process(B, RS) is
60
        variable Q0 : std_logic;
61
    begin
62
        if    RS = '1' then
63
            Q0 := '0';
64
        elsif falling_edge(B(0)) then
65
            Q0 := not Q0;
66
        end if;
67
        D(0) <= Q0;
68
    end process;
69
 
70
    process(D, RS) is
71
        variable Q31 : unsigned(2 downto 0);
72
    begin
73
        if    RS = '1' then
74
            Q31 := (others => '0');
75
        elsif falling_edge(D(0)) then
76
            case TTL_to_integer(Q31) is
77
                when 3 | 6  => Q31 := "000";
78
                when 2      => Q31 := "100";
79
                when others => Q31 := Q31 + 1;
80
            end case;
81
        end if;
82
        D(3 downto 1) <= std_logic_vector(Q31);
83
    end process;
84
 
85
    -----------------------------------------------------------------------
86
    -- Device Under Test...                        
87
    -----------------------------------------------------------------------
88
    DUT: SN74LS92N
89
    port map(
90
    X_1  => C0,    -- CP1\
91
                   --
92
                   --
93
                   -- 
94
    X_5  => open,  -- Vcc
95
    X_6  => RS,    -- MR1
96
    X_7  => RS,    -- MR2
97
    X_8  => E(3),  -- Q3
98
    X_9  => E(2),  -- Q2
99
    X_10 => open,  -- GND
100
    X_11 => E(1),  -- Q1
101
    X_12 => C0,    -- Q0
102
                   -- 
103
    X_14 => B(0)   -- CP0\
104
);
105
    E(0) <= C0;
106
 
107
end architecture Test;

powered by: WebSVN 2.1.0

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