// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . `timescale 1ns/1ns module cpu_68k( input CLK_68KCLK, input nRESET, input IPL1, IPL0, input nDTACK, output [23:1] M68K_ADDR, inout [15:0] M68K_DATA, output nLDS, nUDS, output nAS, output M68K_RW ); wire [15:0] M68K_DATA_BYTE_MASK; wire [15:0] TG68K_DATAIN; wire [15:0] TG68K_DATAOUT; wire [31:0] TG68K_ADDR; wire [15:0] REG_D6; // DEBUG // TG68K doesn't like byte masking with Z's, replace with 0's: assign M68K_DATA_BYTE_MASK = (~|{nLDS, nUDS}) ? M68K_DATA : (~nLDS) ? {8'h00, M68K_DATA[7:0]} : (~nUDS) ? {M68K_DATA[15:8], 8'h00} : 16'bzzzzzzzzzzzzzzzz; assign M68K_DATA = M68K_RW ? 16'bzzzzzzzzzzzzzzzz : TG68K_DATAOUT; assign TG68K_DATAIN = M68K_RW ? M68K_DATA_BYTE_MASK : 16'bzzzzzzzzzzzzzzzz; assign M68K_ADDR = TG68K_ADDR[23:1]; tg68 TG68K( .clk(CLK_68KCLK), .reset(nRESET), .clkena_in(1'b1), .data_in(TG68K_DATAIN), .IPL({1'b1, IPL1, IPL0}), .dtack(nDTACK), .addr(TG68K_ADDR), .data_out(TG68K_DATAOUT), .as(nAS), .uds(nUDS), .lds(nLDS), .rw(M68K_RW), .REG_D6(REG_D6) ); endmodule