Digital Circuits/Registers and Counters
Let's say we take several latches, and we put them all in a row. We can then connect the outputs of each latch to the inputs of the next latch in the following way: Each clock cycle, the output of one latch goes into the next latch, and the next latch receives the data. In this way, we essentially "shift" each value down the row of latches. This mechanism is called a shift register.
Contents
Registers[edit]
Registers are groups of flipflops (FF), where each flipflop(FF) is capable of storing one bit of information. An nbit register is a group of n flipflops. The basic function of a register is to hold information in a digital system and make it available to the logic elements for the computing process. Registers consist of a finite number of flipflops. Since each flipflop is capable of storing either a "0" or a "1", there is a finite number of 01 combinations that can be stored into a register. Each of those combinations is known as state or content of the register. With flipflops we can store data bitwise but usually data does not appear as single bits. Instead it is common to store data words of n bit with typical word lengths of 4, 8, 16, 32 or 64 bit. Thus, several flipflops are combined to form a register to store whole data words. Registers are synchronous circuits thus all flipflops are controlled by a common clock line. As registers are often used to collect serial data they are also called accumulators. There exist several types of registers as there are 
Shift Registers[edit]
A register in which data is entered or/and taken out in serial form is referred to as SHIFT REGISTER. Information often comes bitwise i.e. one bit at every clock pulse. Shift registers are used to store such data. A shift register has one serial input. Every clock pulse one bit is loaded from serial in into the first flipflop of the register while all the actual flipflop contents are shifted to the next flipflop, dropping the last bit. Shift registers may feature a serial output so that the last bit that gets shifted out of the register can be processed further. It is thus possible to build up a chain of shift registers by connecting each serial out to another shift register's serial in, effectively creating a single big shift register. It is also possible to create a Cyclic register (see next paragraph) by connecting the serial out to the same register's serial in. Shift register circuits may also feature additional parallelin functionality that allows manipulation of individual bits. If the output of all flipflops (and therefore the register’s complete content) are read from the lines Q1 to Qn the register is used as Serial In – Parallel Out (SIPO). A typical purpose for such a SIPO register is to collect data that is delivered bitwise and that is needed in nbit data words (e.g. to convert the signals from serial ports of a computer: the line transports 1 bit a time, the computer uses 8, 16 or 32 bit datawords). Shifting bits are important for mathematical operations: if the output of the whole register is interpreted as a binary number, shifting by one bit corresponds to multiplying or dividing by 2 (depends on which flipflop is interpreted as MSB).there are 4 types of shift registersSerial Inparallel Out(SIPO),Serial InSerial Out(SISO),Parallel InSerial Out(PISO),Parallel InParallel Out(PIPO).草拟吗
Cyclic Registers[edit]
Sometimes it is necessary to “recycle” the same values again and again. Thus the bit that usually would get dropped is fed to the register input again to receive a cyclic serial register.
Parallel InSerial Out[edit]
As there is a need for serial – parallel conversion the inverse operation is equally required. It is done by a Parallel In – Serial Out register (PISO) that allows loading data as whole data words and serial shifting. For this operation it needs two control lines: one to trigger the shifting and one to control when a new data word is loaded to the register. it is prepared by clearing all the status of the flipflops output by using a clear function i.e. each flipflop is equals to 0 then shifting it by taking a single bit of the given input that input shifts the present bits in the flipflop to the next flipflop.
Barrel Shifters[edit]
A barrel shifter is a digital circuit that can shift a data word by a specified number of bits in one clock cycle. It can be implemented as a sequence of multiplexers (mux.), and in such an implementation the output of one mux is connected to the input of the next mux in a way that depends on the shift distance. For example, take a 4bit barrel shifter, with inputs A, B, C and D. The shifter can cycle the order of the bits ABCD as DABC, CDAB, or BCDA; in this case, no bits are lost. That is, it can shift all of the outputs up to three positions to the right (and thus make any cyclic combination of A, B, C and D). The barrel shifter has a variety of applications, including being a useful component in microprocessors (alongside the ALU). A common usage of a barrel shifter is in the hardware implementation of floatingpoint arithmetic. For a floatingpoint add or subtract operation, the significand of the two numbers must be aligned, which requires shifting the smaller number to the right, increasing its exponent, until it matches the exponent of the larger number. This is done by subtracting the exponents, and using the barrel shifter to shift the smaller number to the right by the difference, in one cycle. If a simple shifter were used, shifting by n bit positions would require n clock cycles.
Cascade Shifters[edit]
Cascade shifters are circuits that switch contents of each serial in parallel out register be means of a decoder.
Counters[edit]
A counter is a sequential circuit that – counts. That means it proceeds through a predefined sequence of states where the state of the circuit is determined by the states of all its flip flops. As every state of the circuit can be a given number, we can say that a counter produces a sequence of numbers. A commonly used approach is to interpret a circuit's state as dual number, so if flipflop A,B and C are all 0 the counter’s state is 0. if A is 1, B is 0 and C is 1 the counter’s state is 101 = 5 and so on. The most basic counters will simply increment by 1 with every clock pulse, so after state 100 it will go to 101; the next pulse will let it switch to 110 etc. It is possible to design counters with any needed counting sequence. Even though asynchronous sequential circuits are not subject of this course the asynchronous counter is presented here exceptionally to give a slight impression by mahendra Nyaupane

Example.jp
</gallery> </gallery> </gallery>
Basically counters are of two types:[edit]
 Asynchronous or ripple counter
 synchronous counter
Asynchronous Counters
For these counters an external clock signal is applied to one flipflop, and then the output of the preceding flipflop is connected to the clock of the next flipflop. The clock is applied to first flip flop.
For example, consider a T Flip Flop(FF) based ripple counter. The clock is applied to the first FF in the series, and the T input is set to 1. The output Q of the first FF is then connected as the Clock input to the second FF. This effectively halves the clock input to the second FF and causes it to toggle whenever the preceding FF hits 0(after 1). This is known as the ripple action, that is, the toggle ripples across all subsequent FFs, effectively giving rise to what we know as the counting operation.
A beautiful example demonstrating this functionality can be found here.[1]
Synchronous counter[edit]
In synchronous counter all the flip flops receive the external clock pulse simultaneously. Ring counter and Johnson counter are the examples of synchronous counters. in synchronous circuits, the external clock applied to all the flip flops is in synchronisation with the circuit. This section of the Digital Circuits wikibook is a stub. You can help by expanding this section. If you add something, list yourself as a Contributor. njnjnjnjn