Recent from talks
Nothing was collected or created yet.
Ring counter
View on WikipediaA ring counter is a type of counter composed of flip-flops connected into a shift register, with the output of the last flip-flop fed to the input of the first, making a "circular" or "ring" structure.
There are two types of ring counters:
- A straight ring counter, also known as a one-hot counter, connects the output of the last shift register to the first shift register input and circulates a single one (or zero) bit around the ring.
- A twisted ring counter, also called switch-tail ring counter, walking ring counter, Johnson counter, or Möbius counter, connects the complement of the output of the last shift register to the input of the first register and circulates a stream of ones followed by zeros around the ring.
Four-bit ring-counter sequences
[edit]| Straight ring counter | Johnson counter | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| State | Q0 | Q1 | Q2 | Q3 | State | Q0 | Q1 | Q2 | Q3 | |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | |
| 2 | 0 | 0 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | |
| 3 | 0 | 0 | 0 | 1 | 3 | 1 | 1 | 1 | 0 | |
| 0 | 1 | 0 | 0 | 0 | 4 | 1 | 1 | 1 | 1 | |
| 1 | 0 | 1 | 0 | 0 | 5 | 0 | 1 | 1 | 1 | |
| 2 | 0 | 0 | 1 | 0 | 6 | 0 | 0 | 1 | 1 | |
| 3 | 0 | 0 | 0 | 1 | 7 | 0 | 0 | 0 | 1 | |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
Properties
[edit]Ring counters are often used in hardware design (e.g. ASIC and FPGA design) to create finite-state machines. A binary counter would require an adder circuit which is substantially more complex than a ring counter and has higher propagation delay as the number of bits increases, whereas the propagation delay of a ring counter will be nearly constant regardless of the number of bits.
The straight and twisted forms have different properties, and relative advantages and disadvantages.
A general disadvantage of ring counters is that they are lower density codes than normal binary encodings of state numbers. A binary counter can represent 2N states, where N is the number of bits in the code, whereas a straight ring counter can represent only N states and a Johnson counter can represent only 2N states. This may be an important consideration in hardware implementations where registers are more expensive than combinational logic.
Johnson counters are sometimes favored, because they offer twice as many count states from the same number of shift registers, and because they are able to self-initialize from the all-zeros state, without requiring the first count bit to be injected externally at start-up. The Johnson counter generates a code in which adjacent states differ by only one bit (that is, have a Hamming distance of 1), as in a Gray code, which can be useful if the bit pattern is going to be asynchronously sampled.[1]
When a fully decoded or one-hot representation of the counter state is needed, as in some sequence controllers, the straight ring counter is preferred. The one-hot property means that the set of codes are separated by a minimum Hamming distance of 2,[2] so any single-bit error is detectable (as is any error pattern other than turning on one bit and turning off one bit).
Sometimes bidirectional shift registers are used (using multiplexors to take the input for each flip-flop from its left or right neighbor), so that bidirectional or up–down ring counters can be made.[3]
Logic diagrams
[edit]The straight ring counter has the logical structure shown here:
Instead of the reset line setting up the initial one-hot pattern, the straight ring is sometimes made self-initializing by the use of a distributed feedback gate across all of the outputs except that last, so that a 1 is presented at the input when there is no 1 in any stage but the last.[4]
A Johnson counter, named for Robert Royce Johnson, is a ring with an inversion; here is a 4-bit Johnson counter:
Note the small bubble indicating inversion of the Q signal from the last shift register before feeding back to the first D input, making this a Johnson counter.
History
[edit]Before the days of digital computing, digital counters were used to measure rates of random events such as radioactive decays to alpha and beta particle. Fast "pre-scaling" counters reduced the rate of random events to more manageable and more regular rates. Five-state ring counters were used along with divide-by-two scalers to make decade (power-of-ten) scalers before 1940, such as those developed by C. E. Wynn-Williams.[5]
Early ring counters used only one active element (vacuum tube, valve, or transistor) per stage, relying on global feedback rather than local bistable flip-flops, to suppress states other than the one-hot states, for example in the 1941 patent filing of Robert E. Mumma of the National Cash Registor Company.[6] Wilcox P. Overbeck invented a version using multiple anodes in a single vacuum tube,[7][8] In recognition of his work, ring counters are sometimes referred to as "Overbeck rings"[9][10] (and after 2006, sometimes as "Overbeck counters", since Wikipedia used that term from 2006 to 2018).
The ENIAC used decimal arithmetic based on 10-state one-hot ring counters. The works of Mumma at NCR and Overbeck at MIT were among the prior art works examined by the patent office that invalidated the patents of J. Presper Eckert and John Mauchly for the ENIAC technology.[11]
By the 1950s, ring counters with a two-tube or twin-triode flip-flop per stage were appearing.[12]
Robert Royce Johnson developed a number of different shift-register-based counters with the aim of making different numbers of states with the simplest possible feedback logic, and filed for a patent in 1953.[13] The Johnson counter is the simplest of these.
Applications
[edit]Early applications of ring counters were as frequency prescalers (e.g. for Geiger counter and such instruments),[5] as counters to count pattern occurrences in cryptanalysis (e.g. in the Heath Robinson codebreaking machine and the Colossus computer),[14] and as accumulator counter elements for decimal arithmetic in computers and calculators, using either bi-quinary (as in the Colossus) or ten-state one-hot (as in the ENIAC) representations.
Straight ring counters generate fully decoded one-hot codes to that are often used to enable a specific action in each state of a cyclic control cycle. One-hot codes can also be decoded from a Johnson counter, using one gate for each state.[15][nb 1]
Besides being an efficient alternative way to generate one-hot codes and frequency pre-scalers, a Johnson counter is also a simple way to encode a cycle of an even number of states that can be asynchronously sampled without glitching, since only one bit changes at a time, as in a Gray code.[16] Early computer mice used up–down (bidirectional) 2-bit Johnson or Gray encodings to indicate motion in each of the two dimensions, though in mice those codes were not usually generated by rings of flip-flops (but instead by electro-mechanical or optical quadrature encoders).[17] A 2-bit Johnson code and a 2-bit Gray code are identical, while for 3 or more bits Gray and Johnson codes are different. In the 5-bit case, the Johnson counter's code is the same as the Libaw–Craig code for decimal digits, from "a non-counting decimal- coded shaft digitizer".[18][19][20][21][22][23][24][25]
A walking ring counter, also called a Johnson counter, and a few resistors can produce a glitch-free approximation of a sine wave. When combined with an adjustable prescaler, this is perhaps the simplest numerically-controlled oscillator. Two such walking ring counters are perhaps the simplest way to generate the continuous-phase frequency-shift keying used in dual-tone multi-frequency signaling and early modem tones.[26]
|
|
|
|
|
|
|
|
See also
[edit]Notes
[edit]- ^ Johnson counter circuits with single states decoded in this way can be found in the original IBM MDA and CGA video display adapter designs, in the timing sequencer logic: one or two 74x174 hex D-type flip-flop ICs are wired as a shift register, fed back with inversion to form a Johnson counter, and 2-input NAND gates (in the MDA) or XOR gates (in the CGA) are used to decode states used as signals such as +RAS (Row Address Strobe [to DRAM]) and S/-L (Shift / NOT Load). Source: IBM Personal Computer Options & Adapters Technical Reference, Monochrome Display and Printer Adapter, logic diagrams; IBM Personal Computer Options & Adapters Technical Reference, Color Graphics Monitor Adapter, logic diagrams.
References
[edit]- ^ Pedroni, Volnei A. (2013). Finite State Machines in Hardware: Theory and Design. MIT Press. p. 50. ISBN 978-0-26201966-8.
- ^ Mengibar, Luis; Entrena, Luis; Lorenz, Michael G.; Sánchez-Reillo, Raúl (2003). "State Encoding for Low-Power FSMs in FPGA". Integrated Circuit and System Design. Power and Timing Modeling, Optimization and Simulation: Proceedings of the 13th International Workshop, PATMOS 2003, Torino, Italy, 10–12 September 2003. Vol. 13. Springer Science & Business Media. p. 35. ISBN 9783540200741.
- ^ Stan, Mircea R. (1997). "Synchronous up/down counter with clock period independent of counter size" (PDF). Proceedings 13th IEEE Symposium on Computer Arithmetic: 274–281.
- ^ Holdsworth, Brian; Woods, Clive (2002). Digital Logic Design (4 ed.). Newnes Books / Elsevier Science. pp. 191–192. ISBN 0-7506-4588-2. Retrieved 2020-04-19.
{{cite book}}: CS1 maint: ignored ISBN errors (link) (519 pages) [1] - ^ a b Lewis, Wilfrid Bennett (1942). Electrical Counting: With Special Reference to Counting Alpha and Beta Particles. Cambridge University Press. p. 90. ISBN 9781316611760.
{{cite book}}: ISBN / Date incompatibility (help) - ^ "Electronic accumulation", Robert E. Mumma's US Patent No. 2405096, filed in 1941
- ^ "Electronic switching device", Wilcox P. Overbeck's US Patent No. 2427533, filed in 1943
- ^ Dayton Codebreakers: 1942 Research Report, mentioning "A new high speed counter by Mr. Overbeck, January 8, 1942"
- ^ RAMAC 305 - IBM Customer Engineering Manual of Instruction (PDF). IBM. 1959.
[…] The Overbeck ring is used to supply timed pulses within computer circuits much as cam operated circuit breakers supply timed pulses on mechanical machines. It consists of a set of triggers with a common input from the ring drive line which carries pulses supplied by the process drum. […] Initially the triggers are reset OFF with the exception of the home trigger, which is ON. Each negative input pulse will turn OFF the trigger that is ON. The fall of the voltage at pin 10 of the trigger being turned OFF will grid flip the next trigger ON. This continues through a closed ring […]
- ^ Electrical Technology - A Suggested 2-Year Post High School Curriculum. Technical Education Program Series. United States, Division of Vocational and Technical Education. 1960. p. 52.
- ^ Randall, Brian (2014). "The Origins of Digital Computers: Supplementary Bibliography". In Metropolis, Nicholas (ed.). History of Computing in the Twentieth Century. Elsevier. pp. 651–652. ISBN 9781483296685.
- ^ William Alfred Higinbotham, "Fast impulse circuits", US Patent No. 2536808, filed in 1949
- ^ Robert Royce Johnson, "Electronic counter", US Patent No. 3030581, filed in 1953
- ^ Copeland, B. Jack (2010). Colossus: The Secrets of Bletchley Park's Code-breaking Computers. Oxford University Press. pp. 123–128. ISBN 978-0-19957814-6.
- ^ Langholz, Gideon; Kandel, Abraham; Mott, Joe L. (1998). Foundations of Digital Logic Design. World Scientific. pp. 525–526. ISBN 978-9-81023110-1.
- ^ van Holten, Cornelius (August 1982). Written at Delft Technical University, Delft, Netherlands. "Digital dividers with symmetrical outputs - The author uses Johnson counters with controlled feedback to give symmetrical even and odd-numbered divisions of a clock pulse" (PDF). Wireless World. Vol. 88, no. 1559. Sutton, Surrey, UK: IPC Business Press Ltd. pp. 43–46. ISSN 0043-6062. Archived (PDF) from the original on 2021-02-21. Retrieved 2021-02-20. [2] [3] (4 pages)
- ^ Lyon, Richard F. (August 1981), The Optical Mouse, and an Architectural Methodology for Smart Digital Sensors (PDF) (Report), Palo Alto Research Center, Palo Alto, California, USA: Xerox Corporation, VLSI 81-1, archived (PDF) from the original on 2020-05-23, retrieved 2020-05-23,
The counters needed for X and Y simply count through four states, in either direction (up or down), changing only one bit at a time (i.e., 00, 01, 11, 10). This is a simple case of either a Gray-code counter or a Johnson counter (Moebius counter).
(41 pages) - ^ Libaw, William H.; Craig, Leonard J. (October 1953) [September 1953]. "A Photoelectric Decimal-Coded Shaft Digitizer". Transactions of the I.R.E. Professional Group on Electronic Computers. EC-2 (3): 1–4. doi:10.1109/IREPGELC.1953.5407731. eISSN 2168-1759. ISSN 2168-1740. Retrieved 2020-05-26. (4 pages)
- ^ Powell, E. Alexander (June 1968). "Codes particularly useful for analogue to digital conversions". A short note on useful codes for Fluidic Control Circuits (PDF). Cranfield, UK: The College of Aeronautics, Department of Production Engineering. p. 10. S2CID 215864694. CoA Memo 156. Archived (PDF) from the original on 2020-12-15. Retrieved 2020-12-15. (18 pages) (NB. The paper names the Glixon code modified Gray code and misspells Richard W. Hamming's name.)
- ^ Dokter, Folkert; Steinhauer, Jürgen (1973-06-18). Digital Electronics. Philips Technical Library (PTL) / Macmillan Education (Reprint of 1st English ed.). Eindhoven, Netherlands: The Macmillan Press Ltd. / N. V. Philips' Gloeilampenfabrieken. p. 43. doi:10.1007/978-1-349-01417-0. ISBN 978-1-349-01419-4. SBN 333-13360-9. Retrieved 2020-05-11. (270 pages)
- ^ Dokter, Folkert; Steinhauer, Jürgen (1975) [1969]. Digitale Elektronik in der Meßtechnik und Datenverarbeitung: Theoretische Grundlagen und Schaltungstechnik. Philips Fachbücher (in German). Vol. I (improved and extended 5th ed.). Hamburg, Germany: Deutsche Philips GmbH. pp. 52, 58, 98. ISBN 3-87145-272-6. (xii+327+3 pages)
- ^ Dokter, Folkert; Steinhauer, Jürgen (1975) [1970]. Digitale Elektronik in der Meßtechnik und Datenverarbeitung: Anwendung der digitalen Grundschaltungen und Gerätetechnik. Philips Fachbücher (in German). Vol. II (4th ed.). Hamburg, Germany: Deutsche Philips GmbH. p. 169. ISBN 3-87145-273-4. (xi+393+3 pages)
- ^ Steinbuch, Karl W., ed. (1962). Written at Karlsruhe, Germany. Taschenbuch der Nachrichtenverarbeitung (in German) (1 ed.). Berlin / Göttingen / New York: Springer-Verlag OHG. pp. 71–72, 74. LCCN 62-14511.
- ^ Steinbuch, Karl W.; Wagner, Siegfried W., eds. (1967) [1962]. Taschenbuch der Nachrichtenverarbeitung (in German) (2 ed.). Berlin, Germany: Springer-Verlag OHG. LCCN 67-21079. Title No. 1036.
- ^ Steinbuch, Karl W.; Weber, Wolfgang; Heinemann, Traute, eds. (1974) [1967]. Taschenbuch der Informatik – Band II – Struktur und Programmierung von EDV-Systemen (in German). Vol. 2 (3 ed.). Berlin, Germany: Springer Verlag. ISBN 3-540-06241-6. LCCN 73-80607.
{{cite book}}:|work=ignored (help) - ^ Don Lancaster. "TV Typewriter Cookbook". (TV Typewriter). 1976. p. 180-181.
Ring counter
View on GrokipediaFundamentals
Definition and Basic Concept
A ring counter is a fundamental sequential digital circuit constructed as a specialized type of shift register, where the output of the final stage is fed back to the input of the initial stage, establishing a closed-loop configuration for continuous data circulation.[3] This feedback mechanism distinguishes it from standard linear shift registers, which operate without recirculation and consequently lose data upon shifting it out the end after a single pass.[2] At its core, the ring counter relies on flip-flops as its primary building blocks, which are bistable multivibrator circuits designed to store a single bit of binary information (0 or 1) and maintain that state until altered by input signals synchronized to a clock.[7] Common flip-flop variants include the SR (Set-Reset) type, which uses set and reset inputs to toggle states; the D (Data) type, which captures the input value on the clock edge; the JK type, offering versatile toggling and preset capabilities; and the T (Toggle) type, which inverts the state when triggered.[8] These elements are cascaded in the ring counter to form stages that shift data synchronously with each clock pulse. The primary role of a ring counter is to produce a predetermined sequence of distinct output states in a cyclic fashion, limited to one unique state per stage without requiring external decoding or binary arithmetic logic for state progression.[9] For an n-stage ring counter, it inherently cycles through exactly n states, often initialized with a single '1' (high logic level) that propagates around the loop, providing a simple yet reliable method for timing, sequencing, or one-hot encoding in digital systems.[9]Operation Principle
A basic ring counter operates as a circular shift register, where the output of the last flip-flop is fed back to the input of the first, enabling the stored bit pattern to recirculate indefinitely.[6][5] Composed of flip-flops as storage elements, it is typically initialized by setting a single '1' in one position with all other bits at '0', establishing a one-hot encoding where only one bit is active at a time.[6][5] This initialization can be achieved through preset inputs on the flip-flops, ensuring a defined starting state to prevent invalid patterns.[5] Upon each rising edge of the clock signal, the bit pattern shifts synchronously to the right (or left, depending on design), with the bit from the last stage looping back to the first, maintaining the total number of states equal to the number of stages.[6][5] The clock thus controls the timing of this circular shift, producing a sequence of distinct states that cycles repeatedly without external count logic.[6] For a four-stage ring counter initialized to 1000, the operation proceeds as follows: after the first clock pulse, the state shifts to 0100; the second pulse yields 0010; the third results in 0001; and the fourth returns to 1000, completing the cycle and demonstrating four unique states.[6][5]| Clock Pulse | State |
|---|---|
| 0 (Initial) | 1000 |
| 1 | 0100 |
| 2 | 0010 |
| 3 | 0001 |
| 4 | 1000 |
Types of Ring Counters
Straight Ring Counter
The straight ring counter, also known as a one-hot counter, consists of a series of D flip-flops connected in a loop where the output of the last flip-flop (Q_n) is directly fed back to the input of the first flip-flop (D_1), enabling the circulation of a single logic '1' bit through the stages.[10][11] This configuration forms a closed loop that shifts the active bit synchronously with each clock pulse, generating a sequence of unique states equal to the number of flip-flops.[6] In operation, the counter begins with a single '1' in one position and zeros elsewhere, and on each rising clock edge, this '1' shifts to the next flip-flop, eventually returning to the starting position after traversing all stages.[10] This cyclic shifting produces a one-hot output pattern, where exactly one output is high at any time, making it suitable for applications requiring sequential timing signals.[11] For a 4-stage example, the sequence progresses as follows: from initial state 1000 to 0100, then 0010, 0001, and back to 1000.[6] The state diagram illustrates this as a circular path with four distinct states connected by clock-triggered transitions, each representing the position of the circulating '1'.[10] The corresponding truth table for a 4-bit straight ring counter is:| Clock Cycle | Q3 | Q2 | Q1 | Q0 |
|---|---|---|---|---|
| 0 (Initial) | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 |
| 3 | 0 | 0 | 0 | 1 |
| 4 | 1 | 0 | 0 | 0 |
Twisted Ring Counter
The twisted ring counter, also known as the Johnson counter, is a modified form of ring counter where the feedback connection inverts the output of the last flip-flop (Q_n bar) and feeds it to the input of the first flip-flop, creating a circulating pattern that differs from the direct feedback in a straight ring counter.[12][6] This inversion enables the counter to produce 2N distinct states using N flip-flops, effectively doubling the sequence length relative to a conventional ring counter with the same number of stages.[13][14] In terms of state generation, the twisted ring counter operates by shifting a serial pattern through the flip-flops on each clock pulse, where the inversion causes the binary sequence to build up consecutive '1's from the leading end while clearing '1's from the trailing end in a complementary manner.[12][6] For instance, in a four-bit twisted ring counter initialized to all zeros, the states cycle as follows: 0000 → 1000 → 1100 → 1110 → 1111 → 0111 → 0011 → 0001 → 0000, forming a self-correcting loop that returns to the initial state after 8 cycles.[12][14] This progression highlights the counter's ability to traverse a longer path without requiring external reset logic beyond initial setup.[13] Due to its non-one-hot output encoding—where multiple flip-flops may be active simultaneously—the twisted ring counter requires supplementary decoding circuitry, such as combinational logic gates, to interpret and utilize the full range of states for applications like sequence generation or division.[6][12] This added logic ensures reliable state identification, though it introduces minor complexity in implementation compared to simpler circulating patterns.[14]Properties and Characteristics
Key Properties
Ring counters exhibit a constant propagation delay, as the circulating signal travels a fixed distance around the loop regardless of the number of stages, in contrast to binary counters where carry propagation can vary and increase with bit length.[5] Straight ring counters require explicit initialization to a valid one-hot state, such as presetting a single flip-flop to logic high while clearing the others, to ensure proper operation; otherwise, invalid states may lead to erratic cycling. In contrast, twisted ring counters (also known as Johnson counters) demonstrate self-starting behavior, capable of initializing from an all-zeros state without external intervention due to their inverted feedback mechanism.[6][5] A key characteristic of ring counters is their density trade-off: a straight ring counter with flip-flops supports exactly unique states, while a twisted variant supports states, making them less hardware-efficient than binary counters, which require only flip-flops for states (up to ). For instance, three flip-flops in a straight ring configuration yield only three states, whereas the same in binary form can represent eight.[5] Due to their synchronous design, where all flip-flops are clocked simultaneously, ring counters produce glitch-free outputs that transition cleanly on clock edges, avoiding the asynchronous ripple effects common in non-synchronous designs. This synchronous operation also enhances noise immunity by confining signal changes to precise clock intervals, reducing susceptibility to transient disturbances compared to asynchronous alternatives.[6][15]Advantages and Disadvantages
Ring counters offer simplicity in design compared to binary counters, as they eliminate the need for additional decoding circuitry to identify specific states, with each flip-flop output directly representing a unique state position. This self-decoding property reduces overall hardware complexity and potential points of failure in sequential logic applications.[9] In finite state machines (FSMs), ring counters provide predictable timing due to their fixed shift operation, where the circulating "1" advances one position per clock cycle, enabling reliable synchronization without variable propagation delays inherent in binary ripple counters. Additionally, in circulating modes, ring counters exhibit low power consumption because only one bit transitions per clock cycle, minimizing dynamic switching activity and energy dissipation relative to counters with multiple simultaneous bit changes.[16][17] Despite these benefits, ring counters suffer from high hardware overhead, requiring n flip-flops to achieve only n distinct states, whereas binary counters use approximately log₂(n) flip-flops for the same state count, leading to poorer area efficiency for larger n. This inefficiency becomes pronounced in applications needing more than a few states, as the linear scaling of flip-flops increases silicon area and cost without exponential state growth.[16][9] Ring counters are also vulnerable to invalid states, such as all zeros or multiple "1"s, which can cause the counter to lock up or fail to cycle properly unless initialized with a single "1" via a reset mechanism, adding extra circuitry for reliability. Their limited state count further restricts scalability, making them unsuitable for high-resolution counting where binary or other encoded counters provide denser implementations. Consequently, ring counters are best suited for small n scenarios where decoding complexity in alternatives outweighs the density penalty.[16][9]Implementation
Logic Diagrams and Circuits
A straight ring counter is typically constructed using a series of D flip-flops connected in a closed loop, where the Q output of each flip-flop drives the D input of the next, and the Q output of the last flip-flop connects back to the D input of the first. All flip-flops share a common clock input to ensure synchronous operation, allowing a single logic '1' to circulate through the stages with each clock pulse. For a 4-bit example, the circuit includes four D flip-flops (labeled FF0 to FF3), with connections: Q0 to D1, Q1 to D2, Q2 to D3, and Q3 to D0; an initial '1' in FF0 shifts to FF1, FF2, FF3, and back to FF0 over four clock cycles.[2][3] The state transition for this straight ring counter follows a simple cyclic sequence, as referenced in the operation principles, with the following truth table illustrating the outputs for a 4-bit configuration starting from an initial state of 1000:| Clock Cycle | FF0 (Q0) | FF1 (Q1) | FF2 (Q2) | FF3 (Q3) |
|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 |
| 3 | 0 | 0 | 0 | 1 |
| 4 | 1 | 0 | 0 | 0 |
| QP | QN | J | K |
|---|---|---|---|
| 0 | 0 | 0 | X |
| 0 | 1 | 1 | X |
| 1 | 0 | X | 1 |
| 1 | 1 | X | 0 |
| QP | QN | S | R |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
