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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_295.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
-- December, 2016.  Perth, Australia                                 --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS295AN: 4-bit shift register (3-state outputs) --
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_295 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '0';
19
    CheckClk : std_logic      := '0';
20
    Period   : time           :=  50 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_295 is
27
    signal RS             : std_logic;
28
    signal CLK            : std_logic;
29
    signal JC, BC         : unsigned(3 downto 0);           -- Test stimuli
30
    signal D,  E          : std_logic_vector(3 downto 0);   -- Expected & actual results
31
    signal P,  Q          : std_logic_vector(3 downto 0);
32
    signal CP, OE, PE, DS : std_logic := '1';
33
 
34
    begin
35
    P  <= std_logic_vector(JC(3 downto 0));
36
    DS <= JC(1);
37
    CP <= CLK;
38
    PE <= '1' when ((BC = "1000") or (RS = '0')) else '0';
39
 
40
    -----------------------------------------------------------------------
41
    -- Standard testbench components
42
    -----------------------------------------------------------------------
43
    TB: TTLBench
44
    generic map(
45
        StimClk  => StimClk,
46
        CheckClk => CheckClk,
47
        Period   => Period,
48
        Finish   => Finish,
49
        SevLevel => SevLevel
50
    )
51
    port map(
52
        J    => JC,
53
        B    => BC,
54
        CLK  => CLK,
55
        RS   => RS,
56
        D    => D,
57
        E    => E
58
    );
59
 
60
    -----------------------------------------------------------------------
61
    -- Generate expected results (with zero delays)
62
    -----------------------------------------------------------------------
63
    process(CP) is
64
    begin
65
        if falling_edge(CP) then
66
            if PE = '0' then
67
                Q <= Q(2 downto 0) & DS;
68
            else
69
                Q <= P;
70
            end if;
71
        end if;
72
    end process;
73
 
74
    D <= Q when OE = '1' else (others => 'Z');
75
 
76
    -----------------------------------------------------------------------
77
    -- Device Under Test...                        
78
    -----------------------------------------------------------------------
79
    DUT: SN74LS295AN
80
    port map(
81
        X_1  => DS,    -- DS
82
        X_2  => P(0),  -- P0
83
        X_3  => P(1),  -- P1
84
        X_4  => P(2),  -- P2
85
        X_5  => P(3),  -- P3
86
        X_6  => PE,    -- PE
87
        X_7  => open,  -- GND
88
        X_8  => OE,    -- OE
89
        X_9  => CP,    -- CP\
90
        X_10 => E(3),  -- Q3
91
        X_11 => E(2),  -- Q2
92
        X_12 => E(1),  -- Q1
93
        X_13 => E(0),  -- Q0
94
        X_14 => 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.