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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_259.vhd] - Blame information for rev 10

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 SN74259N: 8-bit addressable 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_259 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '0';
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_259 is
27
    signal RS     : std_logic;
28
    signal CLK    : std_logic;
29
    signal EN     : std_logic;
30
    signal JC, BC : unsigned(4 downto 0);           -- Test stimuli
31
    signal D,  E  : std_logic_vector(7 downto 0);   -- Expected & actual results    
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    => JC,
47
        B    => BC,
48
        CLK  => CLK,
49
        RS   => RS,
50
        D    => D,
51
        E    => E
52
    );
53
 
54
    process(all) is
55
    begin
56
        if falling_edge(BC(0)) then
57
            EN <= '0' after 20 ns, '1' after 100 ns;
58
        end if;
59
    end process;
60
 
61
    -----------------------------------------------------------------------
62
    -- Generate expected results (with zero delays)
63
    -----------------------------------------------------------------------
64
    process(all) is
65
        variable N : natural;
66
    begin
67
        N := to_integer(unsigned(BC(3 downto 1)));
68
        if RS = '0' then
69
            D <= (others => '0');
70
        elsif EN = '0' then
71
            D(N) <= BC(4);
72
        end if;
73
    end process;
74
 
75
    -----------------------------------------------------------------------
76
    -- Device Under Test...                        
77
    -----------------------------------------------------------------------
78
    DUT: SN74LS259N
79
    port map(
80
        X_1  => BC(1),  -- A0
81
        X_2  => BC(2),  -- A1
82
        X_3  => BC(3),  -- A2
83
        X_4  => E(0),   -- Q0
84
        X_5  => E(1),   -- Q1
85
        X_6  => E(2),   -- Q2
86
        X_7  => E(3),   -- Q3
87
        X_8  => open,   -- GND
88
        X_9  => E(4),   -- Q4
89
        X_10 => E(5),   -- Q5
90
        X_11 => E(6),   -- Q6
91
        X_12 => E(7),   -- Q7
92
        X_13 => BC(4),  -- D
93
        X_14 => EN,     -- E\
94
        X_15 => RS,     -- CL\
95
        X_16 => open    -- Vcc
96
    );
97
end architecture Test;

powered by: WebSVN 2.1.0

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