Introduction to Computer Systems
Tutorial / Laboratory 04 -
Introduction to rPeANUt
Week 5
Preparation [1 mark]
It is expected that you would have looked over your lecture notes of
the rPeANUt module as well as read the relevant parts of the
Specification of the rPeANUt Computer before doing this session.
Don't worry if you have just a partial understanding of rPeANUt. It is
the purpose of this session to help you
acquire familiarity with the fundamentals of the rPeANUt machine.
You should bring the Specification of the
rPeANUt Computer to this and all subsequent tutorial / laboratory
sessions (as well as all the rPeANUt lectures).
Complete the following questions on a separate sheet of paper, with your
name and student number clearly written. Please ensure your writing is
legible. Hand in to your tutor at the beginning of your tutorial /
laboratory session:
- How many bytes of data does the rPeANUt computer have in main memory?
- What is the address space of the rPeANUt CPU?
- How many bytes in each instruction?
- What memory location does the rPeANUt start executing from when it is reset?
- Write and assemble (by hand) a program in rPeANUt that stores the value 5 in address 0x5000, and stores the value 7 in address 0x5001, then loads these values into registers and stores the sum of the values into address 0x5002.
- By hand disassemble the program given in the image below:
Please note addresses 0x0107 and 0x0113 are zero.
What does this program do?
Tutorial Exercises
In the tutorial group discuss:
- The answers to the prep questions.
- The distinction between an assembler, compiler, interpreter, and virtual machine?
- The characteristics that make rPeANUt a RISC machine.
- How to get rPeANUt up and running (for those that need help).
Lab Exercises [4 marks]
- Just using "poke" load the program from question 5 of the preparation questions into rPeANUt simulator.
Execute the program by pressing the "step" button a number of times.
Check that the result in the register is 12 (0x000c). If you wish to re-run it you may need to change the IP back to 0x0100.
- Write a program that prints your name to the terminal without using a loop.
- Write a program that prints your name from a block of data and uses a loop.
- Write a program that counts from 0 to 99 then halts using a loop (the counting just takes place in a register).
- Modify the above program so it prints these numbers to the terminal. So it prints: 00, 01, 02, 03, ..... , 98, 99,
- (optional for COMP2300 - required for COMP6300 students) Strings are not stored very efficiently as each character takes 4 bytes.
However, they can be stored with 4 characters per word. When these strings are output they could be manipulated
(using operation like 'rotate' and 'and') to pull out individual characters.
So suppose in memory we store the following words: 0x68656c6c, 0x6f20776f, 0x726c6400. With each byte in
memory representing a character and the final byte representing the null terminator which marks the end
of the string. Write a program that will take strings in this form and print them.
Show your solutions to your tutor to have them marked.