| 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 |
20 |
eightycc |
input dx, d1, d2,
|
| 36 |
15 |
eightycc |
input dxu, d0u,
|
| 37 |
14 |
eightycc |
input wu, wl,
|
| 38 |
|
|
input [0:6] adder_out,
|
| 39 |
|
|
input acc_regen_gate, right_shift_gate, acc_ri_gate,
|
| 40 |
|
|
zero_shift_count, man_acc_reset, reset_op_latch,
|
| 41 |
|
|
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 |
18 |
eightycc |
wire [0:4] acc_early_idx = {(dx? ~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 |
|
|
wire acc_reset = reset_op_latch | 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 |
|
|
early_out <= reset_op_latch? `biq_0
|
| 65 |
|
|
: digits[acc_early_idx];
|
| 66 |
|
|
ontime_out <= (acc_reset | d0u | dxu)? `biq_0 : early_out;
|
| 67 |
18 |
eightycc |
end;
|
| 68 |
14 |
eightycc |
|
| 69 |
|
|
//-----------------------------------------------------------------------------
|
| 70 |
|
|
// B -- Read into ped_out
|
| 71 |
|
|
//-----------------------------------------------------------------------------
|
| 72 |
18 |
eightycc |
always @(posedge bp)
|
| 73 |
14 |
eightycc |
if (rst) begin
|
| 74 |
|
|
ped_out <= `biq_blank;
|
| 75 |
|
|
end else begin
|
| 76 |
|
|
ped_out <= right_shift_gate? early_out
|
| 77 |
|
|
: acc_ri_gate? adder_out
|
| 78 |
|
|
: acc_regen_gate? ontime_out
|
| 79 |
|
|
: `biq_blank;
|
| 80 |
18 |
eightycc |
end;
|
| 81 |
14 |
eightycc |
|
| 82 |
|
|
//-----------------------------------------------------------------------------
|
| 83 |
|
|
// D -- Write ped_out into RAM
|
| 84 |
|
|
//-----------------------------------------------------------------------------
|
| 85 |
18 |
eightycc |
always @(posedge dp)
|
| 86 |
14 |
eightycc |
digits[acc_ontime_idx] <= ped_out;
|
| 87 |
|
|
|
| 88 |
|
|
endmodule
|