Homework 1

22C:122, Spring 1996

Due Monday Jan. 29, 1995

Douglas W. Jones

In the writeup of the minimal ultimate RISC (see the course home page), the actual minimal instruction set was not used. The minimal instruction set involves only one arithmetic operation, subtraction, but in the example given, the add instruction is also used.

1) Write an ADD macro syntactically and semantically equivalent to that given in the macro set in the example, but that uses only the LDA, STA and SUB macros, along with a temporary memory location, if needed, in order to accomplish the job of adding a variable to the accumulator.

2) Write an ADD macro syntactically and semantically equivalent to that given in the macro set in the example, but that uses only the LDA, STA and reverse subtract instruction (ACC := OP - ACC) along with a temporary memory location, if needed.

3) Given the two subtraction operations used in the first two parts of this problem, and given no other arithmetic operations, which subtraction operation leads to a more nearly optimal version of the minimal ultimate RISC.

4) Given only n-input nand gates with unlimited fanin and fanout, how many gates would it take to implement the minimal ultimate RISC? An estimate will suffice.