Multifunction flip-flop-type circuit

Abstract: A flip-flop-type circuit capable of operat­ ing either as a conventional D flip-flop or as a device which merely passes through the data applied to it (so-called "flow-through mode"). In the flow-­ through mode, the circuit has the additional capability of being able to latch in the data flowing through it at any time. Thus the circuit can also operate as a level-sensitive latch.

Description: This invention relates to digital logic circuitry, and more particularly to a flip-flop-type circuit capable of several different modes of operation. In the present Applicants' co-pending U.S. Patent Applications Serial Nos. 190,663 (now U.S. Patent No. 4,871,930, equivalent to European Patent Application No. 89301780.6) and 190,571 (now U.S. Patent No. 4,903,223, equivalent to European Patent Application No. 89301781.4), a flip-flop-type circuit 123 is shown which is required to operate variously as (1) a D-type flip-flop, (2) a level-sensitive latch, or (3) a simple flow-through device. A need therefore exists for a logic circuit having these capabilities, and it is accordingly an object of this invention to provide such a circuit. GB-A-2 171 546 shows a storage element which can operate as a transparent latch with set and reset, and which can also be configured to operate as a D flip-flop. However, this storage element, which employs two D latches, requires a programmable switch to allow selective bypassing of the second latch when certain operating modes, in particular a transparent mode, of the storage element are desired. EP-A-0 167 047 shows a D-type latch that has been modified to provide the scan capability of a level-sensitive-scan-design latch. In Electronic Design vol. 35, no. 1, Jan. 1987, pages 45 and 46, programmable array logic macrocells that are programmed using one-time programmable fuses are discussed. At the Electro /86 and Mini/Micro Northeast 11 1986 conference, erasable programmable logic devices that may be electrically programmed and subsequently erased with ultraviolet light were discussed by D.F. Faria. None of these documents disclose circuitry which provides the required features according to the present invention, in which there is provided a multi functional flip-flop-type device having data preset, clear, and clock flip-flop input terminals, and a data flip-flop output terminal, for applying a signal applied to the data flip-flop input terminal to the data flip-flop output terminal when the preset and clear signals have a second polarity and the clock signal changes from a first polarity to a second polarity, for applying a first polarity to the data flip-flop output terminal when the preset signal has a second polarity and the clear signal has a first polarity, for applying a second polarity to the data flip-flop output terminal when the preset signal has a first polarity and the clear signal has a second polarity, means for holding a signal constant at the data flip-flop output terminal when the preset, clear, and clock signals have a first polarity, and for applying the signal applied to the data flip-flop input terminal to the data flip-flop output terminal when the preset and clear signals have first polarity and the clock signal has a second polarity, first and second D latches, each having a data input terminal, a set input terminal, a reset terminal, a gate input terminal, and a data output terminal, the data output terminal of the first latch being connected to the data input terminal of the second latch, the set and reset terminals of the second latch being connected to a source of first polarity, the data input terminal of the first latch being connected to the data flip-flop input terminal, and the data output terminal of the second latch being connected to the data flip-flop output terminal; a preset signal source connected to the preset flip-flop input terminal; a clear signal source connected to the clear flip-flop input terminal; a clock signal source connected to the clock flip-flop input terminal; first means responsive to the preset and clear signals for applying the inverse of the preset signal to the set input terminal of the first latch and for applying the inverse of the clear signal to the reset terminal of the first latch unless both of the preset and clear signals have a first polarity, in which case the first means applies a first polarity to the set and reset terminals of the first latch; second means responsive to the preset and clear signals for applying a second polarity to the gate input terminal of the first latch when both of the preset and clear signals have the first polarity; third means responsive to the preset and clear signals for applying a second polarity to the gate input terminal of the second latch when either but not both of the preset and clear signals have the first polarity; and fourth means responsive to the preset, clear, and clock signals for applying the inverse of the clock signal to the gate input terminal of the first latch unless at least one of the preset and clear signals has the first polarity, and for applying the clock signal to the gate input terminal of the second latch unless one but not both of the preset and clear signals has the first polarity. Preferred features of the invention are set out in the dependent claims. The invention will now be described by way of example with reference to the drawings in which:- Figure 1 is a schematic block diagram of a circuit in accordance with the invention; Figure 2 is a truth table useful in explaining the operation of the circuit of Figure 1; Figure 3 is a truth table useful in explaining the operation of two of the components of the circuit of Figure 1. Figure 1 shows part of the circuitry shown in Figure 5 of the above-mentioned co-pending European Patent Application No. 89301780.6. (Figure 1 is also similar to a portion of Figure 4 in the above-mentioned European Patent Application No. 89301781.4), but for convenience herein, only Figure 5 of Application No. 89310780.6 is referred to below.) Similar names and reference numerals are used for similar elements in these two drawings, although the pictorial arrangement of the elements differs sightly from one drawing to the other. The elements surrounded by chain-dotted line 123 herein correspond to flip-flop 123 in above-mentioned application No. 89301780.6. (Inverters 212 correspond to the active-low inputs shown on the P and C terminals of flip-flop 123 in that application.) FIG. 2 is a truth table for the overall operation of flip-flop 123. (FIG. 2 corresponds to FIG. 9 in above-mentioned application No 89301780.6 and to FIG. 8 in above-mentioned application No 89301781.4. The first four lines of FIG. 2 show that when one or both of the preset P and clear C signals is 1, flip-flop 123 operates like a normal D flip-flop. The last three lines of FIG. 2 show that when P and C are both O (which is normally an illegal condition for a D flip-flop with active-low inputs), flip-flop 123 acts like a flow-through device (i.e., Q = D, assuming that the clock signal CLK remains high as shown in the last two lines of FIG. 2), but that (as shown in the third from the last line in FIG. 2) the flow-through data can also be latched into flip-flop 123 by causing CLK to go low (because Qo indicates that Q then holds whatever value it had just before CLK went low). In other words, in addition to being capable of operating as a D flip-flop (first four lines of FIG. 2) or as a flow-through device (last two lines of FIG. 2), flip-flop l23 can also act as a level-sensitive latch by latching in the flow-through data when CLK goes low (third from last line of FIG. 2). FIG. 1 shows the detailed construction of device 123 in accordance with the principles of this invention in order to realize the above-described modes of operation. Each of latches 210M and 210S is a conventional D latch. Latch 210M is the so-called "master" latch, while latch 210S is the so-called "slave" latch. Each of latches 210 has a data input terminal D, an output terminal Q, a set input terminal S, a reset input terminal R, and a gate or "function enable" input terminal G. FIG. 3 is a truth table for the operation of each of latches 210. As shown in that FIG., when both the set S and reset R inputs of a latch 210 are O and the gate G input is 1, then the Q output follows the data D input. However, when all of S, R, and G are O, the Q output holds whatever value (denoted Qo) it had just before G went low. In other words, with S and R both O, Q is insensitive to changes in D while G is low. When S is l and R is O, Q is l regardless of G and D. Similarly, when S is O and R is l, Q is O regardless of G and D. In the ensuing discussion, an M or S suffix is sometimes used to distinguish the signals associated with master latch 210M from the signals associated with slave latch 210S. For example, DM refers to the D signal of master latch 210M, while DS refers to the D signal of slave latch 210S. The P and C signals (corresponding respectively to the P and C signals in application 89301780.6) and to the PRE and CLR signals in application No. 89301781.4) are respectively inverted by inverters 212a and 212b and then applied to one input of each of AND gates 214a and 214b. The inverse of the inverted C signal is applied to the other input of AND gate 214a, and the inverse of the inverted P signal is applied to the other input of AND gate 214b. The effect of AND gates 214 is to make it impossible for both SM and RM to be l at the same time. Assuming, however, that no more than one of P and C is 0, gates 2l4 effectively apply the inverted P signal to the S terminal of latch 210M, and the inverted C signal to the R terminal of latch 2l0M. Accordingly, if either P or C is 0, QM is determined by which of P and C is 0. QM is then passed through to QS because with either P or C 0, the output XOR2 of EXCLUSIVE OR ("XOR") gate 218 becomes l and the output GLS of OR gate 222 also becomes l. (SS and RS are always tied low.) The above-described operation corresponds to the third and fourth lines of FIG. 2. If both P and C are 1, SM and RM are both O. The output of AND gate 2l6 is O, and so is the output of XOR gate 218. OR gate 222 then passes whatever CLK signal is applied to it, and that signal is inverted by OR gate 220. Assuming that the CLK signal is initially low, GM is high and DM is passed to QM and thereby applied to DS. When the CLX signal subsequently goes high, DS is passed to QS. This mode of operation corresponds to the first two lines of FIG. 2. If P and C are both 0, SM and SR are also both O. The output of AND gate 2l6 is l, the output of OR gate 220 is l, and the output of XOR gate 2l8 is O. If CLK is also l (e.g., because BLCK is tied low), the output of OR gate l06 is l, and the output of OR gate 222 is also l. This means that each of latches 2l0 operates as shown in the first two lines of FIG. 3 so that QS = DM . In other words, whatever data is applied to DM flows through to QS. This mode of operation corresponds to the last two lines of FIG. 2. If, at any time during the flow-through operation described immediately above, CLK goes low (e.g., because BLCK is not in fact permanently tied low), the output of OR gate 222 becomes O. This causes latch 2l0S to operate as shown in the third line in FIG. 3, thereby latching in the current value Qo of QS. This mode of operation corresponds to the fifth line of FIG. 2. From the foregoing, it will be apparent that the circuit of FIG. 1 can be used to supply on lead l24 either the "registered" or "combinatorial" output of XOR gate l07 (registered output results from operation of device l23 as a D flip-flop (first four lines of FIG. 2); combinatorial output results from operation of device l23 in the flow-through mode (last two lines of FIG. 2)), and that in addition, the flow-through mode data can be latched into device 123 at any time by causing the CLK signal to go low. Device 123 is therefore highly flexible and of great utility in programmable logic device ("PLDs") such as are shown in applications Nos. 89301780.6 and 89301781.4. Although particular signal values like "0" and "1" or "first polarity" and "second polarity" are referred to herein and in the appended claims, it will be understood that these values and terms are purely arbitrary, and that they are used solely for purposes of illustration. Thus, for example, although "first polarity" is uniformly equated with logic 0, and "second polarity" is uniformly equated with logic l herein as an aid to understanding the specification and claims, this is not necessarily the case, and the polarity or value of various signals can be reversed or otherwise altered. As another example, whereas the specification and claims sometimes refer to applying the inverse of a particular signal to a particular component, if the polarity of that signal were reversed, then the signal could be applied directly (without inversion) to that component.

Claims: A multifunctional flip-flop-type device (123) having data (121), preset (P), clear (C), and clock (CLK) flip-flop input terminals, and a data flip-flop output terminal (124), for applying a signal applied to the data flip-flop input terminal (121) to the data flip-flop output terminal (124) when the preset and clear signals have a second polarity and the clock signal changes from a first polarity to a second polarity, for applying a first polarity to the data flip-flop output terminal (124) when the preset signal has a second polarity and the clear signal has a first polarity, for applying a second polarity to the data flip-flop output terminal (124) when the preset signal has a first polarity and the clear signal has a second polarity, means for holding a signal constant at the data flip-flop output terminal (124) when the preset, clear, and clock signals have a first polarity, and for applying the signal applied to the data flip-flop input terminal (121) to the data flip-flop output terminal (124) when the preset and clear signals have first polarity and the clock signal has a second polarity, first and second D latches (210M, 210S), each having a data input terminal (D), a set input terminal (S), a reset terminal (R), a gate input terminal (G), and a data output terminal (Q), the data output terminal (Q) of the first latch (210M) being connected to the data input terminal (D) of the second latch (210S), the set (S) and reset (R) terminals of the second latch (210S) being connected to a source of first polarity, the data input terminal (D) of the first latch (210M) being connected to the data flip-flop input terminal (121), and the data output terminal (Q) of the second latch (210S) being connected to the data flip-flop output terminal (124); a preset signal source connected to the preset flip-flop input terminal (P); a clear signal source connected to the clear flip-flop input terminal (C); a clock signal source connected to the clock flip-flop input terminal (CLK); first means (212a, 212b, 214a, 214b) responsive to the preset and clear signals for applying the inverse of the preset signal to the set input terminal (S) of the first latch (210M) and for applying the inverse of the clear signal to the reset terminal (R) of the first latch (210M) unless both of the preset and clear signals have a first polarity, in which case the first means (212a, 212b, 214a, 214b) applies a first polarity to the set (S) and reset (R) terminals of the first latch (210M); second means (212a, 212b, 216, 218, 220, 222) responsive to the preset and clear signals for applying a second polarity to the gate input terminal (G) of the first latch (210M) when both of the preset and clear signals have the first polarity; third means (212a, 212b, 218, 222) responsive to the preset and clear signals for applying a second polarity to the gate input terminal (G) of the second latch (210S) when either but not both of the preset and clear signals have the first polarity; and fourth means (212a, 212b, 216, 218, 220, 222) responsive to the preset, clear, and clock signals for applying the inverse of the clock signal to the gate input terminal (G) of the first latch (210M) unless at least one of the preset and clear signals has the first polarity, and for applying the clock signal to the gate input terminal (G) of the second latch (210S) unless one but not both of the preset and clear signals has the first polarity. A device according to claim 1, characterised in that the said first means (212a, 212b, 214a, 214b) comprises: a first AND gate (214a) having the inverse of the preset signal connected to one of its inputs and the clear signal applied to the other of its inputs, and having its output signal applied to the set input terminal (S) of the first latch (210M); and a second AND gate (214b) having the inverse of the clear signal applied to one of its inputs and the preset signal applied to the other of its inputs, and having its output signal applied to the reset input terminal (R) of the first latch (210M). A device according to claim 1 or claim 2, characterised in that the said second means (212a, 212b, 216, 218, 220, 222) comprises: a third AND gate (216) having the inverse of the preset signal applied to one of its inputs and the inverse of the clear signal applied to the other of its inputs; and means (212a, 212b, 218, 220, 222) for selectively applying the output signal of the third AND gate (216) to the gate input terminal (G) of the first latch (210M). A device according to claim 1 or claim 2, characterised in that the said third means (212a, 212b, 218, 222) comprises: an EXCLUSIVE OR gate (218) having the inverse of the preset signal applied to one of its inputs and the inverse of the clear signal applied to the other of its inputs; and means (222) for selectively applying the output signal of the EXCLUSIVE OR gate (218) to the gate input terminal (G) of the second latch (210S). A device according to claim 4, characterised in that the said means (222) for selectively applying the output signal of the EXCLUSIVE OR gate (218) to the gate input terminal (G) of the second latch (210S) comprises: a first OR gate (222) having the output signal of the EXCLUSIVE OR gate (218) applied to one of its inputs, and the clock signal applied to the other of the inputs, and having its output signal applied to the gate input terminal (G) of the second latch (210S). A device according to claim 5, characterised in that the said second means (212a, 212b, 216, 218, 220, 222) comprises: a third AND gate (216) having the inverse of the preset signal applied to one of its inputs and the inverse of the clear signal applied to the other of its inputs; and a second OR gate (220) having the output signal of the third AND gate (216) applied to one of its inputs and the inverse of the output signal of the first OR gate (222) applied to the other of its inputs, and having its output signal applied to the gate input terminal (G) of the first latch (210M). A device according to claim 1 or claim 2, characterised in that the said fourth means (212a, 212b, 216, 218, 220, 222) comprises: a third AND gate (216) having the inverse of the preset signal applied to one of its inputs and the inverse of the clear signal applied to the other of its inputs; an EXCLUSIVE OR gate (218) having the inverse of the preset signal applied to one of its inputs and the inverse of the clear signal applied to the other of its inputs; a first OR gate (222) having the output of the EXCLUSIVE OR gate (218) applied to one of its inputs and the clock signal applied to the other of its inputs, and having its output signal applied to the gate input terminal (G) of the second latch (210S); and a second OR gate (220) having the output of the third AND gate (216) applied to one of its input and the inverse of the output signal of the first OR gate (222) applied to the other of its inputs, and having its output signal applied to the gate input terminal (G) of the first latch (210M).

Inventors: NORMAN KEVIN ALAN, SO HOCK-CHUEN, VEENSTRA KERRY SCOTT, WONG SAU-CHING, NORMAN, KEVIN ALAN, SO, HOCK-CHUEN, VEENSTRA, KERRY SCOTT, WONG, SAU-CHING
Applicants: ALTERA CORP, ALTERA CORPORATION
Application year: 1989
Main classification: H03K3
IPC codes: H03K3