OpenCores
URL https://opencores.org/ocsvn/i650/i650/trunk

Subversion Repositories i650

[/] [i650/] [trunk/] [rtl/] [tlu.v] - Blame information for rev 24

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.