• No results found

Systems I: Computer Organization and Architecture

N/A
N/A
Protected

Academic year: 2021

Share "Systems I: Computer Organization and Architecture"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

Systems I: Computer

Organization and Architecture

Lecture 8: Registers and Counters

Registers • A register is a group of flip- flops.

– Each flip- flop stores one bit of data; n flip- flops are required to store n bits of data.

– There are several different types of registers available commercially.

– The simplest design is a register consisting only of flip-flops, with no other gates in the circuit.

• Loading the register – transfer of new data into the register.

• The flip- flops share a common clock pulse (frequently using a buffer to reduce power requirements).

• Output could be sampled at any time.

• Clearing the flip-flop (placing zeroes in all its bit) can be done through a special terminal on the flip- flop.

(2)

4-bit Register D C Q D C Q D C Q D C Q A0 A1 A2 A3 Clock Clear I0 I1 I2 I3

Registers With Parallel Load

• The clock usually provides a steady stream of pulses which are applied to all flip-flops in the system. • A separate control system is needed to determine

when to load a particular register.

• The Register with Parallel Load has a separate load input.

– When it is cleared, the register receives it output as input. – When it is set, it received the load input.

(3)

4-bit Register With Parallel Load D C Q D C Q D C Q D C Q A0 A1 A2 A3 Clock I0 I1 I2 I3 Load

Shift Registers

• A shift register is a register which can shift its data in one or both directions.

• The simplest shift register simply connects the flip-flops to their respective neighbor with the clock controlling the operation. • If we wish to shift on some clock pulses but

not others, we can inhibit the clock pulses on which we do not to shift.

(4)

4-Bit Shift Register D C Q D C Q D C Q D C Q Serial Input Serial Output Clock

Serial Transfer

• A digital system is operating in a serial mode when information is transferred and manipulated one bit at a time, with bits transferred out of the source register into the destination register.

• This is different from parallel transfer where all the bits of a register are transferred at once.

• Serial transfer of information from register A to register B is done with shift registers, where the serial output from register A serves as the serial input for register B.

(5)

Serial Transfer From Register A to Register B Shift Register A Shift Register B SI SO SI SO CLK CLK Clock Shift control Clock Shift control CLK T1 T2 T3 T4

Serial Transfer – State Table

1 0 1 1 1 0 1 1 After T4 0 1 1 0 0 1 1 1 After T3 1 1 0 0 1 1 1 0 After T2 1 0 0 1 1 1 0 1 After T1 0 0 1 0 1 0 1 1 Initial value Shift Register B Shift Register A Timing Pulse

(6)

Serial Addition

• While operations are usually parallel because it is faster, serial operations require less equipment. • Serial addition can demonstrate this point, allowing

us to perform addition with a single full adder and our two addends stored in a pair of shift registers, with the carry-out going into a D-type flip-flop (and going back in as the carry-in).

• Initially, register A and the carry flip -flop are cleared to 0.

• The augend is initially placed in register B and serial addition is used to place it into register A.

• The sum is placed in shift register A, replacing the augend.

Serial Adder

Shift Register A Shift Register B FA z y x C S D C Clear Q SO SO SI SI Serial input CLK Shift control

(7)

Redesigning the Serial Adder

• We will use a pair of shift registers whose outputs will be x and y respectively. These are corresponding bits of the addends.

• S is the sum bit produced and a flip-flop will hold the carry bit as the flip-flop’s state Q. • We will implement it using a JK flip-flop

State Table for the Serial Adder

0 X 1 1 1 1 1 0 X 0 1 0 1 1 0 X 0 1 1 0 1 1 X 1 0 0 0 1 X 1 0 1 1 1 0 X 0 1 0 0 1 0 X 0 1 0 1 0 0 X 0 0 0 0 0 0 KQ JQ S Q(t+1) Y X Q(t) Present State Inputs Next State Output Flip-flop Inputs

(8)

Karnaugh Map for J

Q 01 00 11 10 1 0 Q xy 1 X X X X JQ= xy

Karnaugh Map for K

Q

01 00 11 10 1 0 Q xy 1 X X X X JQ= x’y’ = (x + y)’

(9)

Karnaugh Map for S

01 00 11 10 1 0 Q xy 1 1 1 1 S = x ⊕y ⊕Q

Serial Adder

Shift Register A Shift Register B C Clear SO = x SO = y SI SI Serial input CLK Shift control K J

(10)

Bi-directional Shift Registers

• A shift register that can shift in one direction is called a unidirectional shift register.

• A shift register that can shift in either direction is called a bi-directional shift register.

• Some shift register also allow for the simple transfer of data.

General Shift Register • The most general shift register have all of these

capabilities:

– An input for clock pulses to synchronize all operations.

– A shift-right operation and serial line input line associated with the shift-right.

– A shift- left operation and serial line input line associated with the shift- left.

– A parallel load operation and n input lines associated with the parallel transfer.

– n parallel output lines.

– A control state that leaves the information in the register unchanged even though the clock pulses are applied.

(11)

Function Table For General Shift Register

Parallel load 1

1

Shift Left (up) 0 1 Shift Right (down) 1 0 No change 0 0 Register operation S0 S1

Bidirectional Shift Register With Parallel Load

D C Q D C Q D C Q D C Q A0 A1 A2 A3 I0 I1 I2 I S0 S1 0 1 2 3 4X1 MUX S0 S1 0 1 2 3 4X1 MUX S0 S1 0 1 2 3 4X1 MUX S0 S1 0 1 2 3 4X1 MUX Serial Input Serial Input S0 S1

(12)

Counters

• A register that goes through a prescribed sequences of states upon the application of an input pulse is called a counter.

• The input pulse may be a clock pulse or may have some other origin.

• A counter that goes through a binary sequence is called a binary counter.

• An n-bit binary counter uses n flip-flops and can count from 0 to 2n-1.

Ripple Counters

• Counters are either ripple counters or synchronous counters.

• In synchronous counters, all flip-flops receive the common clock pulse; therefore they change at the same time.

• In ripple counters, the output of one flip-flop is used as a source for triggering others.

(13)

4-Bit Ripple Counter Using T-Type Flip-flop T C R A0 Count T C R A1 Reset Logic-1 T C R A2 T C R A3

4-Bit Ripple Counter Using JK-Type Flip-flop

J C R A0 Count J C R A1 Reset Logic-1 J C R A2 J C R A3 K K K K

(14)

4-Bit Ripple Counter Using D-Type Flip-flop D C R A0 Count Reset D C R A1 D C R A2 D C R A3

Binary Count Sequence

1 1 1 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 1 1 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 A0 A1 A2 A3

(15)

BCD Ripple Counter

• A binary-coded decimal ripple counter will return to 0 after it reaches 9, this necessarily changes the logic

J C K Q1 Logic-1 Count J C K Q2 J C K Q4 J C K Q8

Three-Decade BCD Counter

BCD Counter Q8Q4 Q2 Q1 BCD Counter Q8Q4 Q2 Q1 BCD Counter Q8Q4 Q2 Q1 Count pulse

(16)

Binary Counters

• A counter is a register that goes through a predetermined sequence of states as input pulses are applied.

• Almost all digital equipment will contain counters; they are used for counting the occurrences of a particular event and are useful in generating timing signals.

• An n-bit counter uses n flip- flops and are have any value in the range 0 to 2n-1.

• We notice in our sequences that the lowest significance bit is complemented with every count and the other bits are complemented from one count to the next when all the lower bits are set.

4-bit Synchronous Binary Counter

J C Q J C Q J C Q J C Q A0 A1 A2 A3 K K K K Count Enable Output carry

(17)

Up-Down Binary Counter

• A count-down binary counter will go through binary states in reverse order.

• E.g., a 4-bit count-down binary counter will start at 0000, go to 1111, then 1110, and so on down to 0000. • As in regular counters, the least significant bit is

always complemented. But higher bits are complemented only if the lower bits are all 0. • We can design a counter that can go in either

direction, depending on the control inputs.

4-Bit Up-Down Binary Counter T C T C T C T C Clock Up Down A0 A1 A2 A3

(18)

BCD Counter

• BCD counters only go through states 0000 to 0001 up to 1001.

• The pattern is as regular as binary counter, so we must go through the design process.

State Table for BCD Counter

X X X X 0 X X X X 0 1 1 1 X X X X 0 X X X X 1 0 1 1 X X X X 0 X X X X 0 0 1 1 X X X X 0 X X X X 1 1 0 1 X X X X 0 X X X X 0 1 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 0 0 1 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 TQ1 TQ2 TQ4 TQ8 y Q1 Q2 Q4 Q8 Q1 Q2 Q4 Q8

(19)

Karnaugh Map For TQ

8 01 11 10 00 01 11 10 00 X X X X X X 1 1 TQ8= Q8Q1+ Q4Q2Q1 Q8Q4 Q2Q1

Karnaugh Map For TQ

4

01 11 10 00 01 11 10 00 X X X X X X 1 1 TQ4= Q2Q1 Q8Q4 Q2Q1

(20)

Karnaugh Map For TQ

2 01 11 10 00 01 11 10 00 X X X X X X 1 TQ2= Q8’Q1 1 1 1 Q8Q4 Q2Q1

Karnaugh Map For TQ

1

01 11 10 00 01 11 10 00 X X X X X X 1 T = 1 1 1 1 Q8Q4 Q2Q1 1 1 1 1 1 1

(21)

4-Bit Counter With Parallel Load &

Synchronous Clear

• Counters often need to be preset with a pre-specified value before counting begins.

• We also need the capability of clearing all bits simultaneously.

Function Table For 4-Bit Parallel

Load Counter

Clear outputs X X 1 ↑ Load inputs I0 through I3 X 1 0 ↑ Increment count 1 0 0 ↑ No change 0 0 0 ↑ Operation Count Load Clear Clock

(22)

J C Q J C Q J C Q J C Q A0 A1 A2 A3 Clock K K K K Load Count I0 I1 I2 I3

4-bit counter with parallel load & synchronous clear

Clear

Counters With Unused States

• An n-bit counter has 2n states, but there are occasions when we wish to use less than the total number of states available.

• The unused states may be treated as “don’t-care” conditions (or assigned to specific next states).

• Because outside interference may land the counter in these states, we must ensure that the counter can find its way back to a valid state.

(23)

State Table For Counter With Unused States X 0 1 X 1 X 0 0 0 0 1 1 X X X X X X 0 0 0 1 1 1 1 X X 1 0 X 0 1 1 1 0 1 X 1 X 0 0 X 1 0 1 0 0 1 X X X X X X 0 0 1 1 1 0 X 0 1 X X 1 0 0 1 0 1 0 1 X X 1 X 0 0 1 0 1 0 0 X 1 X 0 X 0 1 0 0 0 0 0 KC JC KB JB KA JA C B A C B A Next State

Present State Flip-flop Inputs

Karnaugh Maps for J

A

and K

A

BC A 00 01 11 10 0 1 X X X X 1 X BC A 00 01 11 10 0 1 X X X X 1 X KA= B JA= B

(24)

Karnaugh Maps for J

B

and K

B BC A 00 01 11 10 0 1 X X X 1 1 X BC A 00 01 11 10 0 1 X X X X 1 X KB= 1 JB= C X 1

Karnaugh Maps for J

C

and K

C

BC A 00 01 11 10 0 1 X X X 1 1 X BC A 00 01 11 10 0 1 X X X X 1 X KC= 1 JC= B’ X 1

(25)

State Diagram For Counter With

Unused States

000 001 010 100 110 101 110 110

Logic Diagram For Counter With

Unused States

C J K J C K J C K B C A Clock Logic 1

(26)

Ring Counter

• Computers need timing signals that indicate the sequence in which certain operations will take place.

• These can be generated by ring counters, circular shift registers with only one flip-flop set at any time.

• The alternative to a 4-bit ring counter is a 2-bit counter that goes through 4 distinct states and uses a decoder.

Ring Counter Vs. Counter and Decoder

T0 T1 T2 T3

Shift right

Ring counter (initial value = 1000)

2 x 4 decoder T1T2 T3 T0 2-bit counter Count enable

(27)

Sequence of Timing Signals From the

Ring Counter

T0 T1 T2 T3 CLK

Switch-tail Ring Counters

• Switch-tail ring counter can double the number of states that a ring counter can provide.

C D A A’ C D B B’ C D C C’ C D E E’

4-stage switch-tail ring counter

(28)

State Table For Switch-tail Counter

C’E 1 0 0 0 8 B’C 1 1 0 0 7 A’B 1 1 1 0 6 AE 1 1 1 1 5 CE’ 0 1 1 1 4 BC’ 0 0 1 1 3 AB’ 0 0 0 1 2 A’E’ 0 0 0 0 1

AND gate required for output E C B A Seq. Num. Flip-flop Outputs

Johnson Counters

C D A A’ C D B B’ C D C C’ C D E E’ CLK Seq. # 1 2 3 4 5 6 7 8

References

Related documents

methylation factors and CVD risk factors (unstimulated and TNF ɑ -stimulated coagulation time along with the resulting unstimulated–stimulated delta difference, platelet–monocyte

Ventilation systems shall be designed to have the capacity to supply the minimum outdoor airflow rate determined in accordance with this section.. The occupant load utilized for

I have also described briefly the working process of white box testing technique and some of its most frequently used techniques that are control flow testing,

In the production of powder metallurgy products magnets, a magnetic field can be used to align the particles prior to sintering, thereby producing a high flux density in

Holland dan Adam (2002) menekankan bahwa pengawasan klinis yang diberikan di sekolah membantu peningkatan pengembangan pengajaran guru sementara pada saat yang

Di pergunakan dua buah pipa yang berlainan ukuran diameternya Di pergunakan dua buah pipa yang berlainan ukuran diameternya sama dengan ulir luar pada posisi luar

Otherwise, Myrbetriq requires a step therapy exception request indicating: (1) history of inadequate treatment response with formulary urinary anticholinergic, OR (2) history

Manufacturing and Mining had high survival in 20 years and low survival in 18 years, meaning that more number of businesses opened rather than closed in 20 out of the 38 years,