COMP1411 (Spring 2022) Introduction to Computer Systems
Individual Assignment 2 Duration: 00:00, 19-Mar-2022 ~ 23:59, 20-Mar-2022
Student number
Question 1. [3 marks]
Copyright By PowCoder代写 加微信 powcoder
In this question, we use the Y86-64 instruction set (please refer to Lecture 4-6). 1(a) [1 mark]
Write the machine code encoding of the assembly instruction:
“mrmovq 0x230(%rax), %rcx”.
Please write the bytes of the machine code in hex-decimal form, i.e., using two hex-decimal digits to represent one byte. The machine has a little-endian byte ordering. You are allowed to leave spaces between adjacent bytes for better readability.
Show your steps. Only giving the final result will NOT get a full mark of this question.
1(b) [2 marks]
Consider the execution of the instruction “mrmovq 0x230(%rax), %rcx”. Assume that for now, the data in register %rax is 0x100, just before executing this instruction, the value of PC is 0x300. Please use “vm” to represent the actual data reading from the main memory.
Describe the steps done in the following stages: Fetch, Decode, Execute, Memory, Write Back, PC update, by filling in the blanks in the table below.
Note that you are required to fill in the generic form of each step in the second column; and in the third column, fill in the steps for the instruction “mrmovq 0x230(%rax), %rcx” with the above given values. If you think there should not be a step in some stage, just leave the blanks unfilled.
The symbol “←” means reading something from the right side and assign the value to the left side. X:Y means assign the highest 4 bits of a byte to X, and assign the lowest 4 bits of the byte to Y.
Answer: Stages
Decode Execute Memory Write back PC update
mrmovq D(rB), rA
valB ← _________ valE ← _________ valM ← M8[______] R[ ] ← _________ PC ← _________
mrmovq 0x230(%rax), %rcx
valB ← _________ valE ← _________ valM ← M8[______] R[ ] ← _________ PC ← __________
icode: ifun ← _________ rA:rB ← _________ valC ← _________
valP ← _________
icode: ifun ← _________ rA:rB ← _________ valC ← _________
valP ← _________
Question 2. [3 marks]
Suppose a combinational logic is implemented by 6 serially connected components named from A to F. The whole computation logic can be viewed as an instruction. The number on each component is the time delay spent on this component, in time unit ps, where 1ps = 10-12 second. Operating each register will take 20ps.
70ps 30ps 100ps 40ps 70ps 10ps
Throughput is defined as how many instructions can be executed on average in one second for a pipeline, and the unit of throughput is IPS, instructions per second.
Latency refers to the time duration starting from the very first component and ending with the last register operation finished, the time unit for latency is ps.
For throughput, please write the result in the form X.XX * 10Y IPS, where X.XX means one digit before the dot and two fractional digits after the dot, and Y is the exponent.
2(a) Making the computation logic a 3-stage pipeline design that has the maximal throughput. Note that a register shall be inserted after each stage to separate their combinational logics. [1.5 marks]
Please answer how to partition the stages.
Please compute the throughput and latency for your pipeline design, with steps.
2(b) Making the computation logic a 4-stage pipeline design that has the maximal throughput. Note that a register shall be inserted after each stage to separate their combinational logics. [1.5 marks]
Please answer how to partition the stages.
Please compute the throughput and latency for your pipeline design, with steps.
Question 3. [4 marks]
The following byte sequence is the machine code of a program function compiled with the Y86- 64 instruction set (refer to Lecture 6). The memory address of the first byte is 0x300. Note that the byte sequence is written in hex-decimal form, i.e., each number/letter is one hex-decimal number representing 4 binary bits, and two numbers/letters represent one byte.
630030F3020000000000000030F11E000000000000007023030000000 00000601061316211761F0300000000000090
Please write out the assembly instructions (in Y86-64 instruction set) corresponding to the machine codes given by the above bytes sequence, and explain what this program function is computing. The machine has a little-endian byte ordering.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com