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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_2/] [bench/] [vhdl/] [tb_t8048.vhd] - Blame information for rev 228

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 228 arniml
-- $Id: tb_t8048.vhd,v 1.5 2006-06-21 01:04:05 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 228 arniml
use work.t48_core_comp_pack.generic_ram_ena;
54 8 arniml
 
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 p1_b : std_logic_vector( 7 downto 0);
95
  signal p2_b : std_logic_vector( 7 downto 0);
96
 
97
  signal db_b                : std_logic_vector( 7 downto 0);
98
  signal ext_ram_addr_s      : std_logic_vector( 7 downto 0);
99
  signal ext_ram_data_from_s : std_logic_vector( 7 downto 0);
100
  signal ext_ram_we_s        : std_logic;
101
  signal rd_n_s              : std_logic;
102
  signal wr_n_s              : std_logic;
103
 
104
  signal zero_s          : std_logic;
105
  signal one_s           : std_logic;
106
 
107
begin
108
 
109
  zero_s <= '0';
110
  one_s  <= '1';
111
 
112
  p2_b   <= (others => 'H');
113
  p1_b   <= (others => 'H');
114
 
115 228 arniml
  ext_ram_b : generic_ram_ena
116 8 arniml
    generic map (
117 228 arniml
      addr_width_g => 8,
118
      data_width_g => 8
119 8 arniml
    )
120
    port map (
121 228 arniml
      clk_i => zero_s,
122
      a_i   => ext_ram_addr_s,
123
      we_i  => ext_ram_we_s,
124
      ena_i => one_s,
125
      d_i   => db_b,
126
      d_o   => ext_ram_data_from_s
127 8 arniml
    );
128
 
129
  t8048_b : t8048
130
    port map (
131
      xtal_i    => xtal_s,
132
      reset_n_i => res_n_s,
133 68 arniml
      t0_b      => p1_b(0),
134 8 arniml
      int_n_i   => int_n_s,
135
      ea_i      => zero_s,
136
      rd_n_o    => rd_n_s,
137
      psen_n_o  => psen_n_s,
138
      wr_n_o    => wr_n_s,
139
      ale_o     => ale_s,
140
      db_b      => db_b,
141 68 arniml
      t1_i      => p1_b(1),
142 8 arniml
      p2_b      => p2_b,
143
      p1_b      => p1_b,
144
      prog_n_o  => prog_n_s
145
    );
146
 
147
 
148
 
149
  -----------------------------------------------------------------------------
150
  -- External RAM access signals
151
  --
152
  ext_ram: process (wr_n_s,
153
                    ale_s,
154
                    db_b)
155
  begin
156
    if ale_s'event and ale_s = '0' then
157
      if not is_X(db_b) then
158
        ext_ram_addr_s <= db_b;
159
      else
160
        ext_ram_addr_s <= (others => '0');
161
      end if;
162
    end if;
163
 
164
    if wr_n_s'event and wr_n_s = '1' then
165
      ext_ram_we_s <= '1';
166
    end if;
167
 
168
--    if clk_s'event then
169
--      ext_ram_we_s <= '0';
170
--    end if;
171
 
172
  end process ext_ram;
173
  --
174
  -----------------------------------------------------------------------------
175
 
176
  -----------------------------------------------------------------------------
177
  -- The clock generator
178
  --
179
  clk_gen: process
180
  begin
181
    xtal_s <= '0';
182
    wait for period_c/2;
183
    xtal_s <= '1';
184
    wait for period_c/2;
185
  end process clk_gen;
186
  --
187
  -----------------------------------------------------------------------------
188
 
189
 
190
  -----------------------------------------------------------------------------
191
  -- The reset generator
192
  --
193
  res_gen: process
194
  begin
195
    res_n_s <= '0';
196
    wait for 5 * period_c;
197
    res_n_s <= '1';
198
    wait;
199
  end process res_gen;
200
  --
201
  -----------------------------------------------------------------------------
202
 
203
 
204
  -----------------------------------------------------------------------------
205
  -- The interrupt generator
206
  --
207
  int_gen: process
208
  begin
209
    int_n_s <= '1';
210
    wait for 750 * period_c;
211
    int_n_s <= '0';
212
    wait for  45 * period_c;
213
  end process int_gen;
214
  --
215
  -----------------------------------------------------------------------------
216
 
217
 
218
  -----------------------------------------------------------------------------
219
  -- End of simulation detection
220
  --
221
  eos: process
222
  begin
223
 
224
    outer: loop
225
      wait on tb_accu_s;
226
      if tb_accu_s = "10101010" then
227
        wait on tb_accu_s;
228
        if tb_accu_s = "01010101" then
229
          wait on tb_accu_s;
230
          if tb_accu_s = "00000001" then
231 56 arniml
            -- wait for instruction strobe of this move
232
            wait until tb_istrobe_s'event and tb_istrobe_s = '1';
233
            -- wait for next strobe
234
            wait until tb_istrobe_s'event and tb_istrobe_s = '1';
235 8 arniml
            assert false
236 19 arniml
              report "Simulation Result: PASS."
237 8 arniml
              severity note;
238
          else
239
            assert false
240 19 arniml
              report "Simulation Result: FAIL."
241 8 arniml
              severity note;
242
          end if;
243
 
244
          assert false
245
            report "End of simulation reached."
246
            severity failure;
247
 
248
        end if;
249
      end if;
250
    end loop;
251
 
252
  end process eos;
253
  --
254
  -----------------------------------------------------------------------------
255
 
256
end behav;
257
 
258
 
259
-------------------------------------------------------------------------------
260
-- File History:
261
--
262
-- $Log: not supported by cvs2svn $
263 228 arniml
-- Revision 1.4  2004/04/18 19:00:58  arniml
264
-- connect T0 and T1 to P1
265
--
266 68 arniml
-- Revision 1.3  2004/04/14 20:57:44  arniml
267
-- wait for instruction strobe after final end-of-simulation detection
268
-- this ensures that the last mov instruction is part of the dump and
269
-- enables 100% matching with i8039 simulator
270
--
271 56 arniml
-- Revision 1.2  2004/03/26 22:39:28  arniml
272
-- enhance simulation result string
273
--
274 19 arniml
-- Revision 1.1  2004/03/24 21:42:10  arniml
275
-- initial check-in
276
--
277 8 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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