2 // Copyright (C) 2008 Tomasz Malesinski <tmal@mimuw.edu.pl>
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.
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
20 module atosm(rst_i
, clk_i
,
21 atari_clk_i
, atari_clk2_i
);
22 input rst_i
, clk_i
, atari_clk_i
, atari_clk2_i
;
24 wire rst_i
, clk_i
, atari_clk_i
, atari_clk2_i
;
28 wire [7:0] masterdat_o
;
41 // Outputs from address decoder.
42 reg ramsel
, romsel
, atarisel
;
45 // Slaves STB_I signals.
46 wire ramstb
, romstb
, ataristb
;
49 // Slaves DAT_O signals.
50 wire [7:0] ramdat_o
, romdat_o
, ataridat_o
;
52 // Slaves ACK_O signals.
53 wire ramack_o
, romack_o
, atariack_o
;
55 // Masters ACK_I signals.
60 assign masterdat_o
= cpudat_o
;
61 assign adr
= cpuadr_o
;
63 assign stb
= cpustb_o
;
65 assign cyc
= cpucyc_o
;
75 else if (adr
[15:8] == 8'h80
)
77 else if (adr
[15:14] == 2'b11)
84 assign ramstb
= ramsel
& cyc
& stb
;
85 assign romstb
= romsel
& cyc
& stb
;
86 assign ataristb
= atarisel
& cyc
& stb
;
87 assign dummystb
= dummysel
& cyc
& stb
;
89 assign ack
= ramack_o | romack_o | atariack_o | dummystb
;
91 assign cpuack_i
= ack
;
94 always @ (ramsel
or ramdat_o
or
96 atarisel
or ataridat_o
)
98 slavedat_o
= ramdat_o
;
100 slavedat_o
= romdat_o
;
102 slavedat_o
= ataridat_o
;
109 defparam u_ram.size
= 'h8000
;
110 defparam u_ram.adrbits
= 15;
112 ram
u_ram(.
clk_i(clk_i
),
121 defparam u_rom.size
= 'h4000
;
122 defparam u_rom.adrbits
= 14;
124 rom
u_rom(.
clk_i(clk_i
),
131 cpu6502
u_cpu(.
clk_i(clk_i
),
143 atari
u_atari(.
clk_i(atari_clk_i
),
144 .
clk2_i(atari_clk2_i
),
148 .
ext_adr_i(adr
[3:0]),
149 .
ext_dat_i(masterdat_o
),
150 .
ext_dat_o(ataridat_o
),
152 .
ext_stb_i(ataristb
),
153 .
ext_ack_o(atariack_o
));