Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CS1S Computer Systems: Questions and Solutions

2021

1. (a) Convert 1011 1100 to a decimal number, assuming binary representation.

Calculate 128 + 32 +16 + 8 + 4= 188 by adding the powers of2 corresponding to the positions where there is a 1 bit in the word.

[Problem solving. 1 mark for correct powers of 2, 1 mark for adding them]


(b) Convert 1011 1100 to a decimal number, assuming two’s complement

representation.


Since the leftmost bit is 1, this is a negative number. Negate it to get a nonnegative number. To negate, first invert it, giving 0100 0011. Then increment it, giving 0100 0100. Now this result is nonnegative, so its binary representation is the same as its two’s complement value; this is 64 + 4 = 68. Since the negation of the original word is 68, the answer is -68.

[Problem solving. 1 mark for identifying it as negative; 1 mark for inverting and 1 mark for adding 1 and getting the correct result.]

(c) Translate the following Sigma16 assembly language to a single line statement in  high level language, assuming that y, i are integer variables and x is an array. The data statements for the variables are omitted for simplicity. Just identify the          calculation performed and present it in a single statement.

load   R1,i[R0]

load   R2,x[R1]

lea    R3,35[R0]

div    R4,R2,R3

store  R4,y[R0]

y := x[i]/35

[Problem solving, requires understanding usage ofregisters, variables, and basic instructions. 1 mark for loads, 1 mark for store, 1 mark for arithmetic, 1 mark for lea.]



(d) Give a detailed account of the sequence of steps performed by the processor as it executes the instruction:  store R3,z[R4]


(1) The instruction is fetched: ir = mem[pc], pc++. (2) Then the opcode is examined and

the control jumps to the control for a store. The second word ofthe instruction is fetched: adr = mem[pc]; this places the value of z in adr. (3) The effective address is calculated: adr = adr + R4 = z + R4. (4) The data is fetched from the Destination Register and placed in the destination adr: mem[adr + R4] = mem[z + R4] = R3

[Bookwork and synthesis. 1 mark for each step.]