1 |
24 |
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 |
26 |
eightycc |
// Description: Table look-up.
|
9 |
24 |
eightycc |
//
|
10 |
|
|
// Additional Comments: See US 2959351, Fig. 86.
|
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 |
26 |
eightycc |
module tlu (
|
33 |
24 |
eightycc |
input rst,
|
34 |
25 |
eightycc |
input ap, bp,
|
35 |
|
|
input dx, d0, d4, d5, d10,
|
36 |
|
|
input dxl, d0l, d10u,
|
37 |
|
|
input w0, w1, w2, w3, w4, w5, w6, w7, w8, w9,
|
38 |
|
|
input wl, wu,
|
39 |
|
|
input s0, s1, s2, s3, s4,
|
40 |
|
|
|
41 |
|
|
input tlu_sig,
|
42 |
|
|
input upper_sig, lower_sig, divide_on, mult_nozero_edxl,
|
43 |
|
|
input carry_test_latch, tlu_or_acc_zero_check,
|
44 |
|
|
input man_acc_reset, reset_sig, no_reset_sig,
|
45 |
|
|
input acc_minus_sign, compl_adj, quot_digit_on,
|
46 |
|
|
input dist_compl_add,
|
47 |
|
|
input any_left_shift_on, right_shift_on, left_shift_on, mult_div_left_shift,
|
48 |
|
|
input sig_digit_on, hc_add_5, mult_on, acc_true_add_gate,
|
49 |
|
|
|
50 |
|
|
output tlu_on, early_dist_zero_entry, early_dist_zero_control,
|
51 |
27 |
eightycc |
output reg prog_to_acc_add, prog_add,
|
52 |
25 |
eightycc |
output prog_add_d0,
|
53 |
|
|
output prog_ped_regen,
|
54 |
|
|
output [0:9] special_digit,
|
55 |
27 |
eightycc |
output tlu_band_change, dist_blank_gate, sel_stor_add_gate,
|
56 |
|
|
ontime_dist_add_gate, upper_lower_check
|
57 |
24 |
eightycc |
);
|
58 |
|
|
|
59 |
25 |
eightycc |
//-----------------------------------------------------------------------------
|
60 |
|
|
// Distributor zero entry and control gates
|
61 |
|
|
//
|
62 |
|
|
// On operations such as add or subtract lower, add or subtract upper,
|
63 |
|
|
// multiply, divide, etc., the entire two words of the accumulator enter the
|
64 |
|
|
// adder via adder entry A. The contents of the distributor enters adder entry
|
65 |
|
|
// B, in place of the distributor early outputs, during the time that the upper
|
66 |
|
|
// word is entering the adder. On an add lower operation, zeroes must be
|
67 |
|
|
// substituted for the distributor values during upper word time.
|
68 |
|
|
//
|
69 |
|
|
// This is accomplised by the early distributor zero control gate and the early
|
70 |
|
|
// distributor zero entry gate. The zero control gate blocks the early
|
71 |
|
|
// distributor outputs and the zero entry gate raises the B0-Q0 lines to allow
|
72 |
|
|
// a true or complement zero entry to adder entry B.
|
73 |
|
|
//
|
74 |
|
|
// These gates are developed by switch-mix circuitry under control of the upper
|
75 |
|
|
// and lower word control latches 926 and 927 (Fig. 86a). These latches are
|
76 |
|
|
// turned on at the beginning of a lower word interval by an upper, lower,
|
77 |
|
|
// divide or multiply signal from the Op. code analysis circuits or by a TLU
|
78 |
|
|
// signal (ed. via prog_acc_add latch). They remain on until the next DXL.
|
79 |
24 |
eightycc |
// While on, their outputs switch with upper word or lower word timing gates as
|
80 |
25 |
eightycc |
// shown in Figs. 86a, 86b, 86c and 86d to provide the zero control and zero
|
81 |
|
|
// entry gates.
|
82 |
|
|
//
|
83 |
|
|
// A parallel circuit develops these gates for each D10 interval. This supplies
|
84 |
|
|
// a zero to fill the gap created by the missing DX position of the distributor
|
85 |
|
|
// (if there were a DX position it would be read out at D10 time).
|
86 |
|
|
//
|
87 |
|
|
// Another parallel circuit develops these gates for each DX interval to
|
88 |
|
|
// substitute a zero early output in place of the sign indication (8 or 9)
|
89 |
|
|
// contained in the D0 position for entry to the adder. The sign is only used
|
90 |
|
|
// when the distributor word is sent to general storage or displayed.
|
91 |
|
|
//-----------------------------------------------------------------------------
|
92 |
|
|
reg upper_control, lower_control;
|
93 |
|
|
assign early_dist_zero_entry = (lower_control & wu) | (upper_control & wl)
|
94 |
|
|
| dx | d10;
|
95 |
|
|
assign early_dist_zero_control = ~((lower_control & wu) | (upper_control & wl)
|
96 |
|
|
| dx | d10);
|
97 |
|
|
|
98 |
|
|
always @(posedge ap)
|
99 |
|
|
if (rst) begin
|
100 |
|
|
upper_control <= 0;
|
101 |
|
|
lower_control <= 0;
|
102 |
|
|
end else if (dxl) begin // in lieu of wpl
|
103 |
|
|
upper_control <= 0;
|
104 |
|
|
lower_control <= 0;
|
105 |
|
|
end else begin
|
106 |
|
|
if (upper_sig | divide_on)
|
107 |
|
|
upper_control <= 1;
|
108 |
|
|
if (lower_sig | mult_nozero_edxl | prog_to_acc_add)
|
109 |
|
|
lower_control <= 1;
|
110 |
|
|
end;
|
111 |
|
|
|
112 |
|
|
//-----------------------------------------------------------------------------
|
113 |
|
|
// Program to accumulator control latch
|
114 |
|
|
//
|
115 |
|
|
// [125:10] Program to accumulator control latch 1195 (Fig. 86d). On when TLU
|
116 |
|
|
// carry latch goes off at end of address adjustment cycle. Off next NWPU. When
|
117 |
|
|
// on, causes entry of the program register contents to adder A during a lower
|
118 |
|
|
// word interval; the entry of a special digit zeros to adder B to merge with
|
119 |
|
|
// the program register values and the development of a distributor blanking
|
120 |
|
|
// gate; the entry of the D5 through D8 adder outputs into the corresponding
|
121 |
|
|
// lower accumulator positions and the entry of all adder outputs back into the
|
122 |
|
|
// program register.
|
123 |
|
|
//-----------------------------------------------------------------------------
|
124 |
|
|
always @(posedge ap)
|
125 |
|
|
if (rst) begin
|
126 |
|
|
prog_to_acc_add <= 0;
|
127 |
|
|
end else if (dx & wu) begin
|
128 |
|
|
prog_to_acc_add <= 0;
|
129 |
|
|
end else if (tlu_carry_off_sig) begin
|
130 |
|
|
prog_to_acc_add <= 1;
|
131 |
|
|
end;
|
132 |
|
|
|
133 |
|
|
//-----------------------------------------------------------------------------
|
134 |
|
|
// TLU program add latch
|
135 |
|
|
//
|
136 |
|
|
// [124:65] TLU program add latch 1037 (Fig. 86b). On, DX and TLU band change
|
137 |
|
|
// signal (S4, W8), or DX and TLU carry latch on, or DX and coincidence of
|
138 |
|
|
// program to accumulator latch on and lower control latch on. Off next NWP.
|
139 |
|
|
// Develops gates which allow program register early outputs to enter adder and
|
140 |
|
|
// adder outputs to control program register pedistals. Also control no-carry
|
141 |
|
|
// insert on program add.
|
142 |
|
|
//-----------------------------------------------------------------------------
|
143 |
|
|
assign prog_add_d0 = prog_add & d0;
|
144 |
|
|
|
145 |
|
|
wire prog_add_on_p = tlu_carry | tlu_band_change
|
146 |
|
|
| (prog_to_acc_add & lower_control);
|
147 |
24 |
eightycc |
always @(posedge bp)
|
148 |
25 |
eightycc |
if (rst) begin
|
149 |
|
|
prog_add <= 0;
|
150 |
|
|
end else if (dx) begin // in lieu of wp
|
151 |
|
|
prog_add <= prog_add_on_p;
|
152 |
|
|
end;
|
153 |
|
|
|
154 |
|
|
//-----------------------------------------------------------------------------
|
155 |
|
|
// TLU program register regeneration control
|
156 |
|
|
//
|
157 |
|
|
// [124:75] TLU program regeneration control latch 1194 (Fig. 86b). Off with
|
158 |
|
|
// same conditions which turn TLU program add latch on. On with the next WP.
|
159 |
|
|
// When off, interrupts program register regeneration by blocking the path
|
160 |
|
|
// between program on time latch outputs and pedistal lines.
|
161 |
|
|
//-----------------------------------------------------------------------------
|
162 |
27 |
eightycc |
reg prog_ped_regen_latch;
|
163 |
25 |
eightycc |
assign prog_ped_regen = prog_ped_regen_latch; // & ~ap;
|
164 |
|
|
|
165 |
|
|
always @(posedge bp)
|
166 |
|
|
if (rst) begin
|
167 |
24 |
eightycc |
prog_ped_regen_latch <= 0;
|
168 |
27 |
eightycc |
end else if (prog_add_on_p) begin
|
169 |
25 |
eightycc |
prog_ped_regen_latch <= 0;
|
170 |
26 |
eightycc |
end else if (dx) begin
|
171 |
25 |
eightycc |
prog_ped_regen_latch <= 1;
|
172 |
24 |
eightycc |
end;
|
173 |
25 |
eightycc |
|
174 |
|
|
//-----------------------------------------------------------------------------
|
175 |
|
|
// TLU Carry Latch
|
176 |
|
|
//
|
177 |
|
|
// [125:5] TLU carry latch 918 (Fig. 86d). On, DX, A-C gate and adder carry.
|
178 |
|
|
// Off next NWP. Controls addition of proper number to program register D5 and
|
179 |
|
|
// D6 position, depending on which word time it is turned on.
|
180 |
|
|
//-----------------------------------------------------------------------------
|
181 |
|
|
reg tlu_carry;
|
182 |
|
|
|
183 |
|
|
always @(posedge ap)
|
184 |
|
|
if (rst) begin
|
185 |
|
|
tlu_carry <= 0;
|
186 |
26 |
eightycc |
end else if (dx) begin
|
187 |
25 |
eightycc |
tlu_carry <= tlu_control & (carry_test_latch | tlu_or_acc_zero_check);
|
188 |
|
|
end;
|
189 |
|
|
|
190 |
|
|
wire tlu_carry_off_sig;
|
191 |
|
|
digit_pulse tc_sig (rst, bp, ~tlu_carry, 1'b1, tlu_carry_off_sig);
|
192 |
|
|
|
193 |
|
|
//-----------------------------------------------------------------------------
|
194 |
|
|
// TLU Control Latch
|
195 |
|
|
//
|
196 |
|
|
// [124:60] TLU control latch 916 (Fig. 86c). On, TLU signal, D0, S4, W9. Off
|
197 |
|
|
// when TLU carry latch comes on. Sets up TLU operation.
|
198 |
|
|
//-----------------------------------------------------------------------------
|
199 |
|
|
reg tlu_control;
|
200 |
|
|
wire tlu_control_on_p = tlu_sig & s4 & w9 & d0;
|
201 |
|
|
wire tlu_control_off_p = man_acc_reset | tlu_carry;
|
202 |
24 |
eightycc |
assign tlu_on = tlu_control;
|
203 |
25 |
eightycc |
|
204 |
|
|
always @(posedge bp)
|
205 |
|
|
if (rst) begin
|
206 |
|
|
tlu_control <= 0;
|
207 |
|
|
end else if (tlu_control_off_p) begin
|
208 |
|
|
tlu_control <= 0;
|
209 |
|
|
end else if (tlu_control_on_p) begin
|
210 |
|
|
tlu_control <= 1;
|
211 |
|
|
end;
|
212 |
24 |
eightycc |
|
213 |
25 |
eightycc |
//-----------------------------------------------------------------------------
|
214 |
|
|
// TLU band change signal
|
215 |
|
|
//
|
216 |
|
|
// [125:45] If an adder DX carry is not detected by S4, W8 time, a TLU band
|
217 |
|
|
// change signal is developed. This signal resets the address register,
|
218 |
|
|
// develops an address register read-in gate for D5 through D8 of the next word
|
219 |
|
|
// interval, operates add zeros and add 5 circuits, turns on the program add
|
220 |
|
|
// latch and turns off the TLU program regeneration control latch.
|
221 |
|
|
//-----------------------------------------------------------------------------
|
222 |
|
|
assign tlu_band_change = tlu_control & s4 & w8;
|
223 |
|
|
|
224 |
|
|
//-----------------------------------------------------------------------------
|
225 |
|
|
// Special digit gates
|
226 |
|
|
//
|
227 |
|
|
// [97:70] The special digit circuits provide a means of supplying specific
|
228 |
|
|
// digit values to adder entry B. They are used to change the value contained
|
229 |
|
|
// in an accumulator position as necessary to accomplish the operation. The
|
230 |
|
|
// special digit circuits are used primarily in the shifting and TLU
|
231 |
|
|
// operations.
|
232 |
|
|
//-----------------------------------------------------------------------------
|
233 |
|
|
wire d5_tlu_carry_no_w0 = tlu_carry & d5 & ~w0;
|
234 |
|
|
wire d5_tlu_carry_w0 = tlu_carry & d5 & w0;
|
235 |
|
|
wire tlu_carry_d4 = tlu_carry & d4;
|
236 |
|
|
|
237 |
|
|
wire add_0 = (tlu_band_change & ~d5)
|
238 |
|
|
| (tlu_carry & ~(d4 | d5))
|
239 |
|
|
| (tlu_carry_d4 & w1)
|
240 |
|
|
| (d5_tlu_carry_no_w0 & s0)
|
241 |
|
|
| (d5_tlu_carry_w0 & s1)
|
242 |
|
|
| prog_to_acc_add
|
243 |
|
|
| (acc_minus_sign & compl_adj)
|
244 |
27 |
eightycc |
| (quot_digit_on & dxl)
|
245 |
|
|
| (dxl & dist_compl_add)
|
246 |
|
|
| (~add_1 & any_left_shift_on & ~dxl);
|
247 |
25 |
eightycc |
wire add_1 = (tlu_carry_d4 & w2)
|
248 |
|
|
| (d5_tlu_carry_no_w0 & s1)
|
249 |
|
|
| (d5_tlu_carry_w0 & s2)
|
250 |
27 |
eightycc |
| (dxl & (right_shift_on | left_shift_on | mult_div_left_shift))
|
251 |
|
|
| (dist_compl_add & quot_digit_on & d0l)
|
252 |
24 |
eightycc |
| sig_digit_on;
|
253 |
|
|
wire add_2 = (tlu_carry_d4 & w3)
|
254 |
25 |
eightycc |
| (d5_tlu_carry_no_w0 & s2)
|
255 |
|
|
| (d5_tlu_carry_w0 & s3);
|
256 |
24 |
eightycc |
wire add_3 = (tlu_carry_d4 & w4)
|
257 |
25 |
eightycc |
| (d5_tlu_carry_no_w0 & s3)
|
258 |
|
|
| (d5_tlu_carry_w0 & s4);
|
259 |
24 |
eightycc |
wire add_4 = (tlu_carry_d4 & w5)
|
260 |
25 |
eightycc |
| (d5_tlu_carry_no_w0 & s4);
|
261 |
24 |
eightycc |
wire add_5 = (tlu_band_change & d5)
|
262 |
25 |
eightycc |
| (tlu_carry_d4 & w6)
|
263 |
27 |
eightycc |
| (dxl & hc_add_5);
|
264 |
24 |
eightycc |
wire add_6 = (tlu_carry_d4 & w7);
|
265 |
|
|
wire add_7 = (tlu_carry_d4 & w8);
|
266 |
|
|
wire add_8 = (tlu_carry_d4 & w9);
|
267 |
|
|
wire add_9 = (tlu_carry_d4 & w0)
|
268 |
25 |
eightycc |
| (d10u & mult_on & acc_true_add_gate);
|
269 |
|
|
|
270 |
24 |
eightycc |
assign special_digit = {add_0, add_1, add_2, add_3, add_4,
|
271 |
25 |
eightycc |
add_5, add_6, add_7, add_8, add_9};
|
272 |
24 |
eightycc |
|
273 |
25 |
eightycc |
//-----------------------------------------------------------------------------
|
274 |
|
|
// Distributor blanking gate
|
275 |
|
|
//
|
276 |
|
|
// [97:70] The distributor blanking gate controls the distributor true and
|
277 |
|
|
// distributor complement gates to allow early distributor outputs or
|
278 |
|
|
// substituted through, to the adder B entry lines. This distributor blanking
|
279 |
|
|
// gate is up for all operations where the distributor early outputs or
|
280 |
|
|
// substituted zeros are used and is down for all operations where special
|
281 |
|
|
// digits values are substituted in place of distributor outputs. It is
|
282 |
|
|
// necessary to prevent a conflict of information from the two sources on the
|
283 |
|
|
// adder input lines.
|
284 |
|
|
//
|
285 |
|
|
// The gate, which is normally up, is lowered by the inverted switch and mix
|
286 |
|
|
// cicuitry output shown at Fig. 86h. It is lowered by all special digit gates,
|
287 |
|
|
// by the right shift gate, left shift gate, left shift latch, complement
|
288 |
|
|
// adjust gate, TLU selected storage add gate and the M-D left shift latch.
|
289 |
|
|
//-----------------------------------------------------------------------------
|
290 |
|
|
assign dist_blank_gate = |special_digit; // TODO: finish logic
|
291 |
|
|
|
292 |
|
|
//-----------------------------------------------------------------------------
|
293 |
24 |
eightycc |
// Table look-up selected storage add gate and table look-up on time
|
294 |
|
|
// distributor add gate
|
295 |
|
|
//
|
296 |
|
|
// [96:65] On a table look-up operation (Fig 120), the contents of the first
|
297 |
|
|
// 48 storage locations of a general storage band are successively compared
|
298 |
|
|
// with the contents of the distributor. When a number in a general storage
|
299 |
|
|
// location equals or exceeds the searching argument in the distributor, the
|
300 |
|
|
// address of this location is placed in the "D" address positions of the
|
301 |
|
|
// lower accumulator. The comparison is made by merging, in the adder, the
|
302 |
|
|
// complement of the distributor on time outputs with the successive general
|
303 |
|
|
// storage outputs and checking for a carry from the D10U position (at DXL
|
304 |
|
|
// time). A TLU selected storage add gate and a TLU distributor add gate allow
|
305 |
|
|
// these adder entries to be made.
|
306 |
|
|
//
|
307 |
|
|
// These control gates are developed when the TLU latch 916 (Fig. 86c) is on.
|
308 |
|
|
// The latch output is switched at switch 1034 with a D1 through D10 gate and
|
309 |
|
|
// a negative S4, W8, and 9 gate to provide the TLU selected storage add gate
|
310 |
|
|
// from the output of cathode follower 1035 and TLU on time distributor add
|
311 |
|
|
// gate from cathode follower 1036 for D1 through D10 of each word of the band
|
312 |
|
|
// except words 48 and 49.
|
313 |
25 |
eightycc |
//-----------------------------------------------------------------------------
|
314 |
27 |
eightycc |
assign sel_stor_add_gate = 1'b0;
|
315 |
|
|
assign ontime_dist_add_gate = 1'b0;
|
316 |
|
|
assign upper_lower_check = 1'b0;
|
317 |
25 |
eightycc |
|
318 |
24 |
eightycc |
endmodule
|