Have a full cycle to load playfield and char data
[AtosmChip.git] / antic_tb.v
blob5430e11e2ed1b27289d398064d4f729eecbd24d2
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 antic_tb();
22 wire clk;
23 wire clk2;
25 reg rst_o;
27 initial begin
28 $readmemh("os/atarios.memh", u_atari.u_rom.memory);
29 $readmemh("tests/antic_test.memh", u_atari.u_rom.memory, 'h3000);
31 $monitor("%h %h l%b s%b %b %b v=%h adro=%h ir=%h d=%h dlptr=%h memsc=%h max=%h out=%b",
32 u_atari.u_antic.shift_reg_out,
33 u_atari.u_antic.u_shift_reg.in,
34 u_atari.u_antic.u_shift_reg.load,
35 u_atari.u_antic.u_shift_reg.shift,
36 u_atari.u_antic.load_char,
37 u_atari.u_antic.char_block,
38 u_atari.u_antic.vcount,
39 u_atari.u_antic.adr_o,
40 u_atari.u_antic.ir,
41 u_atari.u_antic.dcount,
42 u_atari.u_antic.dlist_ctr,
43 u_atari.u_antic.memscan_ctr,
44 u_atari.u_antic.maxline,
45 u_atari.u_antic.out_reg);
47 //$monitor("%b %b %b %b",
48 // u_atari.u_antic.dma_instr_en,
49 // u_atari.u_antic.new_block,
50 // u_atari.u_antic.vblank,
51 // u_atari.u_antic.wait_vblank);
53 rst_o = 0;
54 #5 rst_o = 1;
55 #40 rst_o = 0;
56 #200_000_0;
57 $finish;
58 end
60 always @ (posedge clk) begin
61 if (u_atari.adr >= 'hd000 && u_atari.adr < 'hd800) begin
62 if (u_atari.we)
63 $display("hardware write %h = %h at %h",
64 u_atari.adr, u_atari.masterdat_o, u_atari.u_cpu.pc);
65 else
66 $display("hardware read %h = %h at %h",
67 u_atari.adr, u_atari.slavedat_o, u_atari.u_cpu.pc);
68 end
69 end
71 always @ (posedge u_atari.vsync)
72 $finishframe;
74 always @ (posedge u_atari.hsync)
75 $finishline;
77 always @ (posedge clk2 or negedge clk2)
78 $outpixel(u_atari.color);
80 clkgen u_clkgen(.clk_o(clk), .clk2_o(clk2));
81 atari u_atari(.clk_i(clk), .clk2_i(clk2), .rst_i(rst_o));
82 endmodule