CSE 141 Ungraded Homework # 1
Recommended "due date" - Jan 16.
For the first four questions, assume that the contents of registers
and memory is as indicated below. You should tell all the
changes to registers and memory caused by the given instruction. For
instance, an answer might be, "After the instruction is executed,
register 6 will contain 25, and memory locations 44 to 47 contain 20."
(The first three questions should be easy ... I just want to make
sure everyone understands how machine instructions work.)
Assume that for both the MIPS and VAX instructions, the
first operand gives the target location.
Treat each question separtately, that is, the memory and registers
always start as shown below.
Registers (This shows the contents of the first
8 registers. The values are expressed in decimal.)
0 Reg 0 |
8 Reg 1 |
28 Reg 2 |
16 Reg 3 |
44 Reg 4 |
36 Reg 5 |
20 Reg 6 |
20 Reg 7 |
Memory (This shows the contents of the first
64 Bytes of main memory, where each 4-Byte word is shown as
a decimal number.)
20 Bytes 0 to 3 |
16 4 to 7 |
12 8 to 11 |
8 12 to 15 |
4 16 to 19 |
0 20 to 23 |
24 24 to 27 |
32 28 to 31 |
3148 Bytes 32 to 35 |
24 36 to 39 |
0 40 to 43 |
4 44 to 47 |
44 48 to 51 |
17 52 to 55 |
16 56 to 59 |
12 60 to 63 |
- For the MIPS assembly instruction sw $r4,8($r2),
tell how registers and/or memory would be changed.
- For the MIPS instruction add $r2,$r0,$r1,
tell how registers and/or memory would be changed.
- For the MIPS instruction addi $r6,$r5,-4,
tell how registers and/or memory would be changed.
- In the VAX instruction, movl (r3)+, (r6)[r1],
"movl" means move a four-byte word, the "+" indicates autoincrement,
and the square brackets means scaled indexing.
Tell how registers and/or memory would be changed.
-
You are part of a team designing the instruction-set architecture
for a special-purpose processor that will be used in coffee makers,
toasters, and pencil sharpeners. The machine will have 8 registers and
all instructions will be 16 bits long. The team has decided there will
be two instruction formats, R-format (with an opcode, a funct field,
and two 3-bit register fields) and I-format (with an opcode, two 3-bit
registers fields, and an address/immediate field). There are to be 200
R-format instructions (for instance, "grind pencil at speed given by
register rs for time given by register rt") and three I-format
instructions (load, store, and branch on equal). Your job is to
decide how many bits to devote to the opcode field, the funct field,
and the address/immediate field. Make the address/immediate
field as large as possible. Also, make a table that shows what
the valid opcodes are and what they mean.
- Problem 3.19 on page 203 of the text. (The problem is
explained on pages 201-202, in the "In More Depth" section.)