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.

T=0x54 4=0x34 k=0x6B *=0x2A null=0x00

"T4k*"=0x54 34 6B 2A 00

###
Problem 2 (6 points)

Given the following transistor level circuit:

- (2 points) Fill out the truth table for Z.
A | B | Z |

0 | 0 | 1 |

0 | 1 | 0 |

1 | 0 | 1 |

1 | 1 | 1 |

- (2 points) Give the equation for Z in terms of A and B.
Z = [NOT (A) AND NOT(B)] OR [A AND NOT(B)] OR [A AND B] (full expression)

Z = NOT( NOT(A) AND B) = A OR NOT(B) (reduced exp.)

- (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) ) ) )

- (2 points) Fill out the truth table for Z.
A | B | Z |

0 | 0 | 1 |

0 | 1 | 1 |

1 | 0 | 0 |

1 | 1 | 1 |

- (2 points) Draw the
**gate**-level circuit for Z using 2-input AND/OR gates and NOT gates.
Z = [NOT (A) AND NOT (B)] OR [NOT(A) AND B] OR [A AND B] (full exp)

Z = NOT (A) OR B (reduced exp)

###
Problem 4 (6 points)

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

- (2 points) Fill out the truth table for Z
A | B | Z |

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

- (2 points) Draw the
**gate**-level circuit for Z using 2-input AND/OR gates and NOT gates.

- (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 |

- (4 points) Draw the
**gate**-level circuit using NOT gates and 3-input AND/OR gates.
Z = [NOT (A) AND NOT(B) AND C] OR [A AND NOT (B) AND C] OR [A AND B AND C]

- (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. 3_{10} = 011_{2}=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.**

- (4 points) Fill out the truth table for Z
A | B | C | Z |

0 | 0 | 0 | 0 |

0 | 0 | 1 | 0 |

0 | 1 | 0 | 1 |

0 | 1 | 1 | 1 |

1 | 0 | 0 | 0 |

1 | 0 | 1 | 1 |

1 | 1 | 0 | 0 |

1 | 1 | 1 | 1 |

- (2 points) Write the logic expression for Z in terms of A, B, and C
Z = [NOT (A) AND B AND NOT(C)] OR [NOT (A) AND B AND C] OR [A AND NOT (B) AND C] OR [A AND B AND C] (full expression)

Z = [NOT (A) AND B] OR [A AND C] (reduced)