Computer Architecture
Chapter 8 Problems:
-
1. Using the 3 instruction processor, with 3 additional instructions
for multiply, divide, and subtract, write the code segment that
calculates a set of terms in the cosine and sine functions in the
Taylor series below. Your code must calculate variables for use
the next time through the code. As an example, if your are
calculating -X^2/2! and -X^3/3! the next time through your code
it will calculate X^4/4! and X^5/5!.
Assume the ALU in the processor is capable of floating point
arithmetic. If you need a constant in your code, such as -1.0, you
may assume the constant is in data memory or the register file as
long as your code doesn't overwrite it. You must add your terms to
the variables you're using for cos(X) and sin(X). List the variables
you need in your code and their location in memory or register
file.
cos(X) = 1 - X^2/2! + X^4/4! - X^6/6! + X^8/8! - ...
sin(X) = X - X^3/3! + X^5/5! - X^7/7! + X^9/9! - ...
Instruction mnemonic |
Description |
Mov Ra, d |
RF[a] = D[d] |
Mov d, Ra |
D[d] = RF[a] |
Add Ra, Rb, Rc |
RF[a] = RF[b] + RF[c] |
Sub Ra, Rb, Rc |
RF[a] = RF[b] - RF[c] |
Mult Ra, Rb, Rc |
RF[a] = RF[b] * RF[c] |
Div Ra, Rb, Rc |
RF[a] = RF[b] / RF[c] |
-
2. Problem 8.1
-
3. Problem 8.2
-
4. Problem 8.5
-
5. Problem 8.6
-
6. Problem 8.8
-
7. Problem 8.12
-
8. Problem 8.14
-
9. Problem 8.16. Instead of a 12-bit offset, use a 4-bit offset
so that the offset fits inside the instruction.
-
10. Problem 8.17
-
11. Problem 8.22