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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_173.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
-- June, 2016.  Perth, Australia                                     --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS173N: 4-bit D-type 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_173 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           := 100 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_173 is
27
    signal RS, RSH    : std_logic;
28
    signal CLK        : std_logic;
29
    signal JC, BC     : unsigned(7 downto 0);           -- Test stimuli
30
    signal D,  E      : std_logic_vector(3 downto 0);   -- Expected & actual results
31
    signal SR, DI     : std_logic_vector(3 downto 0);
32
    signal DIX        : unsigned(4 downto 0);
33
    signal IE1, IE2, OE1, OE2 : std_logic;
34
 
35
    begin
36
    RSH <= not RS;
37
 
38
    IE1 <= BC(0);
39
    IE2 <= BC(1);
40
    OE1 <= BC(2);
41
    OE2 <= BC(3);
42
 
43
    DI <= std_logic_vector(DIX(3 downto 0));
44
 
45
 
46
    -----------------------------------------------------------------------
47
    -- Standard testbench components
48
    -----------------------------------------------------------------------
49
    TB: TTLBench
50
    generic map(
51
        StimClk  => StimClk,
52
        CheckClk => CheckClk,
53
        Period   => Period,
54
        Finish   => Finish,
55
        SevLevel => SevLevel
56
    )
57
    port map(
58
        J    => JC,
59
        B    => BC,
60
        CLK  => CLK,
61
        RS   => RS,
62
        D    => D,
63
        E    => E
64
    );
65
 
66
    -----------------------------------------------------------------------
67
    -- Generate expected results (with zero delays)
68
    -----------------------------------------------------------------------
69
    process(CLK, RSH) is
70
    begin
71
        if RSH = '1' then
72
            SR  <= (others => '0');
73
            DIX <= (others => '0');
74
        elsif rising_edge(CLK) then
75
            if to_integer(DIX) = 4 then
76
                DIX <= (others => '0');
77
            else
78
                DIX <= DIX + 1;
79
            end if;
80
 
81
            if (IE1 or IE2) = '0' then
82
                SR <= DI;
83
            end if;
84
        end if;
85
    end process;
86
 
87
    D <= SR when (OE1 or OE2) = '0' else (others => 'Z');
88
 
89
    -----------------------------------------------------------------------
90
    -- Device Under Test...                        
91
    -----------------------------------------------------------------------
92
    DUT: SN74LS173N
93
    port map(
94
        X_1  => OE1,   --  OE1\
95
        X_2  => OE2,   --  OE2\
96
        X_3  => E(0),  --  Q0
97
        X_4  => E(1),  --  Q1
98
        X_5  => E(2),  --  Q2
99
        X_6  => E(3),  --  Q3
100
        X_7  => CLK,   --  CP
101
        X_8  => open,  --  GND
102
        X_9  => IE1,   --  IE1\
103
        X_10 => IE2,   --  IE2\
104
        X_11 => DI(3), --  D3
105
        X_12 => DI(2), --  D2
106
        X_13 => DI(1), --  D1
107
        X_14 => DI(0), --  D0
108
        X_15 => RSH,   --  MR
109
        X_16 => 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.