1 |
9 |
eightycc |
`timescale 1ns / 1ps
|
2 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
3 |
|
|
// IBM 650 Reconstruction in Verilog (i650)
|
4 |
|
|
//
|
5 |
|
|
// This file is part of the IBM 650 Reconstruction in Verilog (i650) project
|
6 |
|
|
// http:////www.opencores.org/project,i650
|
7 |
|
|
//
|
8 |
|
|
// Description: General storage.
|
9 |
|
|
//
|
10 |
|
|
// Additional Comments: Drum storage is implemented as an array of 24000 5-bit
|
11 |
|
|
// digits. An array address is formed by decoding the static portion of the
|
12 |
|
|
// bi-quinary address into an origin (a multiple of 600), then adding the
|
13 |
|
|
// dynamic portion of the address (range 0..599).
|
14 |
|
|
//
|
15 |
|
|
// Copyright (c) 2015 Robert Abeles
|
16 |
|
|
//
|
17 |
|
|
// This source file is free software; you can redistribute it
|
18 |
|
|
// and/or modify it under the terms of the GNU Lesser General
|
19 |
|
|
// Public License as published by the Free Software Foundation;
|
20 |
|
|
// either version 2.1 of the License, or (at your option) any
|
21 |
|
|
// later version.
|
22 |
|
|
//
|
23 |
|
|
// This source is distributed in the hope that it will be
|
24 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
25 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
26 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more
|
27 |
|
|
// details.
|
28 |
|
|
//
|
29 |
|
|
// You should have received a copy of the GNU Lesser General
|
30 |
|
|
// Public License along with this source; if not, download it
|
31 |
|
|
// from http://www.opencores.org/lgpl.shtml
|
32 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
33 |
|
|
`include "defines.v"
|
34 |
|
|
|
35 |
|
|
module gen_store (
|
36 |
|
|
input rst,
|
37 |
|
|
input ap, dp,
|
38 |
|
|
input write_gate,
|
39 |
|
|
input [0:6] addr_th, addr_h, addr_t,
|
40 |
|
|
input [0:9] dynamic_addr,
|
41 |
|
|
input [0:4] gs_in,
|
42 |
|
|
input [0:14] console_ram_addr,
|
43 |
|
|
input console_read_gs, console_write_gs,
|
44 |
|
|
output reg[0:4] gs_out,
|
45 |
|
|
output double_write, no_write
|
46 |
|
|
);
|
47 |
|
|
|
48 |
|
|
reg [0:4] gs_mem [0:32767]; // Rounded size up from 24000 to next 2^n.
|
49 |
|
|
|
50 |
|
|
//-----------------------------------------------------------------------------
|
51 |
|
|
//
|
52 |
|
|
//-----------------------------------------------------------------------------
|
53 |
|
|
wire [0:14] band_addr, gs_addr, gs_addr_early;
|
54 |
|
|
ram_band_addr rba(addr_th, addr_h, addr_t, band_addr);
|
55 |
|
|
wire console_access = console_read_gs | console_write_gs;
|
56 |
|
|
assign gs_addr = console_access? console_ram_addr : (band_addr + dynamic_addr);
|
57 |
|
|
assign gs_addr_early = (band_addr + ((dynamic_addr + 1) % 600)) % 32768;
|
58 |
|
|
|
59 |
|
|
assign double_write = 0;
|
60 |
|
|
assign no_write = 0;
|
61 |
|
|
|
62 |
|
|
always @(posedge ap) begin
|
63 |
|
|
if (rst) begin
|
64 |
|
|
gs_out <= `biq_blank;
|
65 |
|
|
end else begin
|
66 |
|
|
gs_out <= gs_mem[gs_addr];
|
67 |
|
|
end
|
68 |
|
|
end;
|
69 |
|
|
|
70 |
|
|
always @(posedge dp) begin
|
71 |
|
|
if (write_gate)
|
72 |
|
|
gs_mem[gs_addr_early] <= gs_in;
|
73 |
|
|
end;
|
74 |
|
|
|
75 |
|
|
endmodule
|