-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathram_controller.v
43 lines (33 loc) · 1.44 KB
/
ram_controller.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
Whirlwind NES - NES compatible FPGA core
Copyright (C) 2020 Anthony Westbrook ([email protected])
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
module ram_controller(
input ram_clk_in,
input ram_read_in,
input ram_write_in,
input [15:0] ram_address_in,
input [7:0] ram_data_in,
output [7:0] ram_data_out,
input [9:0] switches_in,
output reg [15:0] debug_out
);
// IO Addresses
localparam RAM_START = 16'h0000;
localparam RAM_SIZE = 16'h2000;
// Private registers and wires
wire ram_enable;
assign ram_enable = (ram_address_in >= RAM_START) && (ram_address_in < (RAM_START + RAM_SIZE));
ram ram_controller_ram(.address(ram_address_in[10:0]), .clock(ram_clk_in), .data(ram_data_in), .rden(ram_read_in), .wren(ram_enable && ram_write_in), .q(ram_data_out));
endmodule