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

Subversion Repositories ttl_library

[/] [ttl_library/] [trunk/] [Testbench/] [Testbench_180.vhd] - Blame information for rev 5

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 SN74180N: 8-bit parity generator/checker            --
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_180 is     -- Top-level bench
17
generic(
18
    StimClk  : std_logic      := '1';
19
    CheckClk : std_logic      := '1';
20
    Period   : time           := 200 ns;
21
    Finish   : time           :=  20 us;
22
    SevLevel : severity_level := failure
23
);
24
end entity;
25
 
26
architecture Test of Testbench_180 is
27
    signal RS, I  : std_logic;
28
    signal CLK    : std_logic;
29
    signal JC, BC : unsigned(9 downto 0);           -- Test stimuli
30
    signal D,  E  : std_logic_vector(1 downto 0);   -- Expected & actual results
31
    signal EI, OI : std_logic;
32
 
33
    constant SO : natural := 0;
34
    constant SE : natural := 1;
35
 
36
    begin
37
    I <= xnor_reduce(std_logic_vector(JC(7 downto 0)));
38
    EI <= JC(8);
39
    OI <= not JC(9);
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
    process(all) is
65
        variable K : std_logic_vector(1 downto 0);
66
    begin
67
        K := EI & OI;
68
        D(SE) <= EI xnor I;
69
        D(SO) <= OI xnor I;
70
        case K is
71
            when "00"   => D(SE) <= '1'; D(SO) <= '1';
72
            when "01"   => null;
73
            when "10"   => null;
74
            when others => D(SE) <= '0'; D(SO) <= '0';
75
        end case;
76
    end process;
77
 
78
    -----------------------------------------------------------------------
79
    -- Device Under Test...                        
80
    -----------------------------------------------------------------------
81
    DUT: SN74180N
82
    port map(
83
        X_1  => JC(6), -- I6
84
        X_2  => JC(7), -- I7
85
        X_3  => EI,    -- EI
86
        X_4  => OI,    -- OI
87
        X_5  => E(SE), -- SE
88
        X_6  => E(SO), -- SO
89
        X_7  => open,  -- GND
90
        X_8  => JC(0), -- I0
91
        X_9  => JC(1), -- I1
92
        X_10 => JC(2), -- I2
93
        X_11 => JC(3), -- I3
94
        X_12 => JC(4), -- I4
95
        X_13 => JC(5), -- I5
96
        X_14 => open   -- Vcc
97
    );
98
end architecture Test;

powered by: WebSVN 2.1.0

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