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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_395.vhd] - Blame information for rev 6

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 SN74LS395N: 4-bit shift/load 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_395 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           :=  75 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_395 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(4 downto 0);   -- Expected & actual results
31
    signal R      : std_logic_vector(3 downto 0);
32
 
33
    alias S  is JC(0);
34
    alias OE is JC(1);
35
    alias DS is JC(2);
36
 
37
    begin
38
 
39
    -----------------------------------------------------------------------
40
    -- Standard testbench components
41
    -----------------------------------------------------------------------
42
    TB: TTLBench
43
    generic map(
44
        StimClk  => StimClk,
45
        CheckClk => CheckClk,
46
        Period   => Period,
47
        Finish   => Finish,
48
        SevLevel => SevLevel
49
    )
50
    port map(
51
        J    => JC,
52
        B    => BC,
53
        CLK  => CLK,
54
        RS   => RS,
55
        D    => D,
56
        E    => E
57
    );
58
 
59
    -----------------------------------------------------------------------
60
    -- Generate expected results (with zero delays)
61
    -----------------------------------------------------------------------
62
    process(RS, CLK) is
63
    begin
64
        if RS = '0' then
65
            R <= (others => '0');
66
        elsif falling_edge(CLK) then
67
            if S = '0' then
68
                R <= R(2 downto 0) & DS;
69
            else
70
                R <= std_logic_vector(BC);
71
            end if;
72
        end if;
73
    end process;
74
 
75
    D(4) <= R(3);
76
    D(3 downto 0) <= R when OE = '0' else (others => 'Z');
77
 
78
    -----------------------------------------------------------------------
79
    -- Device Under Test...                        
80
    -----------------------------------------------------------------------
81
    DUT: SN74LS395N
82
    port map(
83
        X_1  => RS,    -- MR\
84
        X_2  => DS,    -- DS
85
        X_3  => BC(0), -- P0
86
        X_4  => BC(1), -- P1
87
        X_5  => BC(2), -- P2
88
        X_6  => BC(3), -- P3
89
        X_7  => S,     -- S
90
        X_8  => open,  -- GND
91
        X_9  => OE,    -- OE\
92
        X_10 => CLK,   -- CP\
93
        X_11 => E(4),  -- Q3
94
        X_12 => E(3),  -- O3
95
        X_13 => E(2),  -- O2
96
        X_14 => E(1),  -- O1
97
        X_15 => E(0),  -- O0
98
        X_16 => open   -- Vcc
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.