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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_283.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 SN74LS283N: 4-bit binary full adder (fast carry)    --
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_283 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           := 50 ns;
21
    Finish   : time           := 20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_283 is
27
    signal JC, BC : unsigned(8 downto 0);         -- Test stimuli
28
    signal D,  E  : std_logic_vector(4 downto 0); -- Expected & actual results
29
 
30
    begin
31
    -----------------------------------------------------------------------
32
    -- Standard testbench components
33
    -----------------------------------------------------------------------
34
    TB: TTLBench
35
    generic map(
36
        StimClk  => StimClk,
37
        CheckClk => CheckClk,
38
        Period   => Period,
39
        Finish   => Finish,
40
        SevLevel => SevLevel
41
    )
42
    port map(
43
        J    => JC,
44
        B    => BC,
45
        CLK  => open,
46
        RS   => open,
47
        D    => D,
48
        E    => E
49
    );
50
 
51
    -----------------------------------------------------------------------
52
    -- Generate expected results (with zero delays)
53
    -----------------------------------------------------------------------
54
    process(JC) is
55
        variable X, Y, Z : natural := 0;
56
    begin
57
        if now > 1 ns then      -- Meaningless to run at T=0
58
            X := TTL_to_integer(JC(7 downto 4));
59
            Y := TTL_to_integer(JC(3 downto 0));
60
            Z := TTL_to_integer(JC(8 downto 8));
61
 
62
            Z := Z + X + Y;
63
        end if;
64
        D <= std_logic_vector(to_unsigned(Z, D'length));
65
    end process;
66
 
67
    -----------------------------------------------------------------------
68
    -- Device Under Test...                        
69
    -----------------------------------------------------------------------
70
    DUT: SN74LS283N
71
    port map(
72
    X_1  => E(1),   -- S1
73
    X_2  => JC(5),  -- B1
74
    X_3  => JC(1),  -- A1
75
    X_4  => E(0),   -- S0
76
    X_5  => JC(0),  -- A0
77
    X_6  => JC(4),  -- B0
78
    X_7  => JC(8),  -- C0
79
    X_8  => open,   -- GND
80
    X_9  => E(4),   -- C4
81
    X_10 => E(3),   -- S3
82
    X_11 => JC(7),  -- B3
83
    X_12 => JC(3),  -- A3
84
    X_13 => E(2),   -- S2
85
    X_14 => JC(2),  -- A2
86
    X_15 => JC(6),  -- B2
87
    X_16 => open    -- Vcc
88
 
89
);
90
end architecture Test;

powered by: WebSVN 2.1.0

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