1 |
20 |
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: Distributor register.
|
9 |
|
|
//
|
10 |
|
|
// Additional Comments: See US 2959351, Fig. 61.
|
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 distributor (
|
33 |
|
|
input rst,
|
34 |
|
|
input ap, cp, dp,
|
35 |
|
|
input dx, d0, d10,
|
36 |
|
|
input [0:6] selected_storage,
|
37 |
|
|
input ri_dist, // commutator 81f, dx:bp
|
38 |
|
|
input [0:6] acc_ontime,
|
39 |
|
|
input start_acc_dist_ri, end_acc_dist_ri, acc_dist_ri,
|
40 |
|
|
input man_acc_reset,
|
41 |
|
|
input [0:3] early_idx, ontime_idx,
|
42 |
|
|
|
43 |
|
|
output reg[0:6] ontime_out, early_out,
|
44 |
|
|
output dist_back_sig
|
45 |
|
|
);
|
46 |
|
|
|
47 |
|
|
reg [0:6] digits [0:15];
|
48 |
|
|
reg ri_dist_from_stor, dist_regen_ctl, ri_from_acc, ri_from_acc_delay;
|
49 |
|
|
|
50 |
|
|
//-----------------------------------------------------------------------------
|
51 |
|
|
// A -- Read digits RAM, write early and ontime outs
|
52 |
|
|
//-----------------------------------------------------------------------------
|
53 |
|
|
always @(posedge ap)
|
54 |
|
|
if (rst) begin
|
55 |
|
|
early_out <= `biq_blank;
|
56 |
|
|
ontime_out <= `biq_blank;
|
57 |
|
|
end else begin
|
58 |
|
|
early_out <= (dist_regen_ctl | d10)? `biq_blank : digits[early_idx];
|
59 |
|
|
ontime_out <= dx? `biq_0
|
60 |
|
|
: man_acc_reset? (d0? `biq_plus : `biq_0)
|
61 |
|
|
: early_out;
|
62 |
|
|
end;
|
63 |
|
|
|
64 |
|
|
//-----------------------------------------------------------------------------
|
65 |
|
|
// C
|
66 |
|
|
//-----------------------------------------------------------------------------
|
67 |
|
|
always @(posedge cp)
|
68 |
|
|
if (rst) begin
|
69 |
|
|
ri_dist_from_stor <= 0;
|
70 |
|
|
dist_regen_ctl <= 0;
|
71 |
|
|
ri_from_acc <= 0;
|
72 |
|
|
ri_from_acc_delay <= 0;
|
73 |
|
|
end else begin
|
74 |
|
|
if (d10) begin
|
75 |
|
|
ri_dist_from_stor <= 0;
|
76 |
|
|
end else if (ri_dist) begin
|
77 |
|
|
ri_dist_from_stor <= 1;
|
78 |
|
|
end
|
79 |
|
|
|
80 |
|
|
if (d10 | end_acc_dist_ri) begin
|
81 |
|
|
dist_regen_ctl <= 0;
|
82 |
|
|
end else if (ri_dist | start_acc_dist_ri) begin
|
83 |
|
|
dist_regen_ctl <= 1;
|
84 |
|
|
end
|
85 |
|
|
|
86 |
|
|
if (acc_dist_ri) begin
|
87 |
|
|
ri_from_acc_delay <= 1;
|
88 |
|
|
end else if (ri_from_acc_delay) begin
|
89 |
|
|
ri_from_acc_delay <= 0;
|
90 |
|
|
ri_from_acc <= 1;
|
91 |
|
|
end else begin
|
92 |
|
|
ri_from_acc <= 0;
|
93 |
|
|
end
|
94 |
|
|
end;
|
95 |
|
|
|
96 |
|
|
//-----------------------------------------------------------------------------
|
97 |
|
|
// D
|
98 |
|
|
//-----------------------------------------------------------------------------
|
99 |
|
|
always @(posedge dp)
|
100 |
|
|
digits[ontime_idx] <= ri_dist_from_stor? selected_storage
|
101 |
|
|
: ri_from_acc? acc_ontime
|
102 |
|
|
: ontime_out;
|
103 |
|
|
digit_pulse bk_sig (rst, dp, ~dist_regen_ctl, 1'b1, dist_back_sig);
|
104 |
|
|
|
105 |
|
|
endmodule
|