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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_323.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 SN74LS323N: 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_323 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_323 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(2 downto 0);
72
    begin
73
        if rising_edge(CLK) then
74
            S := (RS, S1, S0);
75
            case S is
76
                when "0--"  => R <= (others => '0');    -- Sync. reset
77
                when "101"  => R <= DS0 & R(0 to 6);    -- Shift right
78
                when "110"  => R <= R(1 to 7) & DS7;    -- Shift left
79
                when "111"  => R <= DT;                 -- Parallel load
80
                when others => null;                    -- "00" hold
81
            end case;
82
        end if;
83
    end process;
84
 
85
    -----------------------------------------------------------------------
86
    -- Device Under Test...                        
87
    -----------------------------------------------------------------------
88
    DUT: SN74LS323N
89
    port map(
90
        X_1  => S0,    -- S0
91
        X_2  => OE1,   -- OE1\
92
        X_3  => OE2,   -- OE2\
93
        X_4  => DI(6), -- IO6
94
        X_5  => DI(4), -- IO4
95
        X_6  => DI(2), -- IO2
96
        X_7  => DI(0), -- IO0
97
        X_8  => E(8),  -- Q0
98
        X_9  => RS,    -- SR\
99
        X_10 => open,  -- GND
100
        X_11 => DS0,   -- DS0
101
        X_12 => CLK,   -- CP
102
        X_13 => DI(1), -- IO1
103
        X_14 => DI(3), -- IO3
104
        X_15 => DI(5), -- IO5
105
        X_16 => DI(7), -- IO7
106
        X_17 => E(9),  -- Q7
107
        X_18 => DS7,   -- DS7
108
        X_19 => S1,    -- S1
109
        X_20 => open   -- Vcc
110
    );
111
end architecture Test;

powered by: WebSVN 2.1.0

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