Write ARC assembly language instructions that cause the following sequence to occur:
-
Set the %r5 register to contain ASCII string "AjAx".
Set the lowest-numbered programmable register to contain ASCII string "NoTe".
[Note that the A is UPPER-CASE, but the consonants are lower-case.]
- Store the value into memory at location 0x708.
Store the value into memory at location 0x800.
- Now, set the same register to contain a string of four blanks.
[No change.]
- Add the value 0x10203 to the value in memory at location 0x708.
Add the value 0x10101 to the value in memory at location 0x800.
- Fetch the (modified) value at memory location 0x708 into register %r3.
Fetch the (modified) value at memory location 0x800
into the highest-numbered programmable register.
- Perform an exclusive OR between these two registers,
with the result going into register %r17,
and then store this result into memory location 0xCCC.
Perform an exclusive OR between these two registers,
with the result going into register 7 (seven),
and then store this result into memory location 0x400.
NOTE:
- Contents of the memory and the registers are
unknown at the start of this sequence.
- Use only these three programmable registers.
- Some of these steps may require more than one instruction
- Avoid adding unnecessary instructions.
- write the instructions in ARC assembly language,
and also in hexadecimal if you can.
ALSO:
- Add a label for each "task" letter (see above).
(This will help you keep track of which is which.)
- For each instruction, add a comment describing what is changed (the register number or the memory location),
and exactly what value (in hex) is stored into it.
EXAMPLE:
!(This is an example of the STYLE to be used; the instructions are incorrect.)
A:
sethi 66666666, %r0 ! register r32 is set to 0x12345678
mov ax, ds ! 0x9999 is stored in [0x444]
B: ld %sp, %r3 ! 0x8888 is stored in register 3
C: ...
TAKE-HOME PREPARATION FOR THE FINAL EXAM
Prior to the final exam
(in class, on Tuesday 5/19),
be sure to UPLOAD this code to your folder at
http://suffolk.li/
with the file name "final-xyz.asm" (where "xyz" are YOUR initials!)
For the in-class final,
you will be asked to modify these instructions,
and re-upload the result.
There will also be further questions about how the processor
actually decodes and executes these instructions, using the "microarchitecture"
(as described in chapter 5 of the textbook),
as well as some questions on other topics.
You MAY use the ARC simulator for this take-home preparation.
(No simulator on Tuesday, but the in-class exam will be open-book & open-notes.)
|