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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_3/] [bench/] [vhdl/] [tb_t8041.vhd] - Blame information for rev 331

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 306 arniml
-------------------------------------------------------------------------------
2
--
3
-- The testbench for t8041.
4
--
5
-- Copyright (c) 2004-2022, Arnim Laeuger (arniml@opencores.org)
6
--
7
-- All rights reserved
8
--
9
-- Redistribution and use in source and synthezised forms, with or without
10
-- modification, are permitted provided that the following conditions are met:
11
--
12
-- Redistributions of source code must retain the above copyright notice,
13
-- this list of conditions and the following disclaimer.
14
--
15
-- Redistributions in synthesized form must reproduce the above copyright
16
-- notice, this list of conditions and the following disclaimer in the
17
-- documentation and/or other materials provided with the distribution.
18
--
19
-- Neither the name of the author nor the names of other contributors may
20
-- be used to endorse or promote products derived from this software without
21
-- specific prior written permission.
22
--
23
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
27
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
-- POSSIBILITY OF SUCH DAMAGE.
34
--
35
-- Please report bugs to the author, but before you do so, please
36
-- make sure that this is not a derivative work and that
37
-- you have the latest version of this file.
38
--
39
-- The latest version of this file can be found at:
40
--      http://www.opencores.org/cvsweb.shtml/t48/
41
--
42
-------------------------------------------------------------------------------
43
 
44
library ieee;
45
use ieee.std_logic_1164.all;
46
 
47
entity tb_t8041 is
48
 
49
end tb_t8041;
50
 
51
 
52
use work.t48_system_comp_pack.t8041;
53
 
54
use work.t48_tb_pack.all;
55
 
56
architecture behav of tb_t8041 is
57
 
58
  -- clock period, 11 MHz
59
  constant period_c : time := 90 ns;
60
 
61
  signal xtal_s          : std_logic;
62
  signal res_n_s         : std_logic;
63
  signal prog_n_s        : std_logic;
64
 
65
  signal p1_b : std_logic_vector( 7 downto 0);
66
  signal p2_b : std_logic_vector( 7 downto 0);
67
 
68
  signal db_b   : std_logic_vector( 7 downto 0);
69
  signal cs_n_s : std_logic;
70
  signal rd_n_s : std_logic;
71
  signal wr_n_s : std_logic;
72
  signal a0_s   : std_logic;
73
 
74
  signal fail_s : boolean;
75
 
76
  signal zero_s : std_logic;
77
  signal one_s  : std_logic;
78
 
79
  component upi_stim
80
    port (
81
      cs_n_o : out   std_logic;
82
      rd_n_o : out   std_logic;
83
      wr_n_o : out   std_logic;
84
      a0_o   : out   std_logic;
85
      db_b   : inout std_logic_vector(7 downto 0);
86
      p1_b   : inout std_logic_vector(7 downto 0);
87
      p2_b   : inout std_logic_vector(7 downto 0);
88
      fail_o : out   boolean
89
    );
90
  end component;
91
 
92
begin
93
 
94
  zero_s <= '0';
95
  one_s  <= '1';
96
 
97
  p2_b   <= (others => 'H');
98
  p1_b   <= (others => 'H');
99
 
100
  t8041_b : t8041
101
    port map (
102
      xtal_i    => xtal_s,
103
      reset_n_i => res_n_s,
104
      cs_n_i    => cs_n_s,
105
      rd_n_i    => rd_n_s,
106
      a0_i      => a0_s,
107
      wr_n_i    => wr_n_s,
108
      t0_i      => p1_b(0),
109
      db_b      => db_b,
110
      t1_i      => p1_b(1),
111
      p2_b      => p2_b,
112
      p1_b      => p1_b,
113
      prog_n_o  => prog_n_s
114
    );
115
 
116
 
117
  -----------------------------------------------------------------------------
118
  -- Generic UPI stimulus generator
119
  --
120
  upi_stim_b: upi_stim
121
    port map (
122
      cs_n_o => cs_n_s,
123
      rd_n_o => rd_n_s,
124
      wr_n_o => wr_n_s,
125
      a0_o   => a0_s,
126
      db_b   => db_b,
127
      p1_b   => p1_b,
128
      p2_b   => p2_b,
129
      fail_o => fail_s
130
    );
131
  --
132
  -----------------------------------------------------------------------------
133
 
134
 
135
  -----------------------------------------------------------------------------
136
  -- The clock generator
137
  --
138
  clk_gen: process
139
  begin
140
    xtal_s <= '0';
141
    wait for period_c/2;
142
    xtal_s <= '1';
143
    wait for period_c/2;
144
  end process clk_gen;
145
  --
146
  -----------------------------------------------------------------------------
147
 
148
 
149
  -----------------------------------------------------------------------------
150
  -- The reset generator
151
  --
152
  res_gen: process
153
  begin
154
    res_n_s <= '0';
155
    wait for 5 * period_c;
156
    res_n_s <= '1';
157
    wait;
158
  end process res_gen;
159
  --
160
  -----------------------------------------------------------------------------
161
 
162
 
163
  -----------------------------------------------------------------------------
164
  -- End of simulation detection
165
  --
166
  eos: process
167
  begin
168
 
169
    outer: loop
170
      wait on tb_accu_s;
171
      if tb_accu_s = "10101010" then
172
        wait on tb_accu_s;
173
        if tb_accu_s = "01010101" then
174
          wait on tb_accu_s;
175
          if tb_accu_s = "00000001" then
176
            -- wait for instruction strobe of this move
177
            wait until tb_istrobe_s'event and tb_istrobe_s = '1';
178
            -- wait for next strobe
179
            wait until tb_istrobe_s'event and tb_istrobe_s = '1';
180
 
181
            if not fail_s then
182
              assert false
183
                report "Simulation Result: PASS."
184
                severity note;
185
            else
186
              assert false
187
                report "Simulation Result: FAIL from TB."
188
                severity note;
189
            end if;
190
          else
191
            assert false
192
              report "Simulation Result: FAIL."
193
              severity note;
194
          end if;
195
 
196
          assert false
197
            report "End of simulation reached."
198
            severity failure;
199
 
200
        end if;
201
      end if;
202
    end loop;
203
 
204
  end process eos;
205
  --
206
  -----------------------------------------------------------------------------
207
 
208
end behav;

powered by: WebSVN 2.1.0

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