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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_4_beta/] [bench/] [vhdl/] [tb_t8048.vhd] - Blame information for rev 19

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 arniml
-------------------------------------------------------------------------------
2
--
3
-- The testbench for t8048.
4
--
5 19 arniml
-- $Id: tb_t8048.vhd,v 1.2 2004-03-26 22:39:28 arniml Exp $
6 8 arniml
--
7
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
8
--
9
-- All rights reserved
10
--
11
-- Redistribution and use in source and synthezised forms, with or without
12
-- modification, are permitted provided that the following conditions are met:
13
--
14
-- Redistributions of source code must retain the above copyright notice,
15
-- this list of conditions and the following disclaimer.
16
--
17
-- Redistributions in synthesized form must reproduce the above copyright
18
-- notice, this list of conditions and the following disclaimer in the
19
-- documentation and/or other materials provided with the distribution.
20
--
21
-- Neither the name of the author nor the names of other contributors may
22
-- be used to endorse or promote products derived from this software without
23
-- specific prior written permission.
24
--
25
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
29
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
-- POSSIBILITY OF SUCH DAMAGE.
36
--
37
-- Please report bugs to the author, but before you do so, please
38
-- make sure that this is not a derivative work and that
39
-- you have the latest version of this file.
40
--
41
-- The latest version of this file can be found at:
42
--      http://www.opencores.org/cvsweb.shtml/t48/
43
--
44
-------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
 
49
entity tb_t8048 is
50
 
51
end tb_t8048;
52
 
53
use work.t48_core_comp_pack.syn_ram;
54
 
55
use work.t48_tb_pack.all;
56
 
57
architecture behav of tb_t8048 is
58
 
59
  -- clock period, 11 MHz
60
  constant period_c : time := 90 ns;
61
 
62
  component t8048
63
    port (
64
      xtal_i    : in    std_logic;
65
      reset_n_i : in    std_logic;
66
      t0_b      : inout std_logic;
67
      int_n_i   : in    std_logic;
68
      ea_i      : in    std_logic;
69
      rd_n_o    : out   std_logic;
70
      psen_n_o  : out   std_logic;
71
      wr_n_o    : out   std_logic;
72
      ale_o     : out   std_logic;
73
      db_b      : inout std_logic_vector( 7 downto 0);
74
      t1_i      : in    std_logic;
75
      p2_b      : inout std_logic_vector( 7 downto 0);
76
      p1_b      : inout std_logic_vector( 7 downto 0);
77
      prog_n_o  : out   std_logic
78
    );
79
  end component;
80
 
81
  signal xtal_s          : std_logic;
82
  signal res_n_s         : std_logic;
83
  signal int_n_s         : std_logic;
84
  signal ale_s           : std_logic;
85
  signal psen_n_s        : std_logic;
86
  signal prog_n_s        : std_logic;
87
  signal rom_addr_s      : std_logic_vector(11 downto 0);
88
  signal rom_data_s      : std_logic_vector( 7 downto 0);
89
  signal ram_data_to_s   : std_logic_vector( 7 downto 0);
90
  signal ram_data_from_s : std_logic_vector( 7 downto 0);
91
  signal ram_addr_s      : std_logic_vector( 7 downto 0);
92
  signal ram_we_s        : std_logic;
93
 
94
  signal t0_s : std_logic;
95
  signal t1_s : std_logic;
96
  signal p1_b : std_logic_vector( 7 downto 0);
97
  signal p2_b : std_logic_vector( 7 downto 0);
98
 
99
  signal db_b                : std_logic_vector( 7 downto 0);
100
  signal ext_ram_addr_s      : std_logic_vector( 7 downto 0);
101
  signal ext_ram_data_from_s : std_logic_vector( 7 downto 0);
102
  signal ext_ram_we_s        : std_logic;
103
  signal rd_n_s              : std_logic;
104
  signal wr_n_s              : std_logic;
105
 
106
  signal zero_s          : std_logic;
107
  signal one_s           : std_logic;
108
 
109
begin
110
 
111
  zero_s <= '0';
112
  one_s  <= '1';
113
 
114
  t0_s   <= 'H';
115
  t1_s   <= 'H';
116
  p2_b   <= (others => 'H');
117
  p1_b   <= (others => 'H');
118
 
119
  ext_ram_b : syn_ram
120
    generic map (
121
      address_width_g => 8
122
    )
123
    port map (
124
      clk_i      => zero_s,
125
      res_i      => res_n_s,
126
      ram_addr_i => ext_ram_addr_s,
127
      ram_data_i => db_b,
128
      ram_we_i   => ext_ram_we_s,
129
      ram_data_o => ext_ram_data_from_s
130
    );
131
 
132
  t8048_b : t8048
133
    port map (
134
      xtal_i    => xtal_s,
135
      reset_n_i => res_n_s,
136
      t0_b      => t0_s,
137
      int_n_i   => int_n_s,
138
      ea_i      => zero_s,
139
      rd_n_o    => rd_n_s,
140
      psen_n_o  => psen_n_s,
141
      wr_n_o    => wr_n_s,
142
      ale_o     => ale_s,
143
      db_b      => db_b,
144
      t1_i      => t1_s,
145
      p2_b      => p2_b,
146
      p1_b      => p1_b,
147
      prog_n_o  => prog_n_s
148
    );
149
 
150
 
151
 
152
  -----------------------------------------------------------------------------
153
  -- External RAM access signals
154
  --
155
  ext_ram: process (wr_n_s,
156
                    ext_ram_addr_s,
157
                    ale_s,
158
                    db_b)
159
--                    clk_s)
160
  begin
161
    if ale_s'event and ale_s = '0' then
162
      if not is_X(db_b) then
163
        ext_ram_addr_s <= db_b;
164
      else
165
        ext_ram_addr_s <= (others => '0');
166
      end if;
167
    end if;
168
 
169
    if wr_n_s'event and wr_n_s = '1' then
170
      ext_ram_we_s <= '1';
171
    end if;
172
 
173
--    if clk_s'event then
174
--      ext_ram_we_s <= '0';
175
--    end if;
176
 
177
  end process ext_ram;
178
  --
179
  -----------------------------------------------------------------------------
180
 
181
  -----------------------------------------------------------------------------
182
  -- The clock generator
183
  --
184
  clk_gen: process
185
  begin
186
    xtal_s <= '0';
187
    wait for period_c/2;
188
    xtal_s <= '1';
189
    wait for period_c/2;
190
  end process clk_gen;
191
  --
192
  -----------------------------------------------------------------------------
193
 
194
 
195
  -----------------------------------------------------------------------------
196
  -- The reset generator
197
  --
198
  res_gen: process
199
  begin
200
    res_n_s <= '0';
201
    wait for 5 * period_c;
202
    res_n_s <= '1';
203
    wait;
204
  end process res_gen;
205
  --
206
  -----------------------------------------------------------------------------
207
 
208
 
209
  -----------------------------------------------------------------------------
210
  -- The interrupt generator
211
  --
212
  int_gen: process
213
  begin
214
    int_n_s <= '1';
215
    wait for 750 * period_c;
216
    int_n_s <= '0';
217
    wait for  45 * period_c;
218
  end process int_gen;
219
  --
220
  -----------------------------------------------------------------------------
221
 
222
 
223
  -----------------------------------------------------------------------------
224
  -- End of simulation detection
225
  --
226
  eos: process
227
  begin
228
 
229
    outer: loop
230
      wait on tb_accu_s;
231
      if tb_accu_s = "10101010" then
232
        wait on tb_accu_s;
233
        if tb_accu_s = "01010101" then
234
          wait on tb_accu_s;
235
          if tb_accu_s = "00000001" then
236
            assert false
237 19 arniml
              report "Simulation Result: PASS."
238 8 arniml
              severity note;
239
          else
240
            assert false
241 19 arniml
              report "Simulation Result: FAIL."
242 8 arniml
              severity note;
243
          end if;
244
 
245
          assert false
246
            report "End of simulation reached."
247
            severity failure;
248
 
249
        end if;
250
      end if;
251
    end loop;
252
 
253
  end process eos;
254
  --
255
  -----------------------------------------------------------------------------
256
 
257
end behav;
258
 
259
 
260
-------------------------------------------------------------------------------
261
-- File History:
262
--
263
-- $Log: not supported by cvs2svn $
264 19 arniml
-- Revision 1.1  2004/03/24 21:42:10  arniml
265
-- initial check-in
266
--
267 8 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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