a2-ch15
a2-ch15
Key terms
CISC – complex instruction set computer.
RISC – reduced instruction set computer.
Pipelining – allows several instructions to be processed simultaneously without having to wait
for previous instructions to finish.
Parallel processing – operation which allows a process to be split up and for each part to be
executed by a different processor at the same time.
SISD – single instruction single data, computer architecture which uses a single processor and
one data source.
SIMD – single instruction multiple data, computer architecture which uses many processors
and different data inputs.
MISD – multiple instruction single data, computer architecture which uses many processors
but the same shared data source.
MIMD – multiple instruction multiple data, computer architecture which uses many
processors, each of which can use a separate data source.
Cluster – a number of computers (containing SIMD processors) networked together.
Super computer – a powerful mainframe computer.
Massively parallel computers – the linking together of several computers effectively forming
one machine with thousands of processors.
15.1.1 RISC and CISC processors
Early computers made use of the Von Neumann architecture (see Chapter 4). Modern advances
in computer technology have led to much more complex processor design. Two basic
philosophies have emerged over the last few years
• developers who want the emphasis to be on the hardware used: the hardware should be chosen
to suit the high-level language development
• developers who want the emphasis to be on the software/instruction sets to be used: this
philosophy is driven by ever faster execution times.
The first philosophy is part of a group of processor architectures known as CISC (complex
instruction set computer). The second philosophy is part of a group of processor architectures
known as RISC (reduced instruction set computer).
CISC processors
CISC processor architecture makes use of more internal instruction formats than RISC. The
design philosophy is to carry out a given task with as few lines of assembly code as possible.
Processor hardware must therefore be capable of handling more complex assembly code
instructions. Essentially, CISC architecture is based on single complex instructions which need
to be converted by the processor into a number of sub-instructions to carry out the required
operation.
For example, suppose we wish to add the two numbers A and B together, we could write the
following assembly instruction:
This methodology leads to shorter coding (than RISC) but may actually lead to more work being
carried out by the processor.
RISC processors
RISC processors have fewer built-in instruction formats than CISC. This can lead to higher
processor performance. The RISC design philosophy is built on the use of less complex
instructions, which is done by breaking up the assembly code instructions into a number of
simpler single-cycle instructions. Ultimately, this means there is a smaller, but more optimised
set of instructions than CISC. Using the same example as above to carry out the addition of two
numbers A and B (this is the equivalent operation to ADD A, B):
Pipelining
One of the major developments resulting from RISC architecture is pipelining. This is one of the
less complex ways of improving computer performance. Pipelining allows several instructions to
be processed simultaneously without having to wait for previous instructions to be completed. To
understand how this works, we need to split up the execution of a given instruction into its five
stages
1 instruction fetch cycle (IF)
2 instruction decode cycle (ID)
3 operand fetch cycle (OF)
4 instruction execution cycle (IE)
5 writeback result process (WB).
To demonstrate how pipelining works, we will consider a program which has six instructions (A,
B, C, D, E and F). Figure 15.1 shows the relationship between processor stages and the number
of required clock cycles when using pipelining. It shows how pipelining would be implemented
with each stage requiring one clock cycle to complete.
Figure 15.1
This functionality clearly requires processors with several registers to store each of the stages.
Execution of an instruction is split into a number of stages. During clock cycle 1, the first stage
of instruction 1 is implemented. During clock cycle 2, the second stage of instruction 1 and the
first stage in instruction 2 are implemented. During clock cycle 3, the third stage of instruction 1,
second stage of instruction 2 and first stage of instruction 3 are implemented. This continues
until all instruction are processed.
In this example, by the time instruction ‘A’ has completed, instruction ‘F’ is at the first stage and
instructions ‘B’ to ‘E’ are at various in-between stages in the process. As Figure 15.1 shows, a
number of instructions can be processed at the same time, and there is no need to wait for an
instruction to go through all five cycles before the next one can be implemented. In the example
shown, the six instructions require 10 clock cycles to go to completion. Without pipelining, it
would require 30 (6 × 5) cycles to complete (since each of the six instructions requires five
stages for completion).
Interrupts
In Chapter 4, we discussed interrupt handling in processors where each instruction is handled
sequentially before the next one can start (five stages for instruction ‘A’, then five stages for
instruction ‘B’, and so on).
Once the processor detects the existence of an interrupt (at the end of the fetch-execute cycle),
the current program would be temporarily stopped (depending on interrupt priorities), and the
status of each register stored. The processor can then be restored to its original status before the
interrupt was received and serviced.
However, with pipelining, there is an added complexity; as the interrupt is received, there could
be a number of instructions still in the pipeline. The usual way to deal with this is to discard all
instructions in the pipeline except for the last instruction in the write-back (WB) stage.
The interrupt handler routine can then be applied to this remaining instruction and, once
serviced, the processor can restart with the next instruction in the sequence. Alternatively,
although much less common, the contents of the five stages can be stored in registers. This
allows all current data to be stored, allowing the processor to be restored to its previous status
once the interrupt has been serviced.
15.1.2 Parallel processing
Parallel processor systems
There are many ways that parallel processing can be carried out. The four categories of basic
computer architecture presently used are described below.
SISD (single instruction single data)
SISD (single instruction single data) uses a single processor that can handle a single instruction
and which also uses one data source at a time. Each task is processed in a sequential order. Since
there is a single processor, this architecture does not allow for parallel processing. It is most
commonly found in applications such as early personal computers.
Figure 15.6 Typical massively parallel computer (processor) system showing interconnected pathways
EXTENSION ACTIVITY 15B
1 Find out more about the applications of multi-computer systems (cluster and massively
parallel computers). In particular, research their uses in seismology, astronomy, climate
modelling, nuclear physics and weather forecasting models.
2 Look at Figure 15.7. Determine, from research, the main reasons for the almost linear
expansion in the processing speed of computers over the last 25 years. The data in the graph
compares Number of calculations per second against Year.
Figure 15.7
ACTIVITY 15A
1 a) Describe why RISC is an important development in processor technology.
b) Describe the main differences between RISC and CISC technologies.
2 a) What is meant by the Von Neumann bottleneck?
b) How does the Von Neumann bottleneck impact on processor performance?
3 a) What are the main differences between cluster computers and massively parallel
computers?
b) Describe one application which uses massively parallel computers. Justify your choice of
answer.
4 A processor uses pipelining. The following instructions are to be input
1 LOAD A
2 LOAD B
3 LOAD C
4 ADD A,B,C
5 STORE D
6 OUT D
Draw a diagram to show how many clock cycles are needed for these six instructions to be
carried out. Compare your answer to the number of clock cycles needed for a processor
using sequential processing.
15.2 Boolean algebra and logic circuits
Key terms
Half adder circuit – carries out binary addition on two bits giving sum and carry.
Full adder circuit – two half adders combined to allow the sum of several binary bits.
Combination circuit – circuit in which the output depends entirely on the input values.
Sequential circuit – circuit in which the output depends on input values produced from
previous output values.
Flip-flop circuits – electronic circuits with two stable conditions using sequential circuits.
Cross-coupling – interconnection between two logic gates which make up a flip-flop.
Positive feedback – the output from a process which influences the next input value to the
process.
Sum of products (SoP) – a Boolean expression containing AND and OR terms.
Gray codes – ordering of binary numbers such that successive numbers differ by one bit value
only, for example, 00 01 11 10.
Karnaugh maps (K-maps) – a method used to simplify logic statements and logic circuits –
uses Gray codes.
Figure 15.8
2 Draw a simplified version of the logic circuit shown in Figure 15.9 and write the Boolean
expressions to represent Figure 15.9 and your simplified version.
Figure 15.9
3 The warning light on a car comes on (= 1) if either one of three conditions occur
• sensor1 AND sensor2 detect a fault (give an input of 1) OR
• sensor2 AND sensor3 detect a fault (give an input of 1) OR
• sensor1 AND sensor3 detect a fault (give an input of 1).
a) Write a Boolean expression to represent the above problem.
b) Give the logic circuit to represent the above system.
c) Produce a truth table and check your answers to parts a) and b) agree.
15.2.1 Boolean algebra
Boolean algebra is named after the mathematician George Boole. It is a form of algebra linked to
logic circuits and is based on the two statements:
TRUE (1)
FALSE (0)
The notation used in this book to represent these two Boolean operators is:
Table 15.2 summarises the rules that govern Boolean algebra. It also includes De Morgan’s
Laws. Also note that, in Boolean algebra, 1 + 1 = 1, 1 + 0 = 1, and = A (remember your logic
gate truth tables in Chapter 3).
(A + B).(A + C) = A + B.C
Tautology/Idempotent Laws A.A = A A+A=A
Tautology/Identity Laws 1.A = A 0+A=A
Tautology/Null Laws 0.A = 0 1+A=1
Tautology/Inverse Laws A.Ā = 0 A+Ā=1
Absorption Laws A.(A + B) = A A + (A.B) = A
A + A.B = A A + Ā.B = A + B
De Morgan’s Laws =Ā+ = Ā.
Table 15.2 The rules that govern Boolean algebra
Table 15.3 shows proof of De Morgan’s Laws. Since the last two columns in each section are
identical, then the two De Morgan’s Laws hold true.
Table 15.3 Proof of De Morgan’s Laws
Example 15.2
Simplify A.B.C + Ā.B.C + A. .C + A.B.
Solution
Rewrite the expression as: A.B.C + (Ā.B.C + A. .C + A.B. )
This becomes: (A.B.C + Ā.B.C) + (A.B.C + A. .C) + (A.B.C + A.B. )
which transforms to: B.C.(A + Ā) + A.C.(B + ) + A.B.(C + )
Since A + Ā, B + and C + are all equal to 1
then we have: B.C.1 + A.C.1 + A.B.1 ⇒ B.C + A.C + A.B
ACTIVITY 15B
Simplify the following logic expressions showing all the stages in your simplification.
a) A. + B. .D + A. .C + A.C.D
b) B + Ā. + A.C.D + A.
c) Ā.B.C + A.B. + A.B.C + Ā.B.
d) Ā.(A + B) + (B + A.A).(A + )
e) (A + C).(A.D + A. ) + A.C + C
15.2.2 Further logic circuits
Half adder circuit and full adder circuit
In Chapter 3, the use of logic gates to create logic circuits to carry out specific tasks was
discussed in much detail. Two important logic circuits used in computers are
• the half adder circuit
• the full adder circuit.
Half adder
One of the basic operations in any computer is binary addition. The half adder circuit is the
simplest circuit. This carries binary addition on 2 bits generating two outputs
• the sum bit (S)
• the carry bit (C).
Consider 1 + 1. It will give the result 1 0 (denary value 2). The ‘1’ is the carry and ‘0’ is the sum.
Table 15.4 shows this as a truth table.
Table 15.4
Figure 15.10 shows how this is often shown in graphic form (left) or as a logic circuit (right):
Figure 15.10
Other logic gates can be used to produce the half adder (see below).
As you have probably guessed already, the half adder is unable to deal with the addition of
several binary bits (for example, an 8-bit byte). To enable this, we have to consider the full adder
circuit.
Full adder
Consider the following sum using 5-bit numbers.
Figure 15.11
The sum shows how we have to deal with CARRY from the previous column. There are three
inputs to consider in this third column, for example, A = 1, B = 0 and C = 1 (S = 0).
This is why we need to join two half adders together to form a full adder:
Figure 15.12
This has an equivalent logic circuit; there are a number of ways of doing this. For example, the
following logic circuit uses OR, AND and XOR logic gates.
Figure 15.13
Table 15.5 is the truth table for the full adder circuit.
Table 15.5
As with the half adder circuits, different logic gates can be used to produce the full adder circuit.
The full adder is the basic building block for multiple binary additions. For example, Figure
15.14 shows how two 4-bit numbers can be summed using four full adder circuits.
Figure 15.14
ACTIVITY 15C
1 a) Produce a half adder circuit using NAND gates only.
b) Generate a truth table for your half adder circuit in part a) and confirm it matches the one
shown in Section 15.2.2.
2 a) Produce a full adder circuit using NAND gates only.
b) Generate a truth table for your full adder circuit in part a) and confirm it matches the one
shown in Section 15.2.2.
SR flip-flops
SR flip-flops consist of two cross-coupled NAND gates (note: they can equally well be
produced from NOR gates). The two inputs are labelled ‘S’ and ‘R’, and the two outputs are
labelled ‘Q’ and ‘Ǭ’ (remember Ǭ is equivalent to NOT Q).
In this chapter, we will use SR flip-flop circuits constructed from NOR gates, as shown in Figure
15.15.
The output from gate ‘X’ is Q and the output from gate ‘Y’ is Ǭ. The inputs to gate ‘X’ are R
and Ǭ (shown in red on Figure 15.15); the inputs to gate ‘Y’ are S and Q (shown in green on
Figure 15.15). The output from each NOR gate gives a form of positive feedback (known as
cross-coupling, as mentioned earlier).
We will now consider the truth table to match our SR flip-flop using the initial states of R = 0, S
= 1 and Q = 1. The sequence of the stages in the process is shown in Figure 15.16.
Figure 15.16
The reader is left to consider the other options which lead to the truth table, Table 15.6, for the
flip-flop circuit.
Table 15.6
Explanation
S = 1, R = 0, Q
is the set state in this example
= 1, Ǭ = 0
S = 0, R = 0, Q
is the reset state in this example
= 1, Ǭ = 0
S = 0, R = 1, Q here the value of Q in line (b) remembers the value of Q from line (a); the value
= 0, Ǭ = 1 of Q in line (d) remembers the value of Q in line (c)
S = 0, R = 0, Q R changes from 1 to 0 and has no effect on outputs (these values are
= 0, Ǭ = 1 remembered from line (c))
S = 1, R = 1, Q
this is an invalid case since Ǭ should be the complement (opposite) of Q.
= 0, Ǭ = 0
The truth table shows how an input value of S = 0 and R = 0 causes no change to the two output
values; S = 0 and R = 1 reverses the two output values; S = 1 and R = 0 always gives Q = 1 and
Ǭ = 0 which is the set value.
The truth table shows that SR flip-flops can be used as a storage/memory device for one bit;
because a value can be remembered but can also be changed it could be used as a component in a
memory device such as a RAM chip.
It is important that the fault condition in line (e) is considered when designing and developing
storage/memory devices.
JK flip-flops
The SR flip-flop has the following problems:
• Invalid S, R conditions (leading to conflicting output values) need to be avoided.
• If inputs do not arrive at the same time, the flip-flop can become unstable.
To overcome such problems, the JK flip-flop has been developed. A clock and additional gates
are added, which help to synchronise the two inputs and also prevent the illegal states shown in
line (e) of Table 15.6. The addition of the synchronised input gives four possible input conditions
to the JK flip-flop
• 1
• 0
• no change
• toggle (which takes care of the invalid S, R states).
The JK flip-flop is represented as shown in Figure 15.18.
Figure 15.18 JK flip-flop symbol (left) and JK flip-flop using NAND gates only (right)
Table 15.7
Use of JK flip-flops
• Several JK flip-flops can be used to produce shift registers in a computer.
• A simple binary counter can be made by linking up several JK flip-flop circuits (this requires
the toggle function).
15.2.4 Boolean algebra and logic circuits
In Section 15.2.1, the concept of Boolean algebra was introduced. One of the advantages of this
method is to represent logic circuits in the form of Boolean algebra.
It is possible to use the truth table and apply the sum of products (SoP), or the Boolean
expression can be formed directly from the logic circuit.
Example 15.3
Write down the Boolean expression to represent this logic circuit.
Solution
Stage 1: A AND B
Stage 2: B OR C
Stage 3: stage 1 OR stage 2 ⇒ (A AND B) OR (B OR C)
Stage 4: A OR (NOT C)
Stage 5: stage 3 AND stage 4
⇒ ((A AND B) OR (B OR C)) AND (A OR (NOT C))
Written in Boolean algebra form: ((A.B) + (B + C)).(A + )
Example 15.4
Write the Boolean expression which represents this logic circuit.
Solution
In this example, we will first produce the truth table and then generate the Boolean
expression from the truth table, Table 15.8.
To produce the Boolean expression from the truth table, we only consider those rows where
the output (X) is 1:
(Ā. . + Ā.B. + Ā.B.C + Ā. . + A.B. )
If we apply the Boolean algebra laws, we get:
(Ā. . + Ā.B. + Ā.B.C) + (Ā. . + A.B. )
⇒ ((Ā. . + Ā.B. ) + (Ā. . + A. . )) + (Ā.B.C + A.B. )
⇒ Ā. .( + B) + . .(Ā + A) + (Ā.B.C + A.B. )
⇒ Ā. + . + Ā.B.C + A.B.
Therefore, written as a Boolean expression: Ā. + . + Ā.B.C + A.B.
We therefore end up with a simplified Boolean expression which has the same effect as the
original logic circuit. The reader is left the task of producing the truth table from the above
expression to confirm they are both the same.
ACTIVITY 15D
1 Produce simplified Boolean expressions for the logic circuits in Figure 15.21 (you can do
this directly from the logic circuit or produce the truth table first).
2 Produce simplified Boolean expressions for the logic circuits in Figure 15.22 (you can do
this directly from the logic circuit or produce the truth table first).
15.2.5 Karnaugh maps (K-maps)
In the previous activities, it was frequently necessary to simplify Boolean expressions.
Sometimes, this can be a long and complex process. Karnaugh maps were developed to help
simplify logic expressions/circuits.
Example 15.5
Produce a Boolean expression for the truth table for the NAND gate.
INPUTS OUTPUT
A B X
0 0 1
0 1 1
1 0 1
1 1 0
Solution
Using sum of products gives the following expression:
Ā. + Ā.B + A.
Boolean algebra rules produce the simplified expression:
Ā+
Using Karnaugh maps is a much simpler way to do this.
Each group in the Karnaugh map in Figure 15.23 combines output values where X = 1.
As you might expect, there are a number of rules governing Karnaugh maps.
Example 15.6
Produce a Boolean expression for the truth table.
Solution
Sum of products gives:
A.B.C + Ā.B.C + A. .C + A.B.
We can now produce the following Karnaugh map to represent this truth table (each 1 value
in the K-map represents the above sum of products; so there will be four 1-values in the K-
map, where A and BC intersect, where Ā and BC intersect, where A and C intersect, and
where A and B intersect):
Example 15.7
Produce a Boolean expression for the truth table.
Solution
The sum of products is shown in the right-hand column. This produces the Karnaugh map
shown.
This gives Ā. + .D
Figure 15.19
Columns 1 and 4 can be joined to form a vertical cylinder. The values of both C and D change,
the value of A changes, the value of B is constant at 0 giving:
Figure 15.20
The two 1-values can be combined to form a horizontal cylinder; values of A and B are constant
at 0 and 1 respectively; the value of D is constant at 0; values of C changes from 0 to 1; giving:
Ā.B.
Figure 15.21
The four 1-values can be combined at the four corners; value B is constant at 0 and value D is
also constant at 0, giving: .
Figure 15.22
ACTIVITY 15E
1 a) Draw the truth table for the Boolean expression:
Ā. .C.D + Ā.B. .D + Ā.B.C.D + A. .C.D + A.B. .D + A.B.C.D
b) Draw the Karnaugh map for the Boolean expression in part a).
c) Draw a logic circuit for the simplified Boolean expression using AND or OR gates only.
2 a) Draw the truth table for the Boolean expression:
Ā.B.C + A.B. + A.B.C + Ā.B.
b) Draw the Karnaugh map for the expression in part a) and hence write a simplified
Boolean expression.
3 Four binary signals (A, B, C and D) are used to define an integer in the hexadecimal range
(0 to F). The decimal digit satisfies one of the following criteria (that is, gives an output
value of X = 1):
X = 1 if
A=0
B = C, but A ≠ B and A ≠ C
B = 0, C = 0
a) Complete the truth table (with headings A, B, C, D, X) for the above criteria.
b) Construct the Karnaugh map to represent the above criteria and produce a simplified
Boolean expression.
c) Hence, draw an efficient logic circuit using AND, OR and NOT gates only. Indicate
which input value is not actually required by the logic circuit.
c) i) Copy and complete the Karnaugh map (K-map) for the truth table in part b).
[1]