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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_194.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 SN74LS194N: 4-bit bidirectional 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_194 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           := 100 ns;
21
    Finish   : time           :=  15 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_194 is
27
    signal JC, BC  : unsigned(7 downto 0);           -- Test stimuli
28
    signal D,  E   : std_logic_vector(3 downto 0);   -- Expected & actual results
29
 
30
    signal P       : unsigned(3 downto 0);
31
    signal CLK, RS : std_logic;
32
    signal S       : std_logic_vector(1 downto 0);
33
    signal DR, DL  : std_logic;
34
 
35
    -- NB Q3 is considered the rightmost bit (see data sheet)
36
    signal M, R, Q : unsigned(0 to 3);
37
 
38
 
39
    begin
40
    (DR, DL, P) <= BC(5 downto 0);
41
    S(0)        <= and_reduce(std_logic_vector(JC(4 downto 0)));
42
    S(1)        <= nor_reduce(std_logic_vector(JC(4 downto 0)));
43
 
44
    -----------------------------------------------------------------------
45
    -- Standard testbench components
46
    -----------------------------------------------------------------------
47
    TB: TTLBench
48
    generic map(
49
        StimClk  => StimClk,
50
        CheckClk => CheckClk,
51
        Period   => Period,
52
        Finish   => Finish,
53
        SevLevel => SevLevel
54
   )
55
    port map(
56
        J    => JC,
57
        B    => BC,
58
        CLK  => CLK,
59
        RS   => RS,
60
        D    => D,
61
        E    => E
62
   );
63
 
64
    -----------------------------------------------------------------------
65
    -- Generate expected results (with zero delays)
66
    -----------------------------------------------------------------------
67
    M <= P(3) & P(2) & P(1) & P(0);
68
 
69
    with S select R <=
70
        M              when "11",   -- Load
71
        Q(1 to 3) & DL when "10",   -- Left
72
        DR & Q(0 to 2) when "01",   -- Right
73
        Q              when others; -- Hold
74
 
75
    process(CLK, RS) is
76
    begin
77
        if RS = '0' then
78
            Q <= (others => '0');
79
        elsif rising_edge(CLK) then
80
            Q <= R;
81
        end if;
82
    end process;
83
 
84
    (D(3), D(2), D(1), D(0)) <= Q;
85
 
86
    -----------------------------------------------------------------------
87
    -- Device Under Test...                        
88
    -----------------------------------------------------------------------
89
    DUT: SN74LS194N
90
    port map(
91
        X_1  => RS,   -- MR\
92
        X_2  => DR,   -- DSR
93
        X_3  => P(0), -- P0
94
        X_4  => P(1), -- P1
95
        X_5  => P(2), -- P2
96
        X_6  => P(3), -- P3
97
        X_7  => DL,   -- DSL
98
        X_8  => open, -- GND
99
        X_9  => S(0), -- S(0)
100
        X_10 => S(1), -- S(1)
101
        X_11 => CLK,  -- CP
102
        X_12 => E(3), -- Q3
103
        X_13 => E(2), -- Q2
104
        X_14 => E(1), -- Q1
105
        X_15 => E(0), -- Q0
106
        X_16 => open  -- Vcc
107
   );
108
end architecture Test;

powered by: WebSVN 2.1.0

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