| 1 |
189 |
creep |
////////////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// t2600 IP Core ////
|
| 4 |
|
|
//// ////
|
| 5 |
|
|
//// This file is part of the t2600 project ////
|
| 6 |
|
|
//// http://www.opencores.org/cores/t2600/ ////
|
| 7 |
|
|
//// ////
|
| 8 |
|
|
//// Description ////
|
| 9 |
|
|
//// Bus controller for linking the t6507, t6532 and txxx. TODO ////
|
| 10 |
|
|
//// ////
|
| 11 |
|
|
//// TODO: ////
|
| 12 |
190 |
creep |
//// - Nothing ////
|
| 13 |
189 |
creep |
//// ////
|
| 14 |
|
|
//// Author(s): ////
|
| 15 |
|
|
//// - Gabriel Oshiro Zardo, gabrieloshiro@gmail.com ////
|
| 16 |
|
|
//// - Samuel Nascimento Pagliarini (creep), snpagliarini@gmail.com ////
|
| 17 |
|
|
//// ////
|
| 18 |
|
|
////////////////////////////////////////////////////////////////////////////
|
| 19 |
|
|
//// ////
|
| 20 |
|
|
//// Copyright (C) 2001 Authors and OPENCORES.ORG ////
|
| 21 |
|
|
//// ////
|
| 22 |
|
|
//// This source file may be used and distributed without ////
|
| 23 |
|
|
//// restriction provided that this copyright statement is not ////
|
| 24 |
|
|
//// removed from the file and that any derivative work contains ////
|
| 25 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
| 26 |
|
|
//// ////
|
| 27 |
|
|
//// This source file is free software; you can redistribute it ////
|
| 28 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
| 29 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
| 30 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
| 31 |
|
|
//// later version. ////
|
| 32 |
|
|
//// ////
|
| 33 |
|
|
//// This source is distributed in the hope that it will be ////
|
| 34 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
| 35 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
| 36 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
| 37 |
|
|
//// details. ////
|
| 38 |
|
|
//// ////
|
| 39 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
| 40 |
|
|
//// Public License along with this source; if not, download it ////
|
| 41 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
| 42 |
|
|
//// ////
|
| 43 |
|
|
////////////////////////////////////////////////////////////////////////////
|
| 44 |
|
|
|
| 45 |
|
|
`include "timescale.v"
|
| 46 |
|
|
module t2600_bus(address, data_from_cpu, cpu_rw_mem, riot_data, rom_data, tia_data, address_riot, address_rom, address_tia, data_to_cpu, enable_riot, enable_rom, enable_tia, rw_mem);
|
| 47 |
|
|
parameter [3:0] DATA_SIZE = 4'd8;
|
| 48 |
|
|
parameter [3:0] ADDR_SIZE = 4'd13;
|
| 49 |
|
|
|
| 50 |
|
|
localparam [3:0] DATA_SIZE_ = DATA_SIZE - 4'd1;
|
| 51 |
|
|
localparam [3:0] ADDR_SIZE_ = ADDR_SIZE - 4'd1;
|
| 52 |
|
|
localparam [3:0] RIOT_ADDR_SIZE_ = 4'd6;
|
| 53 |
|
|
localparam [3:0] TIA_ADDR_SIZE_ = 4'd5;
|
| 54 |
|
|
|
| 55 |
|
|
input [ADDR_SIZE_:0] address;
|
| 56 |
|
|
input [DATA_SIZE_:0] data_from_cpu;
|
| 57 |
|
|
input cpu_rw_mem;
|
| 58 |
|
|
inout [DATA_SIZE_:0] riot_data;
|
| 59 |
|
|
inout [DATA_SIZE_:0] rom_data;
|
| 60 |
|
|
inout [DATA_SIZE_:0] tia_data;
|
| 61 |
|
|
output reg [RIOT_ADDR_SIZE_:0] address_riot;
|
| 62 |
|
|
output reg [ADDR_SIZE_:0] address_rom;
|
| 63 |
|
|
output reg [TIA_ADDR_SIZE_:0] address_tia;
|
| 64 |
|
|
output reg[DATA_SIZE_:0] data_to_cpu;
|
| 65 |
|
|
output reg enable_riot;
|
| 66 |
|
|
output reg enable_rom;
|
| 67 |
|
|
output reg enable_tia;
|
| 68 |
|
|
output reg rw_mem;
|
| 69 |
|
|
|
| 70 |
|
|
assign riot_data = (rw_mem) ? data_from_cpu : 8'bZ; // if i am writing the bus receives the data from cpu
|
| 71 |
|
|
assign rom_data = (rw_mem) ? data_from_cpu : 8'bZ; // if i am writing the bus receives the data from cpu
|
| 72 |
|
|
assign tia_data = (rw_mem) ? data_from_cpu : 8'bZ; // if i am writing the bus receives the data from cpu
|
| 73 |
|
|
|
| 74 |
|
|
always @(*) begin
|
| 75 |
|
|
enable_riot = 1'b0;
|
| 76 |
|
|
enable_rom = 1'b0;
|
| 77 |
|
|
enable_tia = 1'b0;
|
| 78 |
|
|
|
| 79 |
|
|
rw_mem = cpu_rw_mem;
|
| 80 |
|
|
address_tia = address[5:0];
|
| 81 |
|
|
address_riot = address[6:0];
|
| 82 |
|
|
address_rom = address;
|
| 83 |
|
|
|
| 84 |
|
|
if (address[12]) begin
|
| 85 |
|
|
data_to_cpu = rom_data;
|
| 86 |
|
|
enable_rom = 1'b1;
|
| 87 |
|
|
end
|
| 88 |
|
|
else if (address[7]) begin
|
| 89 |
|
|
data_to_cpu = riot_data;
|
| 90 |
|
|
enable_riot = 1'b1;
|
| 91 |
|
|
end
|
| 92 |
|
|
else begin
|
| 93 |
|
|
data_to_cpu = tia_data;
|
| 94 |
|
|
enable_tia = 1'b1;
|
| 95 |
|
|
end
|
| 96 |
|
|
end
|
| 97 |
|
|
endmodule
|