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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_195.vhd] - Blame information for rev 4

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 SN74LS195N: Universal 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_195 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_195 is
27
    signal JC, BC    : unsigned(7 downto 0);           -- Test stimuli
28
    signal D,  E     : std_logic_vector(4 downto 0);   -- Expected & actual results
29
 
30
    signal P         : unsigned(3 downto 0);
31
    signal CLK, RS   : std_logic;
32
    signal J, KB, PE : std_logic;
33
 
34
    signal L1  : std_logic;
35
    signal L2  : std_logic;
36
    signal L3  : std_logic;
37
    signal L4  : std_logic;
38
    signal L5  : std_logic;
39
    signal L6  : std_logic;
40
    signal L7  : std_logic;
41
    signal L8  : std_logic;
42
    signal L9  : std_logic;
43
    signal L10 : std_logic;
44
    signal L11 : std_logic;
45
    signal L12 : std_logic;
46
    signal L13 : std_logic;
47
    signal L14 : std_logic;
48
    signal N1  : std_logic;
49
    signal N2  : std_logic;
50
    signal N3  : std_logic;
51
    signal N4  : std_logic;
52
    signal N5  : std_logic;
53
    signal N6  : std_logic;
54
 
55
    begin
56
    (J, KB, P) <= BC(5 downto 0);
57
    PE         <= and_reduce(std_logic_vector(JC(5 downto 0)));
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
    N1  <= not (PE);
83
    N2  <= PE;
84
    L1  <= not (N3);
85
    L2  <= L1 and J and N2;
86
    L3  <= N2 and KB and N3;
87
    L4  <= N1 and P(0);
88
    L5  <= L2 or L3 or L4;
89
    L6  <= N3 and N2;
90
    L7  <= N1 and P(1);
91
    L8  <= L6 or L7;
92
    L9  <= N4 and N2;
93
    L10 <= N1 and P(2);
94
    L11 <= L9 or L10;
95
    L12 <= N5 and N2;
96
    L13 <= N1 and P(3);
97
    L14 <= L12 or L13;
98
    D38 : TTL_FF port map(q=>N3, d=>L5,  clk=>CLK, cl=>RS);
99
    D39 : TTL_FF port map(q=>N4, d=>L8,  clk=>CLK, cl=>RS);
100
    D40 : TTL_FF port map(q=>N5, d=>L11, clk=>CLK, cl=>RS);
101
    D41 : TTL_FF port map(q=>N6, d=>L14, clk=>CLK, cl=>RS);
102
    D(0) <= N3;
103
    D(1) <= N4;
104
    D(2) <= N5;
105
    D(3) <= N6;
106
    D(4) <= not (N6);
107
 
108
    -----------------------------------------------------------------------
109
    -- Device Under Test...                        
110
    -----------------------------------------------------------------------
111
    DUT: SN74LS195N
112
    port map(
113
        X_1  => RS,   --  MR\
114
        X_2  => J,    --  J
115
        X_3  => KB,   --  K\
116
        X_4  => P(0), --  P0
117
        X_5  => P(1), --  P1
118
        X_6  => P(2), --  P2
119
        X_7  => P(3), --  P3
120
        X_8  => open, --  GND
121
        X_9  => PE,   --  PE\
122
        X_10 => CLK,  --  CP
123
        X_11 => E(4), --  Q3\
124
        X_12 => E(3), --  Q3
125
        X_13 => E(2), --  Q2
126
        X_14 => E(1), --  Q1
127
        X_15 => E(0), --  Q0
128
        X_16 => open  --  Vcc
129
  );
130
end architecture Test;

powered by: WebSVN 2.1.0

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