Initial (dummy) arbiter.
[AtosmChip.git] / atari_tb.v
blob910c64ad5afcbd9e2fca3a699cf847fc5080dc22
1 // Atosm Chip
2 // Copyright (C) 2008 Tomasz Malesinski <tmal@mimuw.edu.pl>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 `include "clock.v"
19 `include "atari.v"
21 module atari_tb();
22 wire clk;
23 wire clk2;
25 reg rst_o;
27 parameter monitor = 0;
29 initial begin
30 $readmemh("os/atarios.memh", u_atari.u_rom.memory);
31 if (monitor)
32 $monitor("%g\t pc=%h a=%h x=%h y=%h f=%b s=%h",
33 $time,
34 u_atari.u_cpu.pc,
35 u_atari.u_cpu.acc,
36 u_atari.u_cpu.regx,
37 u_atari.u_cpu.regy,
38 u_atari.u_cpu.regf,
39 u_atari.u_cpu.regs);
41 rst_o = 0;
42 #5 rst_o = 1;
43 #40 rst_o = 0;
44 #2_000_000_0;
45 $writememh("ram.memh", u_atari.u_ram.memory);
46 $finish;
47 end
49 always @ (posedge clk) begin
50 if (u_atari.adr >= 'hd000 && u_atari.adr < 'hd800) begin
51 if (u_atari.we)
52 $display("hardware write %h = %h at %h",
53 u_atari.adr, u_atari.slavedat_o, u_atari.u_cpu.pc);
54 else
55 $display("hardware read %h = %h at %h",
56 u_atari.adr, u_atari.masterdat_o, u_atari.u_cpu.pc);
57 end
58 end
60 clkgen u_clkgen(.clk_o(clk), .clk2_o(clk2));
61 atari u_atari(.clk_i(clk), .clk2_i(clk2), .rst_i(rst_o));
62 endmodule