Monday 9 May 2016 9:30 am – 11:30 am
(Duration: 2 hours)
DEGREES OF MSc, MSci, MEng, BEng, BSc,MA and MA (Social Sciences)
Systems and Networks (M) Answer ALL Questions
This examination paper is worth a total of 60 marks
The use of a calculator is not permitted in this examination
INSTRUCTIONS TO INVIGILATORS
Please collect all exam question papers and exam answer scripts
and retain for school to collect. Candidates must not remove exam question papers.
1. (a)
In a 16-bit two’s complement code what are the codewords for:
- 50
- -15
Express your answers in hexadecimal.
[4]
[2]
(c) In the MC6811 the CCR has four status flags which are set by the ADD instructions: C (carry), V (two’s complement overflow), Z(zero) and N(sign). If an ADD instruction is used to add the two 8-bit values, $7F and $80, which of these flags will be set following the operation? Explain your answer in each case.
[4]
[6]
[4]
(b) The current version of the Sigma16 processor does not have any equivalent of the Condition Code Register in the MC6811. What are the consequences of this?
(d) A Sigma16 system has two arrays, X and Y, of 4 16-bit signed numbers in memory. Write an assembly language program to swap the arrays, so that all elements of X end up in Y and vice versa.
(e) With a view to maximising efficiency, modify your program in (d) so that the ith elements of X and Y are only swapped if xi > yi.
For reference, this is part of the instruction set of the Sigma16 CPU.
lea load store add sub mul div cmplt cmpeq cmpgt jumpf jumpt jal trap jump
Rd, x[Ra] Rd, x[Ra] Rd, x[Ra] Rd,Ra,Rb Rd,Ra,Rb Rd,Ra,Rb Rd,Ra,Rb Rd,Ra,Rb Rd,Ra,Rb Rd,Ra,Rb Rd, x[Ra] Rd, x[Ra] Rd, x[Ra] Rd,Ra,Rb x[Ra]
Rd:= x +Ra
Rd:= mem[x +Ra] mem[x +Ra]:=Rd
Rd:= Ra+Rb
Rd:= Ra-Rb
Rd:= Ra*Rb
Rd:= Ra/Rb
Rd:= Ra<Rb
Rd:= Ra=Rb
Rd:= Ra>Rb
If Rd=0 then PC:=x+Ra If Rd<>0 then PC:=x+Ra Rd:= pc, pc: =x +Ra PC:= interrupt handler PC:= x +Ra
CONTINUED OVERLEAF
Page 1
2
(a) Explain what is meant by an exception and describe how such an event is handled by a typical operating system.
3.
- Initialise the interrupt vector;
- Initialise the stack pointer.
(a) In the Internet, explain why data is broken up into separate limited-size IP packets and why such packets are sometimes able to arrive in the wrong order at the destination.
[6]
[6]
[6]
(b) Describe the following exceptions and outline briefly where they are used: i. Reset;
[4]
[10]
(c)
In the context of the MC6811 explain what will happen and why, if a programmer who has just written an interrupt routine fails to:
ii. Interrupt;
iii. Trap (Software Interrupt); iv. Memory Fault.
(b) If two IP packets do arrive at their destination in the wrong order, discuss in detail how the destination should react.
(c) Another problem that may occur in IP transit is that packets could get destroyed. Give two reasons that might cause this?
[4]
(d) If a packet does get destroyed in transit what are the implications for the data transfer and how can the problem be rectified?
[4]
END OF EXAMINATION PAPER Page 2