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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_390.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 SN74LS390N: Dual decade 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_390 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_390 is
27
    signal RS, NRS, C0, C1 : 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
    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
    CA: process(B, RS) is
60
        variable NA : natural;
61
    begin
62
        if    RS = '1' then
63
            NA := 0;
64
        elsif falling_edge(B(0)) then
65
            case NA is
66
                when 9 | 11 | 13 | 15 => NA := NA - 9;
67
                when others           => NA := NA + 1;
68
            end case;
69
        end if;
70
        D(3 downto 0) <= std_logic_vector(to_unsigned(NA, 4));
71
    end process;
72
 
73
    CB: process(B, RS) is
74
        variable NB : natural;
75
    begin
76
        if    RS = '1' then
77
            NB := 0;
78
        elsif falling_edge(B(1)) then
79
            case NB is
80
                when 9 | 11 | 13 | 15 => NB := NB - 9;
81
                when others           => NB := NB + 1;
82
            end case;
83
        end if;
84
        D(7 downto 4) <= std_logic_vector(to_unsigned(NB, 4));
85
    end process;
86
 
87
    -----------------------------------------------------------------------
88
    -- Device Under Test...                        
89
    -----------------------------------------------------------------------
90
    DUT: SN74LS390N
91
    port map(
92
    X_1  => B(0),  -- CPA0\
93
    X_2  => RS,    -- MRA
94
    X_3  => C0,    -- Q0A
95
    X_4  => C0,    -- CPA1\
96
    X_5  => E(1),  -- Q1A
97
    X_6  => E(2),  -- Q2A
98
    X_7  => E(3),  -- Q3A
99
    X_8  => open,  -- GND
100
    X_9  => E(7),  -- Q3B
101
    X_10 => E(6),  -- Q2B
102
    X_11 => E(5),  -- Q1B
103
    X_12 => C1,    -- CPB1\
104
    X_13 => C1,    -- Q0B
105
    X_14 => RS,    -- MRB
106
    X_15 => B(1),  -- CPB0\
107
    X_16 => open   -- Vcc
108
);
109
    E(0) <= C0;
110
    E(4) <= C1;
111
 
112
end architecture Test;

powered by: WebSVN 2.1.0

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