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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_179.vhd] - Blame information for rev 11

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
-- June, 2016.  Perth, Australia                                     --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74179N: 4-bit shift 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_179 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_179 is
27
    signal RS, PE, SE : std_logic;
28
    signal CLK,DS     : std_logic;
29
    signal JC, BC     : unsigned(7 downto 0);           -- Test stimuli
30
    signal D,  E      : std_logic_vector(4 downto 0);   -- Expected & actual results
31
    signal P, REG     : std_logic_vector(3 downto 0);
32
 
33
    begin
34
        D(3 downto 0) <= REG;
35
        D(4)          <= not REG(3);
36
        P             <= std_logic_vector(JC(3 downto 0));
37
        DS            <= JC(4);
38
 
39
    process(CLK, RS) is
40
        variable N : natural := 1;
41
    begin
42
        if    RS = '0' then
43
            N  :=  1;
44
            PE <= '0';
45
            SE <= '0';
46
        elsif falling_edge(CLK) then
47
            PE <= '0';
48
            SE <= '0';
49
            N  := N - 1;
50
            case N is
51
                when 1                 => PE <= '1';
52
                when 2 | 4 | 6 | 8 | 9 => SE <= '1';
53
                when 0                 => N  := 16;
54
                when others            => null;
55
            end case;
56
        end if;
57
    end process;
58
 
59
    -----------------------------------------------------------------------
60
    -- Standard testbench components
61
    -----------------------------------------------------------------------
62
    TB: TTLBench
63
    generic map(
64
        StimClk  => StimClk,
65
        CheckClk => CheckClk,
66
        Period   => Period,
67
        Finish   => Finish,
68
        SevLevel => SevLevel
69
    )
70
    port map(
71
        J    => JC,
72
        B    => BC,
73
        CLK  => CLK,
74
        RS   => RS,
75
        D    => D,
76
        E    => E
77
    );
78
 
79
    -----------------------------------------------------------------------
80
    -- Generate expected results (with zero delays)
81
    -----------------------------------------------------------------------
82
    process(CLK, RS) is
83
    begin
84
        if    RS = '0' then
85
            REG <= (others => '0');
86
        elsif falling_edge(CLK) then
87
            if SE    = '1' then
88
                REG <= REG(2 downto 0) & DS;
89
            elsif PE = '1' then
90
                REG <= P;
91
            end if;
92
        end if;
93
    end process;
94
 
95
    -----------------------------------------------------------------------
96
    -- Device Under Test...                        
97
    -----------------------------------------------------------------------
98
    DUT: SN74179N
99
    port map(
100
        X_1  => RS,   -- MR\
101
        X_2  => P(1), -- P1
102
        X_3  => P(0), -- P0
103
        X_4  => DS,   -- DS
104
        X_5  => E(0), -- Q0
105
        X_6  => CLK,  -- CP\ (falling)
106
        X_7  => E(1), -- Q1
107
        X_8  => open, -- GND
108
        X_9  => E(2), -- Q2
109
        X_10 => PE,   -- PE
110
        X_11 => E(3), -- Q3
111
        X_12 => E(4), -- Q3\
112
        X_13 => SE,   -- SE
113
        X_14 => P(3), -- P3
114
        X_15 => P(2), -- P2
115
        X_16 => open  -- Vcc
116
    );
117
end architecture Test;

powered by: WebSVN 2.1.0

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