Professional Documents
Culture Documents
By : Eng. Lina
11/14/2013
1
2008 The McGraw-Hill Companies, Inc. All rights reserved.
Benefits of registers
Flip-flops are limited because they can store only one bit. Most computers work with integers and single-precision floatingpoint numbers that are 32 /64-bits long. A register is an extension of a flip-flop that can store multiple bits. Registers are commonly used as temporary storage in a processor. They are faster and more convenient than main memory. More registers can help speed up complex calculations.
11/14/2013
A basic register
Basic registers are easy to build. Registers are made using multiple flip-flops . We can store multiple bits just by putting a bunch of flipflops together! A 4-bit register is shown on the right, and its internal implementation is below. This register uses D flip-flops its easy to store data without worrying about flip-flop input equations. All the flip-flops share a common CLK and CLR (RESET) signals.
11/14/2013
Registers
Another way to represent a 4-bit register I0 You could see the timing diagram in the following Slide .
D R D R
A0
I1
A1
I2
D R
A2
I3 CLK
11/14/2013 4
D R
A3
Reset
Registers CLK I3
I0
D R
A0
I2
I1 I0 A3 A2 A1 A0
11/14/2013
I1
D R
A1
I2
D R
A2
I3
Note: New data has to go in with every clock 5
D R
A3
CLK Reset
LD 0 1
11/14/2013
Shift Register
The binary information in a register can be - in addition to storing-can be moved from stage to stage within the register or into or out of the register upon application of clock pulses. This type of bit movement or shifting is essential for certain arithmetic and logic operations used in microprocessors. Shift Register :a group of FFs arranged so that binary numbers stored in the FFs can be shifted from one FF to the next FF, for every clock pulse.
11/14/2013
Shift registers
SI is an input that supplies a new bit to shift into the register. For example, if on some positive clock edge we have: SI = 1 Q0-Q3 = 0110 then the next state will be: Q0-Q3 = 1011
11/14/2013
Shift direction
Q0(t+1) = SI Q1(t+1) = Q0(t) Q2(t+1) = Q1(t) Q3(t+1) = Q2(t)
The circuit and example make it look like the register shifts right.
Present Q0-Q3 ABCD SI X Next Q0-Q3 XABC
But it really depends on your interpretation of the bits. If you consider Q3 to be the most significant bit instead, then the register is shifting in the opposite direction!
Present Q3-Q0 DCBA SI X Next Q3-Q0 CBAX
11/14/2013
Shift registers can be classified into: Shift right registers. Shift left registers. Serial in/Serial out shift registers. Serial in/Parallel out shift registers. Parallel in/Serial out shift registers. Parallel in/Parallel out shift registers. Universal shift registers.
11/14/2013
10
Serial in
10 01 10 01 11 11 11 1 1 1 0 1 0 1 1 1 1
Parallel in
11/14/2013
11
2008 The McGraw-Hill Companies, Inc. All rights reserved.
QUIZ
Q#1This represents a ___ register. Q#2This represents a ___ register. Q#3This represents a ___ register. Q#4- This represents a ___ register. a. Parallel-in, parallel-out a. Parallel-in, parallel-out a. Parallel-in, serial a. Parallel-in, serialout out b. Serial-in, parallel-out b. Serial-in, serial-out b. parallel-out b. Serial-in, Parallel-in, parallel-out
ANS: serial-in parallel-out ANS: serial-in serial-out ANS: parallel-in serial-out ANS: parallel-in parallel-out
11/14/2013
12
2008 The McGraw-Hill Companies, Inc. All rights reserved.
Note the use of D FFs. Clock (CLK) inputs wired in parallel. Clear (CLR) inputs can be activated with LOW or disabled with HIGH. Preset (PS) inputs deactivated.
11/14/2013 13
2008 The McGraw-Hill Companies, Inc. All rights reserved.
QUIZ
QUESTION #7 #2 #3 #4 #6 #5 QUESTION #1 What is the 4-bit output (bit A on left, D on right) after pulse 6? 1? 2? 3? 5? 4? This is a ___ type shift register. A. Serial-in, parallel out A: Serial-in, parallel-out A: 0100 1000 1100 0000 A: 0010 1001 B. Parallel-in, serial-out
Data Data = =1 1 0 0 Data Data = 1 Clock ClockPulse Pulse Pulse 2 4 3 Clock Clock Pulse 6 5 1 Clear Clear Clear = = =1 1 1 Clear 0
11/14/2013
14
2008 The McGraw-Hill Companies, Inc. All rights reserved.
Serial SI D Input
SO Serial Output
CLK
Serial Input
Serial Output
11/14/2013
15
SI
SO
CLK
CLK SI Q3 Q2 Q1
11/14/2013 Q 0 16
In order to get the data out of the register, they must be shifted out serially. This can be done destructively or non-destructively. For destructive readout, the original data is lost and at the end of the read cycle, all flip-flops are reset to zero.
The data is loaded to the register when the control line is HIGH =1 (i.e WRITE).
The data can be shifted out of the register when the control line is LOW (ie READ).
11/14/2013
19
serial device
computer
11/14/2013 20
computer
serial device
11/14/2013
21
COUNTERS
11/14/2013
22
Counters
A Counter : is a register that goes through a prescribed series of states It stores (and sometimes displays) the number of times a particular event or process has occurred, often in relationship to a clock signal. the flip-flop s values themselves, serves as the output in a counter. The output value increases by one on each clock cycle. After the largest value, the output wraps around back to 0. Using two bits, wed get something like this:
Present State A B 0 0 1 1 0 1 0 1 Next State A B 0 1 1 0 1 0 1 0
00 1 11
01 1
10
11/14/2013
Benefits of counters
Counters can act as simple clocks to keep track of time. You may need to record how many times something has happened. How many bits have been sent or received? How many steps have been performed in some computation? All processors contain a program counter, or PC. Common tasks of counter Count up or down Increment or decrement count Divide frequency As temporary memory Applications: COUNTERS Watches Clocks Alarms Web browser refresh
SYNCHRONOUS
ASYNCHRONOUS
11/14/2013
24
Classifications of Counters
Asynchronous Counters
subsequent flip-flops are clocked by the output of the preceding flip-flop. Asynchronous counters are slower than synchronous counters because of the delay in the transmission of the pulses from flipflop to flip-flop. Asynchronous counters are also called ripple-counters because of the way the clock pulse ripples it way through the flip-flops.
Synchronous Counters
All flip-flops are simultaneously clocked by an external clock. Synchronous counters are faster than asynchronous counters
because of the simultaneous clocking. Synchronous counters are an example of a state machines design.
Characteristics of Counters
Binary counter Counter that follows a binary sequence N bit binary counter counts in binary from n to 2n-1
Number of bits (4-bit, 8-bit, etc.) Maximum count 4 bit = 24 = 0000 to 1111 in binary 8 bit = 28 = 0000 0000 to 1111 1111 in binary Modulus of counter-number of states Decade counter 4-bit 8-bit Up or down counter
QUIZ
1. A 4-bit counter will count from binary 0000 to __________. 1111
True
Ripple Counter
In Ripple Counters :
All the states of the FF do not change at the same time. When the output state of the preceding FF changes it will trigger the next state to change. due to the way the FFs respond one after another it is a kind of rippling effect.
Ripple Counter
Binary Output
Clock Input
0 0 1 1 0 1 0 1
Pulse 8 1 2 3 4 5 6 7
All J-K PS and CLR inputs This On flip-flops the 4-bit next counter clock has pulse 16(8) states all FFs and in the are each willwill count toggle from because binary 0000 will through receive 1111 TOGGLE MODE INACTIVE a H-to-L and then pulsereset one back after to 0000. another. Watch Thethe counter counthas ripple a modulus thru the ofcounter. 16.
0 1 0 0 1 0 1
Pulse 5 1 2 3 4
Clock input
FFs triggered on 1s output H-to-L pulse. CLK toggles 1s FF. 1s FF toggles 2s FF. 2s output 2s FF toggles 4s FF. 4s output
QUIZ
Q#1After pulse 1 the output of the ripple Q#2After pulse 2 the output of the ripple Q#3After pulse 8 the output of the ripple Q#4After pulse 15 the output of the ripple counter will be binary ___. counter will be binary ___. counter counterwill willbe bebinary binary___. ___.
0 0 0 1 0 0 1 0 0 1 0 1
Input Pulse PulsePulses 15 1 2 8