1 |
14 |
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: 650 accumulator register.
|
9 |
|
|
//
|
10 |
|
|
// Additional Comments: See US 2959351, Fig. 64.
|
11 |
|
|
//
|
12 |
|
|
// Copyright (c) 2015 Robert Abeles
|
13 |
|
|
//
|
14 |
|
|
// This source file is free software; you can redistribute it
|
15 |
|
|
// and/or modify it under the terms of the GNU Lesser General
|
16 |
|
|
// Public License as published by the Free Software Foundation;
|
17 |
|
|
// either version 2.1 of the License, or (at your option) any
|
18 |
|
|
// later version.
|
19 |
|
|
//
|
20 |
|
|
// This source is distributed in the hope that it will be
|
21 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
22 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
23 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more
|
24 |
|
|
// details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU Lesser General
|
27 |
|
|
// Public License along with this source; if not, download it
|
28 |
|
|
// from http://www.opencores.org/lgpl.shtml
|
29 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
30 |
|
|
`include "defines.v"
|
31 |
|
|
|
32 |
|
|
module accumulator (
|
33 |
|
|
input rst,
|
34 |
|
|
input ap, bp, dp,
|
35 |
21 |
eightycc |
input dx, d1, d2, d10,
|
36 |
15 |
eightycc |
input dxu, d0u,
|
37 |
14 |
eightycc |
input wu, wl,
|
38 |
21 |
eightycc |
input [0:6] adder_out, console_out,
|
39 |
|
|
input acc_regen_gate, right_shift_gate, acc_ri_gate, acc_ri_console,
|
40 |
|
|
zero_shift_count, man_acc_reset, reset_op,
|
41 |
14 |
eightycc |
input [0:3] early_idx, ontime_idx,
|
42 |
|
|
output reg [0:6] early_out, ontime_out, ped_out
|
43 |
|
|
);
|
44 |
|
|
|
45 |
|
|
//-----------------------------------------------------------------------------
|
46 |
|
|
// The accumulator occupies 22 locations of a 32x7bit RAM.
|
47 |
|
|
//-----------------------------------------------------------------------------
|
48 |
|
|
reg [0:6] digits [0:31];
|
49 |
|
|
|
50 |
21 |
eightycc |
wire [0:4] acc_early_idx = {(d10? ~wu : wu), early_idx};
|
51 |
14 |
eightycc |
wire [0:4] acc_ontime_idx = {wu, ontime_idx};
|
52 |
|
|
|
53 |
|
|
//-----------------------------------------------------------------------------
|
54 |
|
|
// A -- Read into early_out from RAM
|
55 |
|
|
// Read into ontime_out
|
56 |
|
|
//-----------------------------------------------------------------------------
|
57 |
21 |
eightycc |
wire acc_reset = reset_op | man_acc_reset
|
58 |
15 |
eightycc |
| (zero_shift_count & wl & (d1 | d2));
|
59 |
18 |
eightycc |
always @(posedge ap)
|
60 |
14 |
eightycc |
if (rst) begin
|
61 |
|
|
early_out <= `biq_blank;
|
62 |
|
|
ontime_out <= `biq_blank;
|
63 |
|
|
end else begin
|
64 |
21 |
eightycc |
early_out <= reset_op? `biq_0
|
65 |
|
|
: ((wl & d10) | dxu)? early_out
|
66 |
|
|
: digits[acc_early_idx];
|
67 |
14 |
eightycc |
ontime_out <= (acc_reset | d0u | dxu)? `biq_0 : early_out;
|
68 |
18 |
eightycc |
end;
|
69 |
14 |
eightycc |
|
70 |
|
|
//-----------------------------------------------------------------------------
|
71 |
|
|
// B -- Read into ped_out
|
72 |
|
|
//-----------------------------------------------------------------------------
|
73 |
18 |
eightycc |
always @(posedge bp)
|
74 |
14 |
eightycc |
if (rst) begin
|
75 |
|
|
ped_out <= `biq_blank;
|
76 |
|
|
end else begin
|
77 |
21 |
eightycc |
ped_out <= acc_ri_console? console_out
|
78 |
|
|
: right_shift_gate? early_out
|
79 |
14 |
eightycc |
: acc_ri_gate? adder_out
|
80 |
|
|
: acc_regen_gate? ontime_out
|
81 |
|
|
: `biq_blank;
|
82 |
18 |
eightycc |
end;
|
83 |
14 |
eightycc |
|
84 |
|
|
//-----------------------------------------------------------------------------
|
85 |
|
|
// D -- Write ped_out into RAM
|
86 |
|
|
//-----------------------------------------------------------------------------
|
87 |
18 |
eightycc |
always @(posedge dp)
|
88 |
14 |
eightycc |
digits[acc_ontime_idx] <= ped_out;
|
89 |
|
|
|
90 |
|
|
endmodule
|