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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_93.vhd] - Blame information for rev 5

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 SN74LS93N: Divide-by-16 (binary) 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_93 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '0';
19
    CheckClk : std_logic      := '1';
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_93 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
            Q31 := Q31 + 1;
77
        end if;
78
        D(3 downto 1) <= std_logic_vector(Q31);
79
    end process;
80
 
81
    -----------------------------------------------------------------------
82
    -- Device Under Test...                        
83
    -----------------------------------------------------------------------
84
    DUT: SN74LS93N
85
    port map(
86
    X_1  => C0,    -- CP1\
87
    X_2  => RS,    -- MR1
88
    X_3  => RS,    -- MR2
89
                   -- 
90
    X_5  => open,  -- Vcc
91
                   -- 
92
                   -- 
93
    X_8  => E(2),  -- Q2
94
    X_9  => E(1),  -- Q1
95
    X_10 => open,  -- GND
96
    X_11 => E(3),  -- Q3
97
    X_12 => C0,    -- Q0
98
                   -- 
99
    X_14 => B(0)   -- CP0\
100
);
101
    E(0) <= C0;
102
 
103
end architecture Test;

powered by: WebSVN 2.1.0

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