cs1q computer systems lecture 7 simon gay. lecture 7cs1q computer systems - simon gay2 parity the...
TRANSCRIPT
CS1Q Computer SystemsLecture 7
Simon Gay
Lecture 7 CS1Q Computer Systems - Simon Gay 2
ParityThe parity of a binary word is determined by the number of 1s in it:if it contains an odd number of 1s then the parity is 1 (or odd);if it contains an even number of 1s then the parity is 0 (or even).
(Mathematically the parity of a number is sometimes said to be odd for odd numbers and even for even numbers. But for binary words,parity is based on the number of 1s.)
Example: 1010 has even parity. 1101 has odd parity. 11111111 has even parity. 00101010 has odd parity.
Lecture 7 CS1Q Computer Systems - Simon Gay 3
ParityThe parity function for a 3 bit word xyz is defined by the followingtruth table, which also shows the minterm for each row.
y zx p0 00 00 10 11 00 11 10 00 01 10 11 01 01 01 11 1
zyxzyxzyxzyxzyxzyxzyxzyx
The formula for p is the OR of thefour minterms corresponding to therows in which p = 1.
xyzzyxzyxzyxp
Lecture 7 CS1Q Computer Systems - Simon Gay 4
Exercises1. Draw a circuit for the parity function, in the same way that we didfor majority voting.
2. Find an equivalent circuit, which uses just two XOR gates. Provethat it is equivalent, both by truth tables and by using the laws ofboolean algebra.
Lecture 7 CS1Q Computer Systems - Simon Gay 5
Exercise Solution
xyzzyxzyxzyxp
The parity function for a 3 bit word xyz:
The question was to find a way of expressing this function with twoXOR gates, and prove that it is equivalent.
There is only one sensible circuit we can make out of two XOR gates:
xxor2 xor2y
zp
So we get:zyxzyxp )(
Lecture 7 CS1Q Computer Systems - Simon Gay 6
Exercise SolutionTo prove that this expression for p is equivalent to the first one,either use truth tables or the following calculation:
xyzzyxzyxzyxp
zyxyxzxyyx )()(
zyxzyx )()(
zyx )(
This expression for p suggests that the parity function is a 3-inputXOR operation. Indeed, we can see that XOR is the parity functionfor a 2 bit word.
Lecture 7 CS1Q Computer Systems - Simon Gay 7
Simplifying CircuitsWe have two different logical expressions for the majority votingfunction:
xyzzxyzyxyzxr
zxyzxyr
They are equivalent, but the first is simpler: easier to understand, perhaps more efficient to implement.
The more complex expression came from our systematic designtechnique. So we need a systematic simplification technique as well.
We’ll look at systematic simplification in a moment. But first,here’s a non-systematic approach.
Lecture 7 CS1Q Computer Systems - Simon Gay 8
Simplifying with Boolean Algebra
xyzzxyzyxyzxr xyzxyzxyzzxyzyxyzx xyzzxyxyzzyxxyzyzx xyzzxyxzyyxzyzxxyz
)()()( zzxyyyxzxxyz 111 xyxzyz
zxyzxy
. osimplify t ),( as factorize ,spot :Method xyzzxyxyzzxy
Lecture 7 CS1Q Computer Systems - Simon Gay 9
Karnaugh MapsA Karnaugh map, or K-map, is an alternative representation of atruth table, which makes it easy to spot when expressions of theform can be eliminated.xx
Example: consider the function yxyr and lay out its truth table as a 2 by 2 grid.
x y r0 0 00 1 11 0 01 1 1
0 10 1
1
10
0
xx
y y
This grid is the Karnaugh map for r.
Lecture 7 CS1Q Computer Systems - Simon Gay 10
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
Lecture 7 CS1Q Computer Systems - Simon Gay 11
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
Lecture 7 CS1Q Computer Systems - Simon Gay 12
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
Lecture 7 CS1Q Computer Systems - Simon Gay 13
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
Lecture 7 CS1Q Computer Systems - Simon Gay 14
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
Lecture 7 CS1Q Computer Systems - Simon Gay 15
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
The rows are labelled with and , and the columns with and ,to show which axis corresponds to which variable and also to indicatewhich minterm corresponds to which square in the grid.
x x y y
Lecture 7 CS1Q Computer Systems - Simon Gay 16
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
The rows are labelled with and , and the columns with and ,to show which axis corresponds to which variable and also to indicatewhich minterm corresponds to which square in the grid.
x x y y
minterm
yx
Lecture 7 CS1Q Computer Systems - Simon Gay 17
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
The rows are labelled with and , and the columns with and ,to show which axis corresponds to which variable and also to indicatewhich minterm corresponds to which square in the grid.
x x y y
minterm
yx
Lecture 7 CS1Q Computer Systems - Simon Gay 18
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
The rows are labelled with and , and the columns with and ,to show which axis corresponds to which variable and also to indicatewhich minterm corresponds to which square in the grid.
x x y y
minterm
yx
Lecture 7 CS1Q Computer Systems - Simon Gay 19
Karnaugh MapsIn the Karnaugh map, each square corresponds to one of the fourcombinations of values of x and y. The values of x and y are shownat the left hand side and along the top.
0 10 1
1
10
0
xx
y yx y r0 0 00 1 11 0 01 1 1
The rows are labelled with and , and the columns with and ,to show which axis corresponds to which variable and also to indicatewhich minterm corresponds to which square in the grid.
x x y y
mintermyx
Lecture 7 CS1Q Computer Systems - Simon Gay 20
Karnaugh Maps
0 10 1
1
10
0
xx
y y
From the Karnaugh map, we can write down a formula for r byOR-ing together the minterms corresponding to the squareswhich contain 1. xyyxr This can be factorised as
yxxr )(
and therefore simplifies to yr
This is just what we did for the majority voting function, but nownotice that the presence of in the formula has a visualinterpretation: there are two adjacent 1s in the y column, coveringboth the and squares.x x
xx
Lecture 7 CS1Q Computer Systems - Simon Gay 21
ExerciseDraw a Karnaugh map for the function
yxxr
x y r0 0 10 1 01 0 11 1 1
1 01 1
1
10
0
xx
y y
Lecture 7 CS1Q Computer Systems - Simon Gay 22
Simplification with K-MapsEach square in the K-map corresponds to a minterm. Each 1 by 2rectangle (either horizontal or vertical) corresponds to one of thevariables, either negated or non-negated.
Any collection of squares and rectangles which cover all the 1s,corresponds to a logical formula for the function defined by the K-map.
By choosing a covering in which the rectangles are as large aspossible (maybe overlapping), we obtain the simplest formula.
(What do we mean by “simplest”? We are trying to minimise thenumber of terms OR-ed together, and minimise the complexity ofeach term. This simplification process is often called minimisation.)
Lecture 7 CS1Q Computer Systems - Simon Gay 23
Simplification with K-MapsExample: the function yxxr has this K-map:
0 11 1
1
10
0
xx
y y
Different coverings of the 1s give different formulae.
Lecture 7 CS1Q Computer Systems - Simon Gay 24
Simplification with K-MapsExample: the function yxxr has this K-map:
0 11 1
1
10
0
xx
y y
Different coverings of the 1s give different formulae.
Three squares: yxxyyxr
Lecture 7 CS1Q Computer Systems - Simon Gay 25
Simplification with K-MapsExample: the function yxxr has this K-map:
0 11 1
1
10
0
xx
y y
Different coverings of the 1s give different formulae.
Three squares: yxxyyxr Square and horizontal rectangle: yxxr
Lecture 7 CS1Q Computer Systems - Simon Gay 26
Simplification with K-MapsExample: the function yxxr has this K-map:
0 11 1
1
10
0
xx
y y
Different coverings of the 1s give different formulae.
Three squares: yxxyyxr Square and horizontal rectangle: yxxr
Square and vertical rectangle: yxyr
Lecture 7 CS1Q Computer Systems - Simon Gay 27
Simplification with K-MapsExample: the function yxxr has this K-map:
0 11 1
1
10
0
xx
y y
Different coverings of the 1s give different formulae.
Three squares: yxxyyxr Square and horizontal rectangle: yxxr
Square and vertical rectangle: yxyr Horizontal and vertical rectangles: yxr
Lecture 7 CS1Q Computer Systems - Simon Gay 28
K-Maps for 3 VariablesThe Karnaugh map for a function of 3 variables consists of a grid of8 squares. Here is the K-map for the majority voting function.
0 00 1x
xy y
1 01 1
y y
z z z z
The 0s and 1s around the edges havebeen omitted. Remember that anegated label corresponds to 0 and anon-negated label to 1.
Notice that the negated ys appear in a different pattern from thenegated zs. This means that again each square corresponds to oneof the 8 minterms.
The three rectangles of 1s correspond to xy, yz and xz.
Lecture 7 CS1Q Computer Systems - Simon Gay 29
K-Maps for 3 VariablesThe Karnaugh map for a function of 3 variables consists of a grid of8 squares. Here is the K-map for the majority voting function.
0 00 1x
xy y
1 01 1
y y
z z z z
The 0s and 1s around the edges havebeen omitted. Remember that anegated label corresponds to 0 and anon-negated label to 1.
Notice that the negated ys appear in a different pattern from thenegated zs. This means that again each square corresponds to oneof the 8 minterms.
The three rectangles of 1s correspond to xy, yz and xz.
xy
Lecture 7 CS1Q Computer Systems - Simon Gay 30
K-Maps for 3 VariablesThe Karnaugh map for a function of 3 variables consists of a grid of8 squares. Here is the K-map for the majority voting function.
0 00 1x
xy y
1 01 1
y y
z z z z
The 0s and 1s around the edges havebeen omitted. Remember that anegated label corresponds to 0 and anon-negated label to 1.
Notice that the negated ys appear in a different pattern from thenegated zs. This means that again each square corresponds to oneof the 8 minterms.
The three rectangles of 1s correspond to xy, yz and xz.
yz
Lecture 7 CS1Q Computer Systems - Simon Gay 31
K-Maps for 3 VariablesThe Karnaugh map for a function of 3 variables consists of a grid of8 squares. Here is the K-map for the majority voting function.
0 00 1x
xy y
1 01 1
y y
z z z z
The 0s and 1s around the edges havebeen omitted. Remember that anegated label corresponds to 0 and anon-negated label to 1.
Notice that the negated ys appear in a different pattern from thenegated zs. This means that again each square corresponds to oneof the 8 minterms.
The three rectangles of 1s correspond to xy, yz and xz.
xz
Lecture 7 CS1Q Computer Systems - Simon Gay 32
K-Maps for 3 VariablesThe Karnaugh map for a function of 3 variables consists of a grid of8 squares. Here is the K-map for the majority voting function.
0 00 1x
xy y
1 01 1
y y
z z z z
The 0s and 1s around the edges havebeen omitted. Remember that anegated label corresponds to 0 and anon-negated label to 1.
Notice that the negated ys appear in a different pattern from thenegated zs. This means that again each square corresponds to oneof the 8 minterms.
The three rectangles of 1s correspond to xy, yz and xz. OR-ing themtogether gives the simplified formula for majority voting:
zxyzxy
Lecture 7 CS1Q Computer Systems - Simon Gay 33
Labelling 3 Variable K MapsIt is essential to label the rows and columns correctly, otherwise thetechnique of finding overlapping rectangles does not work.
xx
y y y y
z z z z
It must be the case that any two adjacent squares (including “wrappinground” from top to bottom) have labels which differ by negation ofexactly one variable. There are several labelling schemes which havethis property, but for safety you should memorise the labelling whichis used in the lecture notes.
Lecture 7 CS1Q Computer Systems - Simon Gay 34
Another ExampleWe will use a Karnaugh map to minimise the formula
zyxyzzyxzx First we fill in the K-map. The terms with two variables correspond to2 by 1 rectangles, and the other terms are just squares.
1 1xx
y y y y
z z z z
zx
Lecture 7 CS1Q Computer Systems - Simon Gay 35
Another ExampleWe will use a Karnaugh map to minimise the formula
zyxyzzyxzx First we fill in the K-map. The terms with two variables correspond to2 by 1 rectangles, and the other terms are just squares.
1 1xx
y y11
y y
z z z z
yz
Lecture 7 CS1Q Computer Systems - Simon Gay 36
Another ExampleWe will use a Karnaugh map to minimise the formula
zyxyzzyxzx First we fill in the K-map. The terms with two variables correspond to2 by 1 rectangles, and the other terms are just squares.
11 1x
xy y
11
y y
z z z z
zyx
Lecture 7 CS1Q Computer Systems - Simon Gay 37
Another ExampleWe will use a Karnaugh map to minimise the formula
zyxyzzyxzx First we fill in the K-map. The terms with two variables correspond to2 by 1 rectangles, and the other terms are just squares.
11 1x
xy y
11 1
y y
z z z z
zyx
Lecture 7 CS1Q Computer Systems - Simon Gay 38
Another ExampleWe will use a Karnaugh map to minimise the formula
zyxyzzyxzx First we fill in the K-map. The terms with two variables correspond to2 by 1 rectangles, and the other terms are just squares.
0 11 1x
xy y
1 01 1
y y
z z z z
The remaining squares are 0.
Lecture 7 CS1Q Computer Systems - Simon Gay 39
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Lecture 7 CS1Q Computer Systems - Simon Gay 40
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles:
Lecture 7 CS1Q Computer Systems - Simon Gay 41
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: zx
Lecture 7 CS1Q Computer Systems - Simon Gay 42
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: yxzx
Lecture 7 CS1Q Computer Systems - Simon Gay 43
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx
Lecture 7 CS1Q Computer Systems - Simon Gay 44
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares:
Lecture 7 CS1Q Computer Systems - Simon Gay 45
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: y
Lecture 7 CS1Q Computer Systems - Simon Gay 46
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxy
Lecture 7 CS1Q Computer Systems - Simon Gay 47
Another Example
0 11 1x
xy y
1 01 1
y y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy
Lecture 7 CS1Q Computer Systems - Simon Gay 48
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy
Lecture 7 CS1Q Computer Systems - Simon Gay 49
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy 4 by 1 and 2 by 1 rectangles:
Lecture 7 CS1Q Computer Systems - Simon Gay 50
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy 4 by 1 and 2 by 1 rectangles: x
Lecture 7 CS1Q Computer Systems - Simon Gay 51
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy 4 by 1 and 2 by 1 rectangles: yxx
Lecture 7 CS1Q Computer Systems - Simon Gay 52
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy 4 by 1 and 2 by 1 rectangles: yxx 4 by 1 rectangle and 2 by 2 square:
Lecture 7 CS1Q Computer Systems - Simon Gay 53
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy 4 by 1 and 2 by 1 rectangles: yxx 4 by 1 rectangle and 2 by 2 square: x
Lecture 7 CS1Q Computer Systems - Simon Gay 54
Another Example
0 11 1
xy y
1 01
y
1
y
z z z zNow we can find collections of rectangles which cover the 1s.
Three horizontal 2 by 1 rectangles: xzyxzx 2 by 2 square and two 1 by 1 squares: zyxzyxy Combining the two 1 by 1 squares:
x
yxy 4 by 1 and 2 by 1 rectangles: yxx 4 by 1 rectangle and 2 by 2 square: yx (the simplest formula)
Lecture 7 CS1Q Computer Systems - Simon Gay 55
ExerciseIn the same way, minimise the expression
zyxzyxy
Lecture 7 CS1Q Computer Systems - Simon Gay 56
ExerciseIn the same way, minimise the expression
zyxzyxy
xy y y y
z z z zx
Draw the Karnaugh map:
Lecture 7 CS1Q Computer Systems - Simon Gay 57
ExerciseIn the same way, minimise the expression
zyxzyxy
1x
y y
1
y y
z z z zx
Draw the Karnaugh map:
xy
Lecture 7 CS1Q Computer Systems - Simon Gay 58
ExerciseIn the same way, minimise the expression
zyxzyxy
1x
y y1
1
y
1
y
z z z zx
Draw the Karnaugh map:
zy
Lecture 7 CS1Q Computer Systems - Simon Gay 59
ExerciseIn the same way, minimise the expression
zyxzyxy
11
xy y
11
y
1
y
z z z zx
Draw the Karnaugh map:
zyx
Lecture 7 CS1Q Computer Systems - Simon Gay 60
ExerciseIn the same way, minimise the expression
zyxzyxy
1 00 1
xy y
0 11
y
1
y
z z z zx
Draw the Karnaugh map:
Cover the 1s with the largest possible rectangles:
Lecture 7 CS1Q Computer Systems - Simon Gay 61
1
ExerciseIn the same way, minimise the expression
zyxzyxy
00 1
y y0 11
y
1
y
z z z zx
Draw the Karnaugh map:
Cover the 1s with the largest possible rectangles:
yx
x
Lecture 7 CS1Q Computer Systems - Simon Gay 62
1
ExerciseIn the same way, minimise the expression
zyxzyxy
00 1
y y0 11
y
1
y
z z z zx
Draw the Karnaugh map:
Cover the 1s with the largest possible rectangles:
xyyx
x
Lecture 7 CS1Q Computer Systems - Simon Gay 63
1
ExerciseIn the same way, minimise the expression
zyxzyxy
00 1
y y0 11
y
1
y
z z z zx
Draw the Karnaugh map:
Cover the 1s with the largest possible rectangles:
xzxyyx
x
Lecture 7 CS1Q Computer Systems - Simon Gay 64
1
ExerciseIn the same way, minimise the expression
zyxzyxy
00 1
y y0 11
y
1
y
z z z zx
Draw the Karnaugh map:
Cover the 1s with the largest possible rectangles:
)( zyxyxxzxyyx
x
Lecture 7 CS1Q Computer Systems - Simon Gay 65
1
ExerciseIn the same way, minimise the expression
zyxzyxy
00 1
y y0 11
y
1
y
z z z zx
Draw the Karnaugh map:
Cover the 1s with the largest possible rectangles:
)( zyxyxxzxyyx
x
Alternatively:xyyzxzyxyyx )(
Lecture 7 CS1Q Computer Systems - Simon Gay 66
K-Maps for 4 VariablesA Karnaugh map for a function of 4 variables x, y, z, w uses thefollowing grid.
xy y y y
z z z zxxx
ww
w
w
The left and right columns are adjacent. The top and bottom rowsare adjacent. Larger K-maps can be constructed (e.g. for 5 variables,take 2 copies of this K-map, one labelled v and the other labelled v )but are less useful because it is more difficult to spot rectangles.
Lecture 7 CS1Q Computer Systems - Simon Gay 67
Example: Gray CodeGray code is an alternative binary counting sequence. The Gray codesequence for 3 bits is as follows:
0 0 00 0 10 1 10 1 01 1 01 1 11 0 11 0 0
At each step, exactly one bit is changed, andit is the rightmost bit such that a change producesa word which has not already occurred.
Exercise: use this rule to work out the Gray codesequence for other numbers of bits.
We will design a circuit to calculate the next 3 bitGray code. Given a 3 bit input xyz, the 3 bit outputx’y’z’ is the word which follows xyz in the Graycode sequence. For input 100 the output is 000.
Lecture 7 CS1Q Computer Systems - Simon Gay 68
Gray Code Truth TablesBy combining three truth tables we can show x’, y’ and z’ as functionsof x, y and z.
0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1
x y z0 0 10 1 11 1 00 1 00 0 01 0 01 1 11 0 1
x’ y’ z’
Lecture 7 CS1Q Computer Systems - Simon Gay 69
1
Gray Code Karnaugh MapsFor each of x’, y’, z’ we can draw a Karnaugh map and find aminimised formula.
For x’:
0 10 1
xy y
0 01
y
1
y
z z z zx
For y’:
0 10 1
xy y
1 10
y
0
y
z z z zx
For z’:
00 1
y y0 11
y
0
y
z z z zx
xzzyx
zxzyy
yxxyz
x
Lecture 7 CS1Q Computer Systems - Simon Gay 70
Gray Code CircuitNotice that the expression occurs twice, so we can reduce thesize of the circuit by only calculating it once. Also notice that , which means that if XOR gates are available then thecircuit can be simplified further.
zy
yxz