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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_85.vhd] - Blame information for rev 9

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 SN74LS85N: 4-bit magnitude comparator               --
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_85 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_85 is
27
    signal JC, BC : unsigned(10 downto 0);        -- Test stimuli
28
    signal D,  E  : std_logic_vector(2 downto 0); -- Expected & actual results
29
 
30
    alias inLT is JC(10);
31
    alias inEQ is JC( 9);
32
    alias inGT is JC( 8);
33
    alias A    is JC(7 downto 4);
34
    alias B    is JC(3 downto 0);
35
 
36
    begin
37
    -----------------------------------------------------------------------
38
    -- Standard testbench components
39
    -----------------------------------------------------------------------
40
    TB: TTLBench
41
    generic map(
42
        StimClk  => StimClk,
43
        CheckClk => CheckClk,
44
        Period   => Period,
45
        Finish   => Finish,
46
        SevLevel => SevLevel
47
    )
48
    port map(
49
        J    => JC,
50
        B    => BC,
51
        CLK  => open,
52
        RS   => open,
53
        D    => D,
54
        E    => E
55
    );
56
 
57
    -----------------------------------------------------------------------
58
    -- Generate expected results (with zero delays)
59
    -----------------------------------------------------------------------
60
    process(JC) is
61
        variable LT, EQ, GT : std_logic;
62
        variable INCOND     : std_logic_vector(2 downto 0);
63
    begin
64
        LT := '0';
65
        EQ := '0';
66
        GT := '0';
67
 
68
        if    A < B then LT := '1';
69
        elsif A > B then GT := '1';
70
        else
71
            INCOND := inGT & inLT & inEQ;
72
            case INCOND is
73
                when "100"  => GT := '1';
74
                when "010"  => LT := '1';
75
                when "000"  => GT := '1'; LT := '1';
76
                when "110"  => null;
77
                when others => EQ := '1';
78
            end case;
79
        end if;
80
        D <= (LT, EQ, GT);
81
    end process;
82
 
83
    -----------------------------------------------------------------------
84
    -- Device Under Test...                        
85
    -----------------------------------------------------------------------
86
    DUT: SN74LS85N
87
    port map(
88
    X_1  => JC(3),  -- B3
89
    X_2  => inLT,   -- IA<B
90
    X_3  => inEQ,   -- IA=B
91
    X_4  => inGT,   -- IA>B
92
    X_5  => E(0),   -- OA>B
93
    X_6  => E(1),   -- OA=B
94
    X_7  => E(2),   -- OA<B
95
    X_8  => open,   -- GND
96
    X_9  => JC(0),  -- B0
97
    X_10 => JC(4),  -- A0
98
    X_11 => JC(1),  -- B1
99
    X_12 => JC(5),  -- A1
100
    X_13 => JC(6),  -- A2
101
    X_14 => JC(2),  -- B2
102
    X_15 => JC(7),  -- A3
103
    X_16 => open    -- Vcc
104
);
105
end architecture Test;

powered by: WebSVN 2.1.0

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