CS 150 Homework #2
Due September 12th

(1) In class, you saw how to build an accumulator, using a register and an adder. If you have to add M numbers, each N bits long, how many bits does the register and adder have to be? Prove that this number is the minimum required.

(2) One can build a section of a subtracter by taking one of the inputs for a full adder and inverting it. You can then chain them together like you would full adder cells. Draw one such cell, and construct the truth table. What should the carry in be for the least significant bit be for such a subtractor? Why?

(3) The D flip flops we have seen in class are not the only kind which can be made. However, all the different kinds of flip flops can be built using any other sort of flip flop. One such flip flop is below. (It is a T flip flop). Complete the state transition table and the timing diagram below.
T
Flip Flop Image

(4) A more complicated state machine is shown below. It has 3 bits of state, which are also output, and 1 bit of input. (It is a linear feedback shift register with an input, and is similar to circuits used to detect errors). What is the state transition table for this? And what is the state transition diagram?
State Machine Image

(5) Design a finite state machine for the traffic light example (the basic one, not any of the extra ones) as seen in Katz. There is a clock cycle every 15 seconds. Draw the state transition diagram, and encode the state using 3 state bits. What is the truth table for the combinational logic, for your given assignment of states? What are the outputs?


(Artwork by Geordan Rosario, geordan@csua)

This page is maintained by Nick Weaver (nweaver@cs.berkeley.edu)