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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_90.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 SN74LS90AN: Decade 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_90 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_90 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 4 to 7 => Q31 := Q31 - 4;
78
                when others => Q31 := Q31 + 1;
79
            end case;
80
        end if;
81
        D(3 downto 1) <= std_logic_vector(Q31);
82
    end process;
83
 
84
    -----------------------------------------------------------------------
85
    -- Device Under Test...                        
86
    -----------------------------------------------------------------------
87
    DUT: SN74LS90AN
88
    port map(
89
    X_1  => C0,    -- CP1\
90
    X_2  => RS,    -- MR1
91
    X_3  => RS,    -- MR2
92
                   -- 
93
    X_5  => open,  -- Vcc
94
    X_6  => '0',   -- MS1
95
    X_7  => '0',   -- MS2
96
    X_8  => E(2),  -- Q2
97
    X_9  => E(1),  -- Q1
98
    X_10 => open,  -- GND
99
    X_11 => E(3),  -- Q3
100
    X_12 => C0,    -- Q0
101
                   -- 
102
    X_14 => B(0)   -- CP0\
103
);
104
    E(0) <= C0;
105
 
106
end architecture Test;

powered by: WebSVN 2.1.0

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