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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_199.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
-- August, 2016.  Perth, Australia                                   --
5
-- Compliance: VHDL 2008                                             --
6
-- Testbench for SN74LS199N: 8-bit parallel IO 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_199 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           := 50 ns;
21
    Finish   : time           := 50 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_199 is
27
    signal CLK, RS  : std_logic;
28
    signal JC,  BC  : unsigned(7 downto 0);       -- Test stimuli
29
    signal D,   E   : std_logic_vector(0 to 7);   -- Expected & actual results
30
    signal P,   Q   : std_logic_vector(0 to 7);
31
    signal J, KB, CP1, CP2, PE, CP, I : std_logic;
32
    signal JKB      : std_logic_vector(1 downto 0);
33
 
34
 
35
    begin
36
    P <= std_logic_vector(BC(7 downto 0)) after 1 ns;   -- Be sure CP evaluates first
37
    (J, KB, PE) <= JC(2 downto 0) after 1 ns;
38
    CP1 <= CLK;
39
    CP2 <= '1', '0' after 288 ns;
40
 
41
    -----------------------------------------------------------------------
42
    -- Standard testbench components
43
    -----------------------------------------------------------------------
44
    TB: TTLBench
45
    generic map(
46
        StimClk  => StimClk,
47
        CheckClk => CheckClk,
48
        Period   => Period,
49
        Finish   => Finish,
50
        SevLevel => SevLevel
51
   )
52
    port map(
53
        J    => JC,
54
        B    => BC,
55
        CLK  => CLK,
56
        RS   => RS,
57
        D    => D,
58
        E    => E
59
   );
60
 
61
    -----------------------------------------------------------------------
62
    -- Generate expected results (with zero delays)
63
    -----------------------------------------------------------------------
64
    CP  <= CP1 or CP2;
65
    JKB <= J & KB;
66
 
67
    with JKB select I <=
68
        '0'      when "00",
69
        not Q(0) when "10",
70
        '1'      when "11",
71
        Q(0)     when others;
72
 
73
    process(RS, CP) is
74
    begin
75
        if RS = '0' then
76
            Q <= (others => '0');
77
        elsif rising_edge(CP) then
78
            if PE <= '0' then
79
                Q <= P;
80
            else
81
                Q <= I & Q(0 to 6);
82
            end if;
83
        end if;
84
    end process;
85
 
86
    D <= (Q(0), Q(1), Q(2), Q(3), Q(4), Q(5), Q(6), Q(7));
87
 
88
 
89
    -----------------------------------------------------------------------
90
    -- Device Under Test...                        
91
    -----------------------------------------------------------------------
92
    DUT: SN74LS199N
93
    port map(
94
        X_1  => KB,   -- in     KB\
95
        X_2  => J,    -- in     J
96
        X_3  => P(0), -- in     P0
97
        X_4  => E(0), -- out    Q0
98
        X_5  => P(1), -- in     P1
99
        X_6  => E(1), -- out    Q1
100
        X_7  => P(2), -- in     P2
101
        X_8  => E(2), -- out    Q2
102
        X_9  => P(3), -- in     P3
103
        X_10 => E(3), -- out    Q3
104
        X_11 => CP1,  -- in     CP1
105
        X_12 => open, -- inout  GND
106
        X_13 => CP2,  -- in     CP2
107
        X_14 => RS,   -- in     MR\
108
        X_15 => E(4), -- out    Q4
109
        X_16 => P(4), -- in     P4
110
        X_17 => E(5), -- out    Q5
111
        X_18 => P(5), -- in     P5
112
        X_19 => E(6), -- out    Q6
113
        X_20 => P(6), -- in     P6
114
        X_21 => E(7), -- out    Q7
115
        X_22 => P(7), -- in     P7
116
        X_23 => PE,   -- in     PE\
117
        X_24 => open  -- inout  Vcc
118
   );
119
end architecture Test;

powered by: WebSVN 2.1.0

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