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 rst 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 oating 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 Figure 1 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.

High=1

Low=0

T2

B

T3

T6

T4

B

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 x 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 Figure 2 show 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]

wordline

High=1

T3

A

W2

W1

T2

Low=0

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 les, one produced by the RISC compiler and one produced by the CISC compiler. Which of these two executables is expected to be a larger le? 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:

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

slt $t2 , $zero , $t1

beq $t2 , $zero , DONE

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

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 nishes? 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 nishes execution (and exits). [7 marks]

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

. text

addi $s0 , $zero , 6

addi $t0 , $zero , 0

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

addi $t2 , $zero ,   ? #  ? is the last di g it of your student ID

LOOP:

addi $t0 , $t0 , 1

addi $v0 , $zero ,   1 # syscall code to prin t an integer

add $a0 , $zero , $t1

syscall

beq $t0 , $s0 , DONE

add $t3 , $t2 , $t2

addi $t3 , $t3 ,   1

add $t4 , $t1 , $t3

add $t1 , $zero , $t2

add $t2 , $zero , $t4

addi $v0 , $zero ,  4 # syscall code to prin t a string

la $a0 ,  COMMA_FOR_SEPARATION

syscall

j LOOP

DONE:

addi $v0 , $zero ,   10 # syscall code to exit

syscall

. data

COMMA_FOR_SEPARATION: . asc iiz " ,   " # comma (and space ) string

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 nishes. [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 rst 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.