Docsity

CS3220 Processor Design: Homework 1 Solutions - Spring 2005 - Prof. Gabriel Loh, Assignments of Computer Science

Toggle sidebar
bg1
Homework 1 Solutions
Prof. Loh
CS3220 - Processor Design - Spring 2005
1. Boolean functions, K-maps, Minimization, Gates
Consider the a five-input function f(x4, x3, x2, x1, x0)where the inputs form a 5-bit unsigned value (i.e. X=
x4x3x2x1x0=P4
i=0 xi·2i). Let f() be a function that evaluates to true if Xis either a prime number (0 and 1
are not prime) or if Xis a Fibonacci number (1,2,3,5,8,...).
The minterms are: 1,2,3,5,7,8,11,13,17,19,21,23,29,31.
The truth table for this function is:
x4x3x2x1x0f()
000000
000011
000101
000111
001000
001011
001100
001111
010001
010010
010100
010111
011000
011011
011100
011110
100000
100011
100100
100111
101000
101011
101100
101111
110000
110010
110100
110110
111000
111011
111100
111111
pf3
pf4

Partial preview of the text

Download CS3220 Processor Design: Homework 1 Solutions - Spring 2005 - Prof. Gabriel Loh and more Assignments Computer Science in PDF only on Docsity!

Homework 1 Solutions

Prof. Loh

CS3220 - Processor Design - Spring 2005

1. Boolean functions, K-maps, Minimization, Gates

Consider the a five-input function f (x 4 , x 3 , x 2 , x 1 , x 0 ) where the inputs form a 5-bit unsigned value (i.e. X =

x 4 x 3 x 2 x 1 x 0 =

i=0 xi^ ·^2

i). Let f () be a function that evaluates to true if X is either a prime number (0 and 1

are not prime) or if X is a Fibonacci number (1,2,3,5,8,...).

The minterms are: 1,2,3,5,7,8,11,13,17,19,21,23,29,31.

The truth table for this function is:

x 4 x 3 x 2 x 1 x 0 f () 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1

(a) Use a 5-variable Karnaugh map to minimize f ().

x 3 x 2

x 1 x 0 00 10 11 01

x 3 x 2

x 1 x 0 00 10 11 01

x 4 = 0 x 4 = 1

x 4 .x 3 .x 2 .x 1 .x 0 + x 4 .x 3 .x 2 .x 1 + x 4 .x 2 .x 1 .x 0 + x 2 .x 1 .x 0 + x 4 .x 2 .x 0 + x 3 .x 0

(b) Use the Quine-McCluskey method to minimize f ().

The prime implicants are written in bold with a star (?). In this problem, all prime implicants are required, and

so the final equation is:

= x 4 .x 3 .x 2 .x 1 .x 0 + x 4 .x 3 .x 2 .x 1 + x 4 .x 2 .x 1 .x 0 + x 2 .x 1 .x 0 + x 4 .x 2 .x 0 + x 3 .x 0

(c) Use DeMorgen’s theorem to write a product-of-sums form for f ().

(x 4 .x 3 .x 2 .x 1 .x 0 + x 4 .x 3 .x 2 .x 1 + x 4 .x 2 .x 1 .x 0 + x 2 .x 1 .x 0 + x 4 .x 2 .x 0 + x 3 .x 0 )

(x 4 .x 3 .x 2 .x 1 .x 0 ).(x 4 .x 3 .x 2 .x 1 ).(x 4 .x 2 .x 1 .x 0 ).(x 2 .x 1 .x 0 ).(x 4 .x 2 .x 0 ).(x 3 .x 0 )

(x 4 + x 3 + x 2 + x 1 + x 0 ). (x 4 + x 3 + x 2 + x 1 ). (x 4 + x 2 + x 1 + x 0 ).

(x 2 + x 1 + x 0 ). (x 4 + x 2 + x 0 ). (x 3 + x 0 )

2. Parallel Prefix Adders

In class we discussed a Look-Ahead Carry Adder where the carry-propagate circuit was implemented as a binary tree.

As the circuit makes its way up the tree, the wire distances that must be traveled between nodes increases. Sometimes

it makes sense to collect multiple inputs together, perform a larger computation, and then move on to the next node;

that is, use a trinary- or even a quartinary-tree.

(a) Consider a node for a trinary parallel-prefix adder tree. The inputs from the “bottom” are pgkL, pgkM , pgkR and

the input from the top is pgkin. The outputs out the bottom to the subtrees are P GKL, P GKM , P GKR and the

output up to the next root is P GKout. Fill in three “truth tables” for the output P GKout, P GKL and P GKM

(you don’t need to do P GKR since it is always equal to pgkin). Input values should be either K, P, G or X (don’t

care) and the output values should be K, P or G.

Each tables should be of the form (I’ve filled in an arbitrary row from each as an example):

pgkR pgkin P GKM

K X K

P K K

P P P

P G G

G X G

pgkM pgkR pgkin P GKL

K X X K

P K X K

P P K K

P P P P

P P G G

P G X G

G X X G

pgkL pgkM pgkR P GKout

K X X K

P K X K

P P K K

P P P P

P P G G

P G X G

G X X G

(b) Draw a 9-bit look-ahead carry adder using a trinary parallel-prefix tree (for each node, you can just use blank

blocks like the figure on the next page). Like the example in class, annotate each wire in your 9-bit parallel prefix

tree with a P, G or K assuming inputs of x = 011011100 and y = 010110010.

K

y =

x =

P P P P P P P P P

K G P P G P P P K

K G K

K

G G G G K K K K K

G K

K