OpenCores
URL https://opencores.org/ocsvn/i650/i650/trunk

Subversion Repositories i650

[/] [i650/] [trunk/] [rtl/] [gen_store.v] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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 10 eightycc
//  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 9 eightycc
//
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 10 eightycc
   input rst,
37
   input ap, dp,
38 9 eightycc
   input write_gate,
39 10 eightycc
   input [0:6] addr_th, addr_h, addr_t,
40
   input [0:9] dynamic_addr,
41 9 eightycc
   input [0:4] gs_in,
42 10 eightycc
   input [0:14] console_ram_addr,
43
   input console_read_gs, console_write_gs,
44 9 eightycc
   output reg[0:4] gs_out,
45
   output double_write, no_write
46
   );
47
 
48 10 eightycc
   reg [0:4] gs_mem [0:32767];   // Rounded size up from 24000 to next 2^n. 
49
 
50 9 eightycc
   //-----------------------------------------------------------------------------
51 12 eightycc
   // Calculate the early (next digit) and on-time RAM addresses. Console read
52
   // and write are implementation extensions.
53 9 eightycc
   //-----------------------------------------------------------------------------
54 10 eightycc
   wire [0:14] band_addr, gs_addr, gs_addr_early;
55
   ram_band_addr rba(addr_th, addr_h, addr_t, band_addr);
56 11 eightycc
   wire console_acc = console_read_gs | console_write_gs;
57
   assign gs_addr = console_acc? console_ram_addr : (band_addr + dynamic_addr);
58 12 eightycc
   // The % operator fixes a spurious warning from XST synthesis due to use of a
59
   // 32-bit mux for ? operator. Uses no gates. 
60
   assign gs_addr_early = (console_acc? console_ram_addr
61
                        : (band_addr + ((dynamic_addr + 1) % 600))) % 32768;
62 10 eightycc
 
63 12 eightycc
   //-----------------------------------------------------------------------------
64
   // These 650 write errors are not possible for this implementation.
65
   //-----------------------------------------------------------------------------
66 10 eightycc
   assign double_write = 0;
67
   assign no_write = 0;
68
 
69 12 eightycc
   //-----------------------------------------------------------------------------
70
   // A : Read from RAM at on-time address.
71
   //-----------------------------------------------------------------------------
72 20 eightycc
   always @(posedge ap)
73 10 eightycc
      if (rst) begin
74
         gs_out <= `biq_blank;
75
      end else begin
76
         gs_out <= gs_mem[gs_addr];
77 20 eightycc
      end;
78 10 eightycc
 
79 12 eightycc
   //-----------------------------------------------------------------------------
80
   // D : Write to RAM at early address.
81
   //-----------------------------------------------------------------------------
82 20 eightycc
   always @(posedge dp)
83 10 eightycc
      if (write_gate)
84
         gs_mem[gs_addr_early] <= gs_in;
85
 
86 9 eightycc
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.