Homework 2 UCR CS122A Embedded Systems Design, Prof. Frank Vahid, Fall 2000 Due: Thursday, October 19, at the beginning of lecture ESD refers to the book Embedded Systems Design by Vahid/Givargis 1. ESD Chapter 2 Problem 3 2. ESD Chapter 2 Problem 4 3. Design a 4-bit multiplier using the straightforward shift and sum method covered in lecture. Provide the following: (a) An algorithm described in a C-like language, including declarations. (b) An FSMD (a single state-machine potentially with arithmetic operations and conditions), derived directly using the template method. (c) A simplified FSMD, in which you merge/eliminate states without changing the overall functionality. (d) A datapath and controlling FSM. (e) A final design consisting of a ROM-based controller and a datapath. (f) An analysis of the design, consisting of an estimate of the total number of gates (justify your estimate with details!!), and a report of the number of clock cycles necessary from starting the computation to achieving a final result. 4. Design a circuit for computing n! (n factorial). Provide: (a) An algorithm described in a C-like language, including declarations. (b) An FSMD (a single state-machine potentially with arithmetic operations and conditions), derived directly using the template method. (c) A simplified FSMD, in which you merge/eliminate states without changing the overall functionality. (d) A datapath and controlling FSM. You don't need to design the controller. 5. Write an assembly program, using the instruction set of ESD Figure 3.7, to compute n!. Assume n is initially in R0. Put the result in R1. 6. Write an assembly program, using the instruction set of ESD Figure 3.7, to compute R1 = R0 + R0 + R0 (which is the same as 3 * R0). Use the instruction set simulator described at http://www.cs.ucr.edu/esd/labs/ch3_iss/index.html to simulate your program. MODIFY the source code to print out the contents of ALL registers after the program has completed running. Include printouts of your machine program and your simulation output. As you can see, capturing simple algorithms, and converting them to structure, is an important part of this course. If you don't feel entirely comfortable with these tasks, you might do the following. They are not required to be submitted, though (and are NOT extra credit). They're for your own practice. * Design a circuit to compute x divided by y. Start with an algorithm; you can use addition and subtraction, but not multiplication. Finish with a ROM-based controller and datapath. * Design a circuit that searches an 8x8 memory (which thus has 64 bits and 3 address lines) for any 3 consecutive 1's in any word. If found, output a 1, else output a 0. (This is a simple image-processing example).