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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_299.vhd] - Blame information for rev 3

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 SN74LS299N: 8 bit universal shift/storage 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_299 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           :=  40 ns;
21
    Finish   : time           :=  50 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_299 is
27
    signal J,  B     : unsigned(13 downto 0);        -- Test stimuli
28
    signal D,  E     : std_logic_vector(9 downto 0); -- Expected & actual results
29
    signal RS, CLK   : std_logic;
30
    signal OE        : std_logic;
31
    signal DI, R, DT : std_logic_vector(0 to 7);
32
 
33
    alias  S0  is J(8);
34
    alias  S1  is J(9);
35
    alias  OE1 is J(10);
36
    alias  OE2 is J(11);
37
    alias  DS0 is J(12);
38
    alias  DS7 is J(13);
39
 
40
begin
41
    OE <= not((S1 and S0) or OE1 or OE2);
42
    DI <= TTL_REV(J(7 downto 0)) when OE = '0' else (others => 'Z');
43
    E  <= "ZZ" & TTL_REV(DI);
44
    DT <= TTL_REV(J(7 downto 0)) when OE = '0' else R;
45
    D  <= R(7) & R(0) & TTL_REV(DT);
46
 
47
    -----------------------------------------------------------------------
48
    -- Standard testbench components
49
    -----------------------------------------------------------------------
50
    TB: TTLBench
51
    generic map(
52
        StimClk  => StimClk,
53
        CheckClk => CheckClk,
54
        Period   => Period,
55
        Finish   => Finish,
56
        SevLevel => SevLevel
57
    )
58
    port map(
59
        J   => J,
60
        B   => B,
61
        CLK => CLK,
62
        RS  => RS,
63
        D   => D,
64
        E   => E
65
    );
66
 
67
    -----------------------------------------------------------------------
68
    -- Generate expected results (with zero delays)
69
    -----------------------------------------------------------------------
70
    process(RS, CLK) is
71
        variable S : unsigned(1 downto 0);
72
    begin
73
        if RS = '0' then
74
            R <= (others => '0');
75
        elsif rising_edge(CLK) then
76
            S := (S1, S0);
77
            case S is
78
                when "01"   => R <= DS0 & R(0 to 6);    -- Shift right
79
                when "10"   => R <= R(1 to 7) & DS7;    -- Shift left
80
                when "11"   => R <= DT;                 -- Parallel load
81
                when others => null;                    -- "00" hold
82
            end case;
83
        end if;
84
    end process;
85
 
86
    -----------------------------------------------------------------------
87
    -- Device Under Test...                        
88
    -----------------------------------------------------------------------
89
    DUT: SN74LS299N
90
    port map(
91
        X_1  => S0,    -- S0
92
        X_2  => OE1,   -- OE1\
93
        X_3  => OE2,   -- OE2\
94
        X_4  => DI(6), -- IO6
95
        X_5  => DI(4), -- IO4
96
        X_6  => DI(2), -- IO2
97
        X_7  => DI(0), -- IO0
98
        X_8  => E(8),  -- Q0
99
        X_9  => RS,    -- MR\
100
        X_10 => open,  -- GND
101
        X_11 => DS0,   -- DS0
102
        X_12 => CLK,   -- CP
103
        X_13 => DI(1), -- IO1
104
        X_14 => DI(3), -- IO3
105
        X_15 => DI(5), -- IO5
106
        X_16 => DI(7), -- IO7
107
        X_17 => E(9),  -- Q7
108
        X_18 => DS7,   -- DS7
109
        X_19 => S1,    -- S1
110
        X_20 => open   -- Vcc
111
    );
112
end architecture Test;

powered by: WebSVN 2.1.0

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