2023-02-13 16:49:17 +00:00
|
|
|
/* memory.v - implementation of memory external to the 9086 CPU for testing purposes
|
|
|
|
|
|
|
|
This file is part of the 9086 project.
|
|
|
|
|
|
|
|
Copyright (c) 2023 Efthymios Kritikos
|
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>. */
|
|
|
|
|
2023-02-08 11:57:22 +00:00
|
|
|
module rom(input [19:0] address,output wire [15:0] data ,input rd,input cs);
|
2023-02-11 01:11:37 +00:00
|
|
|
reg [15:0] memory [0:599];
|
2023-02-08 11:57:22 +00:00
|
|
|
initial begin
|
2023-02-11 01:11:37 +00:00
|
|
|
string boot_code;
|
|
|
|
if(!$value$plusargs("BOOT_CODE=%s",boot_code))
|
|
|
|
boot_code="boot_code.txt";
|
|
|
|
$readmemh(boot_code, memory);
|
2023-02-08 11:57:22 +00:00
|
|
|
end
|
|
|
|
assign data = !rd & !cs ? memory[address]: 'hz;
|
|
|
|
endmodule
|