Fairchild Semiconductor Application Note February 1990 Revised May 2000 100336 Four-Stage Counter/Shift Register INTRODUCTION Many system designs require bi-directional counting and shifting functions. In most cases these functions are separate and unique requirements within the system design. For this reason, separate catalog parts are available. In some cases however, there is a requirement to have a device that will allow both counting and shifting functions. This is especially true in arithmetic, timing, sequential, or communication applications. Fairchild offers a very versatile counter/shift register in the 100336. This application note describes its function in detail and offers some simple uses. DESCRIPTION The 100336 contains four synchronous, presettable flipflops. Synchronous operation is provided by having all flipflops clocked simultaneously so that all output changes coincide. This mode of operation eliminates counting spikes on the outputs which are normally associated with asynchronous counters. The clock input is buffered and triggers the four flip-flops on the rising (positive-going) edge. The counters are fully programmable allowing the outputs to be set to either a HIGH (1) or LOW (0). As presetting is synchronous, setting low levels on the select inputs (S0-S2) (see Table 1) disables the counter and causes the outputs to agree with the parallel inputs (P3–P0) on the next rising edge of the clock. Loading is accomplished regardless of the levels of the two enables (CEP, CET). TABLE 1. Function Select Table S2 S1 S0 L L L Parallel Load Function L L H Complement L H L Shift Left L H H Shift Right H L L Count Down H L H Clear H H L Count Up H H H Hold © 2000 Fairchild Semiconductor Corporation AN010646 The 100336 features both synchronous and asynchronous clear functions. The synchronous clear is performed by setting a binary five (101B) at the select inputs. On the next rising edge of the clock, the outputs will be forced LOW (0000) regardless of the levels at the enable inputs. A buffered asynchronous master reset (MR) is provided to clear all outputs LOW (0000) regardless of the levels of the clock, select, or enable inputs. Count up/count down functions are selected with the select inputs (S2–S0). These are synchronous operations and the outputs will increment/decrement in value on the rising edge of the clock. Both count enable inputs (CEP, CET) must be true (LOW) to count. The terminal count output (TC) becomes active-LOW when the count reaches zero in the DOWN mode or fifteen in the UP mode. Its duration is approximately equal to one period of the clock. The TC output is not recommended for use as a clock or synchronous reset for flip-flops. See Figure 1 for timing relationships in UP/DOWN counting. In simple ripple-carry cascading applications the terminal count TC is fed forward to enable the trickle enable (CET) input. This method is increasingly inefficient as the counting chain lengthens. The upper limit of the clock frequency is determined by the clock-to-terminal-count delay of the first stage, the cumulative trickle-enable (CET)-to-terminalcount delay of the intermediate stages, and the trickleenable-to-clock delay of the last stage. For faster counting rates a carry-lookahead scheme is necessary. In this scheme the ripple delay through the intermediate stages commences with the same clock that causes the first stage to change over from MAX to MIN in the UP mode, or from MIN to MAX in the DOWN mode. Since the final count cycle takes 16 clocks to complete, there is ample time for the ripple to propagate through the intermediate stages. The critical timing that limits the counting rate is the clockto-terminal-count of the first stage plus the parallel-enableto-clock (CEP) setup time of the last stage. Figure 2 shows the connections for the fast-carry counting scheme. www.fairchildsemi.com AN-684 100336 Four-Stage Counter/Shift Register AN-684 AN-684 TYPICAL CLEAR, LOAD, AND COUNT SEQUENCES Illustrated below is the following sequence: 1. Clear outputs to zero. 2. Load (Preset) to binary thirteen. 4. Count down to one, zero, borrow, fifteen, fourteen, and thirteen. 3. Count up to fourteen, fifteen, carry, zero, one, and two. 5. Inhibit counting. Note: A MR overrides enables, data, and count inputs. FIGURE 1. 100336 Used as Binary Up/Down Counter FIGURE 2. Fast Carry Counting Scheme www.fairchildsemi.com 2 (Continued) input transistor. Instead the input is set at a diode drop below VCC /VCCA for a preset HIGH. See Applications Note 682. Shift right/left modes are performed by making the appropriate selection on the selection inputs (S2–S0). Each rising edge of the clock will cause the outputs to shift once in the direction which is selected. For shift-left operation, input D3 is used as the serial input. For shift-right operation, input CET/D0 is used as the serial input. During shift operation the terminal count output reflects the level at the Q3 output and the enables are “don't cares”. See Figure 3 for shift operation timing relationships and shift sequences. Unused output pairs (Qn/Qn) may be left unterminated. However, unused single outputs should be terminated to balance current switching in the outputs. For further details on system design considerations refer to the F100K ECL Design Guide. For AC/DC performance specifications and critical timing parameters refer to the 100336 datasheet. The 100336 provides two special modes of operation. The complement mode performs a one's complement of the outputs (Q3–Q 0) on the rising edge of the clock input regardless of the levels at the enable inputs. The hold feature is asynchronous and simply stops counting or shifting operations. Both complement and hold are performed with proper selection of the select inputs. For a complete truth table of the 100336 operation, refer to Table 2. APPLICATIONS Figure 4 and Figure 5 demonstrate the use of the 100336 as UP/DOWN BCD counters. One additional gate is required to detect the limit count. Notice the alternate gate methods in Figure 4. The 100304 shows the classical AND/ NAND design similar to TTL and the 100302 shows the OR/NOR design of ECL. Figure 6 incorporates the use of a 100331 triple D-type flipflop. By using one stage of the 100331, a 50/50 duty cycle can be realized from the divider. DESIGN CONSIDERATIONS Presetting the parallel inputs (P3–P 0) may require a mixture of HIGH's and LOW's. A LOW may be preset by leaving the respective input open as the 100336 has a 50 kΩ resistor to VEE on the parallel inputs. A HIGH must never be made by tying the input to VCC/VCCA. This saturates the An 8-bit parallel-to-serial shifter can be constructed by cascading two 100336's as shown in Figure 7. The third counter reloads another 8-bit data word after eight serial counts. 3 www.fairchildsemi.com AN-684 TYPICAL CLEAR, LOAD, AND COUNT SEQUENCES AN-684 TYPICAL, CLEAR, LOAD, AND COUNT SEQUENCES Illustrated below is the following sequence: 1. Clear outputs to zero. 3. Shift-left using D3 as serial input. 2. Load (preset) to binary twelve. 4. Shift-right using CET/D0 as serial input. Note: In shift-right mode TC follows the Q3 output. Note: In shift-left mode TC follows the D3 input. Note: CEP is a “don't care” during shifting. FIGURE 3. 100336 Used as Bi-Directional Shift Register www.fairchildsemi.com 4 AN-684 TRUTH TABLE Q0 = LSB TABLE 2. Truth Table Inputs Outputs MR S2 S1 S0 CEP D0/CET D3 L L L L X X X L L L H X X X L L H L X X X L L H H X X X L H L L L L X L H L L H L X CP Q3 Q2 Q1 Q0 TC P3 P2 P1 P0 L Q3 Q2 Q1 Q0 L D3 Q3 Q2 Q1 D3 Q2 Q1 Q0 D0 X Q3 Q2 Q1 Q0 Q3 Q2 Q1 Q0 H Count Down with CET not active L L L L H Clear X (Q0–Q3) minus 1 Mode Preset (Parallel Load) Invert Shift Left Q3 Shift Right (Note 1) 1 Count Down 1 Count Down with CEP not active L H L L X H X L H L H X X X L H H L L L X L H H L H L X L H H L X H X L H H H X X X H L L L X X X X H L L H X X X X L L L L L H L H L X X X X L L L L L H L H H X X X X L L L L L Asynchronous H H L L X L X X L L L L L Master Reset H H L L X H X X L L L L H H H L H X X X X L L L L H H H H L X X X X L L L L H H H H H X X X X L L L L H 2 Count Up Q3 Q2 Q1 Q0 2 Count Up with CEP not active X Q3 Q2 Q1 Q0 H Count Up with CET not active X Q3 Q2 Q1 Q0 H Hold L L L L L X (Q0–Q3) plus 1 1 = L if Q0–Q3 = LLLL H if Q0–Q3 ≠ LLLL 2 = L if Q0–Q3 = HHHH H if Q0–Q3 ≠ HHHH H = HIGH Voltage Level L = LOW Voltage Level X = Don't Care = LOW-to-HIGH Transition Note 1: Before the clock, TC is Q3 After the clock, TC is Q2 FIGURE 4. BCD Up Counter (0–9) 5 www.fairchildsemi.com AN-684 FIGURE 5. BCD Down Counter (9–0) FIGURE 6. Divide by Five FIGURE 7. 8-Bit Shift Left www.fairchildsemi.com 6 AN-684 100336 Four-Stage Counter/Shift Register Fairchild does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and Fairchild reserves the right at any time without notice to change said circuitry and specifications. LIFE SUPPORT POLICY FAIRCHILD’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF FAIRCHILD SEMICONDUCTOR CORPORATION. As used herein: 2. A critical component in any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness. 1. Life support devices or systems are devices or systems which, (a) are intended for surgical implant into the body, or (b) support or sustain life, and (c) whose failure to perform when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in a significant injury to the user. www.fairchildsemi.com 7 www.fairchildsemi.com