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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_96.vhd] - Blame information for rev 4

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 SN74LS96N: 5-bit shift 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_96 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
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_96 is
27
    signal RS, RSX : std_logic;
28
    signal CLK     : std_logic;
29
    signal JC, BC  : unsigned(7 downto 0);           -- Test stimuli
30
    signal D,  E   : std_logic_vector(4 downto 0);   -- Expected & actual results
31
    signal L       : std_logic := '0';
32
    signal P       : std_logic_vector(4 downto 0);
33
 
34
    alias DS is BC(0);
35
 
36
    begin
37
    P   <= std_logic_vector(BC(4 downto 0));
38
 
39
    process(RS, CLK) is
40
        variable X : unsigned(5 downto 0);
41
    begin
42
        if RS = '0' then
43
            RSX <= '0';
44
            L   <= '0';
45
        elsif falling_edge(CLK) then
46
            X := BC(5 downto 0);
47
            case X is
48
                when "000010" => RSX <= '1';
49
                when "001111" => RSX <= '0', '1' after 50 ns;
50
                when "010011" => L   <= '1', '0' after 50 ns;     -- Just a short pulse
51
                when others   => null;
52
            end case;
53
        end if;
54
    end process;
55
 
56
    -----------------------------------------------------------------------
57
    -- Standard testbench components
58
    -----------------------------------------------------------------------
59
    TB: TTLBench
60
    generic map(
61
        StimClk  => StimClk,
62
        CheckClk => CheckClk,
63
        Period   => Period,
64
        Finish   => Finish,
65
        SevLevel => SevLevel
66
    )
67
    port map(
68
        J    => JC,
69
        B    => BC,
70
        CLK  => CLK,
71
        RS   => RS,
72
        D    => D,
73
        E    => E
74
    );
75
 
76
    -----------------------------------------------------------------------
77
    -- Generate expected results (with zero delays)
78
    -----------------------------------------------------------------------
79
    process(CLK, RSX, L) is
80
        variable SR : std_logic_vector(4 downto 0);
81
    begin
82
        if    RSX = '0' then
83
            SR := (others => '0');
84
        elsif L = '1' then           -- Asynchronous load
85
            SR := SR or P;
86
        elsif rising_edge(CLK) then
87
            SR := SR(3 downto 0) & DS;
88
        end if;
89
        D <= SR;
90
    end process;
91
 
92
    -----------------------------------------------------------------------
93
    -- Device Under Test...                        
94
    -----------------------------------------------------------------------
95
    DUT: SN74LS96N
96
    port map(
97
    X_1  => CLK,   -- CP
98
    X_2  => P(0),  -- P0
99
    X_3  => P(1),  -- P1
100
    X_4  => P(2),  -- P2
101
    X_5  => open,  -- Vcc
102
    X_6  => P(3),  -- P3
103
    X_7  => P(4),  -- P4
104
    X_8  => L,     -- PL
105
    X_9  => DS,    -- DS
106
    X_10 => E(4),  -- Q4
107
    X_11 => E(3),  -- Q3
108
    X_12 => open,  -- GND
109
    X_13 => E(2),  -- Q2
110
    X_14 => E(1),  -- Q1
111
    X_15 => E(0),  -- Q0
112
    X_16 => RSX    -- CL\
113
    );
114
end architecture Test;

powered by: WebSVN 2.1.0

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