CS61 Lecture Homework 4

CS61 Homework 4
Name: ____________________ netID:_____________________
READING: Chapter 3, sections 3.1 through 3.3
Read ahead for Week 4: Chapter 3 (entire chapter)
HOMEWORK SET (5 questions, 8 points total): Complete the following exercises.
MUST work on top of the copy of the Google doc that is provided and be submitted as a PDF file MUST be created electronically
● Use any word processor for the text; create any diagrams in a drawing canvas or as separate PNG or jpg images embedded in your document; save/print the final document to PDF.
MUST have your name and username (NetID) at the top.
Students are allowed (and encouraged!) to work on lecture homework together. However, each student must turn in their assignments individually. Please don’t copy/turn in someone else’s work.
For the most part, grading is binary – each question will be awarded 0 or 1 point.
If you show even a little work so we can see that you have some idea of what you were doing, you will get the point, otherwise, you will not get the point even if your answer is correct.
If we see that any answer is copied from any outside source, you get 0 for the entire homework.
All homework will be weighted equally (even if, for example, some will be graded out of 20, some out of 5, etc.); collectively, they will count for 10% of the total course grade.
Code Help
Question 1: (2 points)
A company’s board consists of 4 people: Abigail (the CEO), Benoit, Charlie, and Debra. When they take a vote, if there is a majority (either up or down), that vote prevails. If, however, there is a tie, then Abigail’s vote is the tie-breaker (e.g. if A&B votes up, and C&D votes down, the outcome is “up”, because A’s vote breaks the tie). The truth table will show all possible combinations of the 4 votes and the final decision for each.
1. Build the truth table (1 point)
2. Derive the corresponding boolean expression, and simplify it to the extent possible (1 point)
(please show the steps of how do you simplify the equation)

Question 2 (2 points)
Given four inputs: a, b, c & d, where (a, b) represents a 2-bit unsigned binary number X; and (c, d) represents a 2-bit unsigned binary number Y (i.e. both X and Y are in the range #0 to #3).
The output is z, which is 1 whenever X > Y, and 0 otherwise (this circuit is part of a “2-bit comparator”). For instance, if a = 1, b = 0 (i.e. X = b10 => #2); c = 0, d = 1 (i.e. Y = b01 => #1); then z = 1, since b10 > b0Z
1. Build the truth table (1 point)
2. Derive the corresponding boolean expression, and simplify it to the extent possible (1 point)
(please show the steps of how do you simplify the equation)
程序代写 CS代考 加微信: cstutorcs
Question 3 (2 points)
The following logic diagram produces the logical value OUT.
Show your attempt at creating a truth table and deriving the boolean expression. What does the value 0 or 1 for OUT signify?
(hint: I would like to suggest that you remember circuit and its meaning as we continue to study the instruction set of the LC3. This is the circuitry required to make a certain instruction work. What instruction do you associate with the PZN flags? Can you relate the meaning of a 1 and a 0 to that instruction?)

(More space for Q3)

Question 4 (3.21 textbook page 101)
If A and B are four-bit unsigned binary numbers, 0111 and 1011, complete the table obtained when using a two-bit full adder from Figure 3.15 to calculate each bit of the sum, S, of A and B. Check your answer by adding the decimal value of A and B and comparing the sum with S. Are the answers the same? Why or why not?
𝐶!” 0 A0111 B1011 S
(don’t forget to convert A and B to decimal and compare the decimal sum with the binary result you get from the table)

程序代写 CS代考 加QQ: 749389476
Question 5 (3,27 textbook page 103)
You know a byte is eight bits. We call a four-bit quantity a nibble. If a byte-addressable memory has a 14- bit address, how many nibbles of storage are in this memory?
(show how you get the results)