# CS/ECE 252 Introduction to Computer Engineering

Spring 2013 Section 1 & 2
Instructors Mark D. Hill and Guri Sohi
TAs Preeti Agarwal, Mona Jalal, Rebecca Lam, Pradip Vallathol

URLs: http://www.cs.wisc.edu/~markhill/cs252/Spring2013/ and http://www.cs.wisc.edu/~sohi/cs252/Spring2013/

## Homework 3 [Due at lecture on Wed, Feb 20]

Primary contact for this homework: Rebecca Lam rjlam@cs.wisc.edu

You must work in groups of two for this homework. Please write the full name (as it appears on Learn@UW) and the student ID of each group member on every page and staple multiple pages together.

### Problem 1 (2 points)

Convert the following string (only the characters within the quotes) into its ASCII representation: "T4k*". Represent each character in hexadecimal. Assume that the string is null terminated.

### Problem 2 (6 points)

Given the following transistor level circuit:

1. (2 points) Fill out the truth table for Z.
2. (2 points) Give the equation for Z in terms of A and B.
3. (2 points) Draw the gate-level circuit for Z using 2-input AND/OR gates and NOT gates.

### Problem 3 (4 points)

Given the logic equation Z = (NOT A) OR ( NOT( A AND ( NOT(B) ) ) )

1. (2 points) Fill out the truth table for Z.
2. (2 points) Draw the gate-level circuit for Z using 2-input AND/OR gates and NOT gates.

### Problem 4 (6 points)

Given the logic equation Z = NOT( NOT (A AND B) OR ( NOT( B AND A ) ) )

1. (2 points) Fill out the truth table for Z
2. (2 points) Draw the gate-level circuit for Z using 2-input AND/OR gates and NOT gates.
3. (2 points) Draw the transistor-level equivalent of the circuit from part b.

### Problem 5 (6 points)

Suppose A, B, and C are inputs to logic function Z with the following truth table:

 A B C Z 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1
1. (4 points) Draw the gate-level circuit using NOT gates and 3-input AND/OR gates.
2. (2 points) Convert the circuit of part a into one that uses only NAND gates. (Hint: DeMorgan's law)

### Problem 6 (6 points)

Assume that A, B, and C are 3 bits that represent an unsigned integer, where A is the highest bit and C is the lowest bit (e.g. 310 = 0112=ABC where A=0, B=1, C=1). Suppose A, B, and C are inputs to a logic function that outputs Z = 1 when the number represented by ABC is a prime number greater than 1.

1. (4 points) Fill out the truth table for Z
2. (2 points) Write the logic expression for Z in terms of A, B, and C

Computer Sciences | UW Home
 Page last modified: Thursday, 07-Feb-2013 21:45:35 CST Feedback or content questions: send email to sohi@cs.wisc.edu Technical or accessibility issues: lab@cs.wisc.edu Copyright © 2002, 2003 The Board of Regents of the University of Wisconsin System.