Note that for this session, there is a submittable laboratory exercise which is due by 10 am Monday 30 April (week 9), which will contribute up to 1% of your assessment (in the Tute/Lab mark). While there is no formal Preparation Exercises, please consider what you wold like to cover in Tutorial Question 1 beforehand, and revise your PeANUt on proecdure calls and bit operations.
short int a, b, x, n; ... a = x << n; b = x >> n;What if n > 15? What are other ways this shifting can be achieved in PeANut?
short int a, b, x, n; ... a = x & (0xf << 4); b = x | n;
Important:
Peanut is currently only available on the student Solaris
server - please ssh logon to 'iwaki' and start Peanut
in a terminal window with:
ssh -X iwaki
Peanut &
The assemble and join commands should be run from the Linux hosts.
assemble bitswap.ass
assemble swapbits.ass
join swapbits.rel bitswap.rel
fpio.rel InOut.rel
Note that the instruction loada ch can be used to put the address of ch into the PeANUt accumulator AC.
Assume that the local variables xH and xL are implemented by the stack, and the local variable xtmp is implemented via a block directive (so that it is accessed via direct mode rather than stack mode, and hence can be used as an operand to a PeANUt logical instruction).
By how much should the stack pointer be incremented upon entry into the SwapBits() procedure (and similarly decremented upon exit)?
Note: It may be useful to set the format of the memory location corresponding to ch and xtmp to binary.
Check that xtmp has received the correct value, and that the proper return from the procedure has been achieved.
It may again be useful to set the format of the memory locations corresponding to xL and xH to binary.
Again execute in single step mode to check that the bit operations have been correctly implemented.
submit comp2300 lab7 bitswap.ass swapbits.ass
This is due by 10 am Monday April 30 (the deadline is strict) and will contribute up to 1% of your Tute/Lab mark.