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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_6_beta/] [bench/] [vhdl/] [tb_t8048.vhd] - Blame information for rev 292

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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