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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_75.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
-- December, 2016.  Perth, Australia                                 --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS75N: 4-bit bistable latch                     --
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_75 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '0';
20
    Period   : time           := 100 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_75 is
27
    signal CLK      : std_logic;
28
    signal J, B     : unsigned(5 downto 0);         -- Test stimuli
29
    signal D, E     : std_logic_vector(7 downto 0); -- Expected & actual results
30
    signal S        : std_logic_vector(3 downto 0);
31
    signal E12, E34 : std_logic;
32
 
33
    begin
34
    -----------------------------------------------------------------------
35
    -- Standard testbench components
36
    -----------------------------------------------------------------------
37
    TB: TTLBench
38
    generic map(
39
        StimClk  => StimClk,
40
        CheckClk => CheckClk,
41
        Period   => Period,
42
        Finish   => Finish,
43
        SevLevel => SevLevel
44
    )
45
    port map(
46
        J    => J,
47
        B    => B,
48
        CLK  => CLK,
49
        RS   => open,
50
        D    => D,
51
        E    => E
52
    );
53
 
54
    -----------------------------------------------------------------------
55
    -- Generate expected results (with zero delays)
56
    -----------------------------------------------------------------------
57
    process(CLK) is
58
    begin
59
        if falling_edge(CLK) then
60
            E12 <= J(4), '0' after 45 ns;
61
            E34 <= J(5), '0' after 45 ns;
62
        end if;
63
    end process;
64
 
65
    S <= (E34, E34, E12, E12);
66
 
67
    G1: for i in 3 downto 0 generate
68
    begin
69
        process(S, J) is
70
        begin
71
            if S(i) = '1' then
72
                D(i)   <= J(i);
73
                D(i+4) <= not J(i);
74
            end if;
75
        end process;
76
    end generate;
77
 
78
    -----------------------------------------------------------------------
79
    -- Device Under Test...                        
80
    -----------------------------------------------------------------------
81
    DUT: SN74LS75N
82
    port map(
83
    X_1  => E(4),  -- Q1\
84
    X_2  => J(0),  -- D1
85
    X_3  => J(1),  -- D2
86
    X_4  => E34,   -- E34
87
    X_5  => open,  -- Vcc
88
    X_6  => J(2),  -- D3
89
    X_7  => J(3),  -- D4
90
    X_8  => E(7),  -- Q4\
91
    X_9  => E(3),  -- Q4
92
    X_10 => E(6),  -- Q3\
93
    X_11 => E(2),  -- Q3
94
    X_12 => open,  -- GND
95
    X_13 => E12,   -- E12
96
    X_14 => E(5),  -- Q2\
97
    X_15 => E(1),  -- Q2
98
    X_16 => E(0)   -- Q1
99
);
100
end architecture Test;

powered by: WebSVN 2.1.0

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