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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_298.vhd] - Blame information for rev 11

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
-- December, 2016.  Perth, Australia                                 --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS298N: Quad 2-input mux. with register         --
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_298 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '0';
19
    CheckClk : std_logic      := '0';
20
    Period   : time           :=  40 ns;
21
    Finish   : time           :=  50 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_298 is
27
    signal J,  B,  Y      : unsigned(9 downto 0);         -- Test stimuli
28
    signal D,  E          : std_logic_vector(3 downto 0); -- Expected & actual results
29
    signal CP, S, RS, CLK : std_logic;
30
 
31
begin
32
    CP <= B(1) or (CLK and not RS);
33
    Y  <= B after 10 ns;
34
    S  <= Y(0);
35
 
36
    -----------------------------------------------------------------------
37
    -- Standard testbench components
38
    -----------------------------------------------------------------------
39
    TB: TTLBench
40
    generic map(
41
        StimClk  => StimClk,
42
        CheckClk => CheckClk,
43
        Period   => Period,
44
        Finish   => Finish,
45
        SevLevel => SevLevel
46
    )
47
    port map(
48
        J   => J,
49
        B   => B,
50
        CLK => CLK,
51
        RS  => RS,
52
        D   => D,
53
        E   => E
54
    );
55
 
56
    -----------------------------------------------------------------------
57
    -- Generate expected results (with zero delays)
58
    -----------------------------------------------------------------------
59
    process(CP) is
60
    begin
61
        if falling_edge(CP) then
62
            if S = '0' then
63
                D <= (Y(8), Y(6), Y(4), Y(2));
64
            else
65
                D <= (Y(9), Y(7), Y(5), Y(3));
66
            end if;
67
        end if;
68
    end process;
69
 
70
    -----------------------------------------------------------------------
71
    -- Device Under Test...                        
72
    -----------------------------------------------------------------------
73
    DUT: SN74LS298N
74
    port map(
75
        X_1  => Y(5),  -- I1B
76
        X_2  => Y(3),  -- I1A
77
        X_3  => Y(2),  -- I0A
78
        X_4  => Y(4),  -- I0B
79
        X_5  => Y(7),  -- I1C
80
        X_6  => Y(9),  -- I1D
81
        X_7  => Y(8),  -- I0D
82
        X_8  => open,  -- GND
83
        X_9  => Y(6),  -- I0C
84
        X_10 => S,     -- S
85
        X_11 => CP,    -- CP\
86
        X_12 => E(3),  -- QD
87
        X_13 => E(2),  -- QC
88
        X_14 => E(1),  -- QB
89
        X_15 => E(0),  -- QA
90
        X_16 => open   -- Vcc
91
    );
92
end architecture Test;

powered by: WebSVN 2.1.0

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