CS代考 COMPSCI 4043

Monday 13th December 2021 09.00 am– 11.30 am Duration: 2 hour 00 minutes Additional time: 30 minutes Timed exam – fixed start time
DEGREES of MSc in Information Technology, MSc in Software Development
Systems and Networks COMPSCI 4043
Answer ALL 3 Questions

Copyright By PowCoder代写 加微信 powcoder

This examination paper is worth a total of 60 marks

Express the following in 16-bit two’s complement representation, giving your answers in hexadecimal. Show your working.
(b) Write a segment of Sigma 16 code (not a complete program) to swap the contents of registers R1 and R2, using R3 as a temporary holding register.
Supposing none of the registers R3 to R15 are free. How would you now swap R1 and R2 in the most efficient manner? What is the additional overhead in memory cycles?
(c) A Sigma16 programmer mistakenly puts a single DATA statement initialising a variable, x, to $FF02, at the beginning of the assembly language instead of the end. What will happen when the program runs?
(d) A Sigma16 system has two arrays, X and Y, of seven 16-bit signed numbers (each) in memory. Write an assembly language program to overwrite array X so that X[i] is formed from the larger of the ith elements of X and Y, i.e. xi = max(xi, yi)
For reference, here is part of the instruction set of the Sigma16 CPU.
lea load store add sub mul div and inv
xor cmplt cmpeq cmpgt shiftl shiftr jumpf jumpt jal trap jump
CONTINUED OVERLEAF
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,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, R15:=Ra mod Rb
Rd:= Ra AND Rb
Rd:= NOT Ra
Rd:= Ra OR Rb
Rd:= Ra XOR Rb
Rd:= RaRb
Rd:=Ra logic shifted left Rb places Rd:=Ra logic shifted right Rb places 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

List 3 similarities and 3 differences between an interrupt and a reset.
(b) The following Sigma 16 code is intended to take a 10-element array of two’s complement numbers (only first element is shown) and replace all the elements with their cubes (X[i] is replaced by X[i]*X[i]*X[i]). However, although the code will assemble, it contains several errors.
i. Draw up a register use table for the program (suitable for inclusion as comment).
ii. Identify the errors and explain how you would correct them.
iii. Write out the corrected program.
; Data Area
n DATA X DATA
LEA R1,1[R0] LOAD R2,0[R0] LOAD R3,n[R0]
;Set R1 to constant 1 ;i:=0
;if yes, exit ;load X[i]
;R4= X[i]*X[i] ;R4 = -X[i]*X[i] ;i:=i+1 ;X[i]=–X[i]*X[i] ;loop
FORLOOP CMPLT
JUMPF R14,OUT[R0]
LOAD R4,X[R2] MUL R4,R4,R4 MUL R4,R4,R4 ADD R2,R2,R1 STORE R4,X[R2] JUMP FORLOOP[R0]
-8 DATA …
(c) Estimate how many memory cycles the corrected program would take to run.
(d) In the corrected program estimate the advantage a system with a cache memory would gain if a primary memory cycle takes 10ns and a cache cycle, 1ns.
2 CONTINUED OVERLEAF Page 2

Explain what is meant by a memory fault exception and explain why it is sometimes desirable to recover from such an event and other times inappropriate to do so.
(b) The Motorola MC68000, the microprocessor used in the first Macintosh computers, could have memory faults signalled via a single hardware input wire (called “Bus Error”) but was unable to recover from such faults even when recovery might have been appropriate. Discuss what features a CPU must have to allow it to recover from a memory fault and explain why the 68000 would therefore not have been able to run an operating system with modern memory management.
(d) Nonetheless in some circumstances, video and audio applications do use the reliable transport protocol, TCP for other reasons (for example if firewalls don’t allow alternatives). Discuss how the detrimental issues identified in (c) might be mitigated and discuss whether such mitigation might be more appropriate in some cases than in others.
(c) In the Internet communications system explain why it is often preferred that video and audio applications use unreliable transport, like UDP, and why forcing such applications to use reliable transport, like TCP, would be potentially detrimental.
3 END OF EXAMINATION PAPER Page 3

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com