代写代考 SN2019 Exam: Answers. Q1

SN2019 Exam: Answers. Q1
(a) (i) 180 = 10110100 = $B4 Any suitable arithmetic method for conversion from base 10 to 2 and then to hex, or directly from base 10 to base 16 [2]
(ii) 30 is 00011110 so -30 is 11100010 = $E2 Taught method requires use of algorithm to invert a twos¡¯ comp number by taking one¡¯s comp and adding 1. Any other successful arithmetic argument is also acceptable [2]
(b) The numbers that can be represented are from -2-31 to +231-1 Argument requires knowledge of general domain of n- bit two¡¯s complement code [2].

Copyright By PowCoder代写 加微信 powcoder

(c) Many options for X and Y. E.g. X=11111111 and Y = 00000001. In unsigned code this is 255 and 1 but in two¡¯s complement it is -1 and 1.
For W and Z , e.g. W=1000 0000 and Z=1000001 overflow in both codes. In unsigned code W is 128 and Z is 129; in two¡¯s complement W is -128 and Z is -127.
(d) Outline solution…
;for (i=0; i 0{
; x[i]=x[i]-1 ;}
; Register usage …
ADD LOAD LEA
Loop CMPEQ
SKIP ADD JUMP End TRAP
N DATA X DATA
R15,End[R0]
R14,SKIP[R0]
;i=0 ;R2=N ;R3=1
; If iCS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com