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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_74.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 SN74LS74N: Dual D-type +ve edge-triggered flipflop  --
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_74 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '0';
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_74 is
27
    signal RS     : std_logic;
28
    signal CLK    : std_logic;
29
    signal JC, BC : unsigned(1 downto 0);           -- Test stimuli
30
    signal D,  E  : std_logic_vector(3 downto 0);   -- Expected & actual results
31
 
32
    begin
33
    -----------------------------------------------------------------------
34
    -- Standard testbench components
35
    -----------------------------------------------------------------------
36
    TB: TTLBench
37
    generic map(
38
        StimClk  => StimClk,
39
        CheckClk => CheckClk,
40
        Period   => Period,
41
        Finish   => Finish,
42
        SevLevel => SevLevel
43
    )
44
    port map(
45
        J    => JC,
46
        B    => BC,
47
        CLK  => CLK,
48
        RS   => RS,
49
        D    => D,
50
        E    => E
51
    );
52
 
53
    -----------------------------------------------------------------------
54
    -- Generate expected results (with zero delays)
55
    -----------------------------------------------------------------------
56
 
57
    G: for i in 1 downto 0 generate
58
    begin
59
        SIM: process(CLK, RS) is
60
        begin
61
            if    RS = '0' then
62
                D(i) <= '0';
63
            elsif rising_edge(CLK) then
64
                D(i) <= BC(i);
65
            end if;
66
        end process;
67
        D(i+2) <= not D(i);
68
    end generate;
69
 
70
    -----------------------------------------------------------------------
71
    -- Device Under Test...                        
72
    -----------------------------------------------------------------------
73
    DUT: SN74LS74N
74
    port map(
75
    X_1  => RS,    -- CD1\
76
    X_2  => BC(0), -- D1
77
    X_3  => CLK,   -- CP1
78
    X_4  => '1',   -- SD1\
79
    X_5  => E(0),  -- Q1
80
    X_6  => E(2),  -- Q1\
81
    X_7  => open,  -- GND
82
    X_8  => E(3),  -- Q2\
83
    X_9  => E(1),  -- Q2
84
    X_10 => '1',   -- SD2\
85
    X_11 => CLK,   -- CP2
86
    X_12 => BC(1), -- D2
87
    X_13 => RS,    -- CD2\
88
    X_14 => open   -- Vcc
89
);
90
end architecture Test;

powered by: WebSVN 2.1.0

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