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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_123.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 SN74123N: Dual retriggerable resettable monostable  --
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_123 is     -- Top-level bench
17
end entity;
18
 
19
architecture Test of Testbench_123 is
20
    signal S, Q : std_logic_vector(1 downto 0);    -- Triggers & outputs
21
    signal W, N : std_logic_vector(1 downto 0);    -- Wide & narrow windows
22
    begin
23
    S(0) <= '0',
24
            '1' after   250 ns,  '0' after   350 ns,   -- Trigger, let it time out
25
            '1' after 15000 ns,  '0' after 15100 ns,   -- Trigger again
26
            '1' after 16000 ns,  '0' after 16100 ns;   -- This should retrigger
27
 
28
    S(1) <= '0',
29
            '1' after   250 ns,  '0' after   350 ns,   -- Trigger, let it time out
30
            '1' after 15000 ns,  '0' after 15100 ns,   -- Trigger again
31
            '1' after 16000 ns,  '0' after 16100 ns;   -- This should retrigger
32
 
33
    -----------------------------------------------------------------------
34
    -- Generate expected results (with zero delays)
35
    -----------------------------------------------------------------------
36
    W(0) <= '0',
37
            '1' after   220 ns, '0' after  9330 ns,
38
            '1' after 15020 ns, '0' after 25080 ns;
39
 
40
    N(0) <= '0',
41
            '1' after   350 ns, '0' after  9250 ns,
42
            '1' after 15090 ns, '0' after 25000 ns;
43
 
44
    W(1) <= '0',
45
            '1' after   220 ns, '0' after 10330 ns,
46
            '1' after 15020 ns, '0' after 26080 ns;
47
 
48
    N(1) <= '0',
49
            '1' after   350 ns, '0' after 10250 ns,
50
            '1' after 15090 ns, '0' after 26000 ns;
51
 
52
    -----------------------------------------------------------------------
53
    -- Validate the results                        
54
    -----------------------------------------------------------------------
55
    G: for i in Q'range generate
56
    begin
57
        process(W(i), N(i), Q(i)) is
58
        begin
59
            if (rising_edge(W(i))  and Q(i) = '1') or     -- W must rise before Q
60
               (rising_edge(N(i))  and Q(i) = '0') or     -- Q must rise before N
61
               (falling_edge(N(i)) and Q(i) = '0') or     -- N must fall before Q
62
               (falling_edge(W(i)) and Q(i) = '1') then   -- Q must fall before W
63
               assert false
64
                      report "Bad monostable pulse"
65
                      severity warning;
66
            end if;
67
        end process;
68
    end generate;
69
 
70
    -----------------------------------------------------------------------
71
    -- Device Under Test...                        
72
    -----------------------------------------------------------------------
73
    DUT: SN74123N
74
    generic map(
75
        W1   => 10 us, -- Pulse widths
76
        W2   =>  9 us
77
    )
78
    port map(
79
        X_1  => '0',   -- A1\
80
        X_2  => S(0),  -- B1
81
        X_3  => '1',   -- CD1\
82
        X_4  => open,  -- Q1\
83
        X_5  => Q(1),  -- Q2
84
        X_6  => open,  -- Cx2
85
        X_7  => open,  -- Rx2Cx2
86
        X_8  => open,  -- GND
87
        X_9  => '0',   -- A2\
88
        X_10 => S(1),  -- B2
89
        X_11 => '1',   -- CD2\
90
        X_12 => open,  -- Q2\
91
        X_13 => Q(0),  -- Q1
92
        X_14 => open,  -- Cx1
93
        X_15 => open,  -- Rx1Cx1
94
        X_16 => open   -- Vcc
95
    );
96
end architecture Test;

powered by: WebSVN 2.1.0

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