The Intel 4004 was a 4-bit microprocessor, and the first processor created by Intel. For the following questions, refer to the Intel MCS-4 Assembly Language Programming Manual.

Logic Operations

The 4004 does not have any bitwise operators in its instruction set. Section 4.4 of the manual gives programs to compute 4-bit AND, OR, and XOR using the addition operation.

Adding logic operators

Our text gives includes a table of instruction frequencies for MIPS (Figure 2.32 in the 3rd edition, B.27 in the 4th, and A.27 in the 5th). According to this table, for the MIPS instruction set running the SPECint2000 benchmark, AND makes 4% of the instructions, OR makes 9%, and XOR makes 3%. Of course, these numbers would be different for the 4004, since other operations that take one instruction in MIPS will take more than one on the 4004, but assuming these percentages would roughly hold, what would the expected number of instructions be if you introduced new logical operation instructions to the 4004 instruction set?


Propose an encoding for these new instructions within the unused opcodes.

Arithmetic Operations

The SUB instruction performs A = A + ~R + ~C for accumulator A, Register R, and carry bit C; and the SBM instruction performs A = A + ~M + ~C for M in memory.

A 2's complement negation is -R = ~R + 1, so these instructions performs a 2's complement subtract if C is initialized to 0. As seen in section 4.6 of the 4004 manual, you can chain these instructions for subtracts of larger than four bits, but need to complement the carry between each 4 bits of a multi-digit subtract.

Non-inverted Carry

If the subtract instructions instead performed A = A + ~R + C (without inverting the carry), you would need to set the carry to 1 before a single four-bit subtract or the first of a sequence, but would not need to do anything to the carry between digits of a multi-digit subtract. Rewrite the code on page 4-17 for this new version of the subtract

Local speedup

What is the expected speedup of just this subtract code, as a function of the number of loop iterations?

Overall speedup

Assuming 32-bit subtract operations are 5% of the total run time of a program, what is the overall speedup?

ISA vs. Organization

Most of the points presented in Chapter 2 of the manual (Computer Organization) are actually part of the ISA, and not the organization. List the points mentioned that are details of the organization.