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


Winter Examination Period 2021 — January — Semester A


ECS404U

Computer Systems and Networks

 


Question 1

Digital Representation of Data

(a) This part of the question is based on the four right-most digits of your own 9-digit

student ID number.

(i) Write down the four rightmost digits of your own 9-digit student ID number. For instance, if your student ID number is 201234516 then write down 4516.

(ii)  Replace any occurrences of 0 by a, 1 by b, and 2 by c.  Give the result.  For instance, if the last four digits of your student number are 4516, then write down

45b6.

(iii) Treat the expression you just wrote down as the hex encoding of a bit sequence. Write down the bit sequence represented by the first two characters (45) in  our example, and the bit sequence represented by the last two characters (b6). Explain how you reach your answers.

[5 marks]

(b)  Consider the two binary sequences you obtained in part (a-iii). Suppose each of them represents a signed integer in 8-bit two’s complement, which we will refer to as x and y. What numbers are x and y (in base 10)? Show in detail how each bit pattern relates to the corresponding number.

Note that x and y could be negative or positive numbers depending on your particular case.                                                                                                             [5 marks]

(c)  Show that you understand binary addition by adding the two bit sequences. As well  as showing the method, give the result, and the sequence of carries (including 0). Explain how your result relates to x + y.

[5 marks]

(d)  For this part we treat your student number as a string of characters. Given that ’0’ is the 48th character in the ASCII character set, and ’a’ is the 97th, how are the four characters you wrote down for part (a-iii) represented in UTF-8? Give the hex dump of this string and explain how you get the hex dump of a UTF-8 representation from knowing the decimal representation of ASCII characters.

[5 marks — word limit 100]

(e) This part is about floating point representation.   Give the significand (mantissa) and exponent for the representation of 10.25 in binary.  (Recall that the 10.25 in standard scientific notation would be 1.025 ⇤ 101, you are being asked about the binary equivalent). Use this to explain why the representations of 10.25 and 5.125 are very similar.                                                                       [5 marks — word limit 60]

 

Question 2

Computer Architecture

(a) The designer of the circuit in Figure1 intended to produce a circuit containing an or

gate followed by an inverter. But they have made a mistake. The circuit contains six CMOS transistors, labelled as T1 through T6. It has two inputs labelled A and B, and one output wire labelled C.

 

 

Figure 1: CMOS circuit

 

(i)  List the transistors that are supposed to be part of the or gate, and the transistors that are supposed to be part of the inverter.  Describe how the two gates are connected.

(ii)  Specify the state of each of the 6 transistors T1 through T4 when both input

wires A and B are at Low electric potentials (voltages), that is, when A=0 B=0. What is the resulting behaviour of the circuit? Provide brief explanations with your answers.

(iii)  Describe how to fix the design so that this is indeed an or-gate followed by an

inverter. Explain why your correction works.

[10 marks — word limit 150]

 

(b) The diagrams in Figure2show a single SRAM cell and a single DRAM cell. Concen- trating on the structure and/or the components used in these cells, explain why:

(i) The SRAM design (rather than DRAM) is (generally) used for memory internal to a cpu.

(ii) You would expect DRAM to be slower than SRAM.

[5 marks — word limit 60]


Page 4                                                                                                            ECS404U (2021)

 

 

wordline

High=1

 

T3

A

 

W2

 

B

T4

 

Low=0

 

Bit+                                                           Bit-

bit line

word line

 

capacitor

reference ground

 

 

Figure 2: SRAM and DRAM

 

(c)  Briefly describe how “Cache memory” (e.g., L1/L2) improves the efficiency of a processor.                                                                         [5 marks — word limit 50]

 

(d) This part is about interrupts.

(i)  Explain the problem that was solved by the introduction of interrupts. (ii)  In broad outline, what happens when the cpu receives an interrupt?

[5 marks — word limit 100]

 

Question 3

Instruction Set Architecture, Assembly Language

(a) This part is about comparison of “RISC” (Reduced Instruction Set Computer) versus

“CISC” (Complex Instruction Set Computer) instruction set architectures.

Suppose you have written some complicated code in a high-level programming language like Fortran, Rust, or C. You then compile your code using two different compilers. First you use a compiler that produces machine code for a 32-bit RISC architecture (e.g. ARM or MIPS). Then you use a compiler that produces code for a 32-bit CISC architecture (e.g. an x86 family). So you now have two executable files, one produced by the RISC compiler and one produced by the CISC compiler. Which

of these two executables is expected to be a larger file? Support your answer with a brief explanation.

[8 marks — word limit 50]

 

(b) The following shows a snippet of a programme in 32-bit MIPS Assembler:

 

.text

addi     $t1 ,   $zero ,   ?  #  where  ?   is   the   last   dig it   of   your   student   ID

 

addi  $t1 ,   $t1 ,  3    #  $t1  <  $t1   3

j  LOOP

DONE:

slt   $s0 ,   $t1 ,   $zero

 

#  some  code  to   exit

 

 

Suppose at the beginning of the programme (before entering the LOOP), you put the rightmost digit of your own student ID in register $t1. That is, you replace the question mark in line 2 of the code with the last digit of your student ID.

What will be the value stored in $s0 when the programme finishes? Support your answer by providing the full trace of the programme. That is, write down the values in registers $t1, $t2 and $s0 (depending on whichever one changes) each time

there is a change in any of them as you step through the programme until it finishes execution (and exits).

[7 marks]


 

(c) The following is a programme in 32-bit MIPS Assembler.

 

 

 

$zero ,   6

$zero ,   0

 

$zero ,   ??  #  ??   is   the   next   to   last   dig it   of   your   student   ID $zero ,   ?    #  ?   is   the   last   di g it   of   your   student   ID

LOOP:

$t0 ,   1

 

la     $a0 ,  COMMA_FOR_SEPARATION

syscall

 

LOOP

 

DONE:

 

Codes/Q3_c.asm

Suppose you load the rightmost two digits of your own student ID in registers $t1 and $t2 respectively. That is, in line 6 of the code, you replace ?? with the next to last digit of your student ID, and in line 7, you replace ? with the last digit of your student ID. So for instance, if your student ID is 200123456 then $t1 is initialised to 5 and $t2 is initialised to 6.

Write down what is printed to the console when this programme is run until it finishes.

[10 marks]

 

Question 4

Computer Networks

(a) What is the purpose of each of the following?

(i)  MAC address

(ii)  IP address

(iii) TCP port number

(iv) TCP Sequence number

[10 marks — word limit 150 (overall)]

 

(b)  Recall that when communicating data over a network, we first break it up into packets.

There is a decision to be made about the size of the packets. Provide your thoughts on pros and cons of choosing a smaller packet size versus a larger packet size.

[5 marks — word limit 100]

 

(c)  For each of the following statements, determine whether it is correct or incorrect. Support each of your answers with a brief explanation.

(i) A router needs to also do modulation and demodulation.

(ii) A router typically changes the source and destination MAC addresses of the dataframes that traverse it.

(iii) At the physical layer, you can encode data in electric or electromagnetic waves but not sound waves.

(iv) All packets of the same TCP session between a source and a destination traverse the same intermediate hops (that is, the same path) from the source to the destination.

(v)  HTTP is an application layer protocol that can be used for communication of HTML files, but not multimedia.

[10 marks — word limit 150 (overall)]