`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
// IBM 650 Reconstruction in Verilog (i650)
|
// IBM 650 Reconstruction in Verilog (i650)
|
//
|
//
|
// This file is part of the IBM 650 Reconstruction in Verilog (i650) project
|
// This file is part of the IBM 650 Reconstruction in Verilog (i650) project
|
// http:////www.opencores.org/project,i650
|
// http:////www.opencores.org/project,i650
|
//
|
//
|
// Description: 650 accumulator register.
|
// Description: 650 accumulator register.
|
//
|
//
|
// Additional Comments: See US 2959351, Fig. 64.
|
// Additional Comments: See US 2959351, Fig. 64.
|
//
|
//
|
// Copyright (c) 2015 Robert Abeles
|
// Copyright (c) 2015 Robert Abeles
|
//
|
//
|
// This source file is free software; you can redistribute it
|
// This source file is free software; you can redistribute it
|
// and/or modify it under the terms of the GNU Lesser General
|
// and/or modify it under the terms of the GNU Lesser General
|
// Public License as published by the Free Software Foundation;
|
// Public License as published by the Free Software Foundation;
|
// either version 2.1 of the License, or (at your option) any
|
// either version 2.1 of the License, or (at your option) any
|
// later version.
|
// later version.
|
//
|
//
|
// This source is distributed in the hope that it will be
|
// This source is distributed in the hope that it will be
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
// PURPOSE. See the GNU Lesser General Public License for more
|
// PURPOSE. See the GNU Lesser General Public License for more
|
// details.
|
// details.
|
//
|
//
|
// You should have received a copy of the GNU Lesser General
|
// You should have received a copy of the GNU Lesser General
|
// Public License along with this source; if not, download it
|
// Public License along with this source; if not, download it
|
// from http://www.opencores.org/lgpl.shtml
|
// from http://www.opencores.org/lgpl.shtml
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
`include "defines.v"
|
`include "defines.v"
|
|
|
module accumulator (
|
module accumulator (
|
input rst,
|
input rst,
|
input ap, bp, dp,
|
input ap, bp, dp,
|
input dx, d1, d2,
|
input dx, d1, d2, d10,
|
input dxu, d0u,
|
input dxu, d0u,
|
input wu, wl,
|
input wu, wl,
|
input [0:6] adder_out,
|
input [0:6] adder_out, console_out,
|
input acc_regen_gate, right_shift_gate, acc_ri_gate,
|
input acc_regen_gate, right_shift_gate, acc_ri_gate, acc_ri_console,
|
zero_shift_count, man_acc_reset, reset_op_latch,
|
zero_shift_count, man_acc_reset, reset_op,
|
input [0:3] early_idx, ontime_idx,
|
input [0:3] early_idx, ontime_idx,
|
output reg [0:6] early_out, ontime_out, ped_out
|
output reg [0:6] early_out, ontime_out, ped_out
|
);
|
);
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
// The accumulator occupies 22 locations of a 32x7bit RAM.
|
// The accumulator occupies 22 locations of a 32x7bit RAM.
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
reg [0:6] digits [0:31];
|
reg [0:6] digits [0:31];
|
|
|
wire [0:4] acc_early_idx = {(dx? ~wu : wu), early_idx};
|
wire [0:4] acc_early_idx = {(d10? ~wu : wu), early_idx};
|
wire [0:4] acc_ontime_idx = {wu, ontime_idx};
|
wire [0:4] acc_ontime_idx = {wu, ontime_idx};
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
// A -- Read into early_out from RAM
|
// A -- Read into early_out from RAM
|
// Read into ontime_out
|
// Read into ontime_out
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
wire acc_reset = reset_op_latch | man_acc_reset
|
wire acc_reset = reset_op | man_acc_reset
|
| (zero_shift_count & wl & (d1 | d2));
|
| (zero_shift_count & wl & (d1 | d2));
|
always @(posedge ap)
|
always @(posedge ap)
|
if (rst) begin
|
if (rst) begin
|
early_out <= `biq_blank;
|
early_out <= `biq_blank;
|
ontime_out <= `biq_blank;
|
ontime_out <= `biq_blank;
|
end else begin
|
end else begin
|
early_out <= reset_op_latch? `biq_0
|
early_out <= reset_op? `biq_0
|
|
: ((wl & d10) | dxu)? early_out
|
: digits[acc_early_idx];
|
: digits[acc_early_idx];
|
ontime_out <= (acc_reset | d0u | dxu)? `biq_0 : early_out;
|
ontime_out <= (acc_reset | d0u | dxu)? `biq_0 : early_out;
|
end;
|
end;
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
// B -- Read into ped_out
|
// B -- Read into ped_out
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
always @(posedge bp)
|
always @(posedge bp)
|
if (rst) begin
|
if (rst) begin
|
ped_out <= `biq_blank;
|
ped_out <= `biq_blank;
|
end else begin
|
end else begin
|
ped_out <= right_shift_gate? early_out
|
ped_out <= acc_ri_console? console_out
|
|
: right_shift_gate? early_out
|
: acc_ri_gate? adder_out
|
: acc_ri_gate? adder_out
|
: acc_regen_gate? ontime_out
|
: acc_regen_gate? ontime_out
|
: `biq_blank;
|
: `biq_blank;
|
end;
|
end;
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
// D -- Write ped_out into RAM
|
// D -- Write ped_out into RAM
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
always @(posedge dp)
|
always @(posedge dp)
|
digits[acc_ontime_idx] <= ped_out;
|
digits[acc_ontime_idx] <= ped_out;
|
|
|
endmodule
|
endmodule
|
|
|