CS计算机代考程序代写 assembly data structure AI mips UNIVERSITY OF SASKATCHEWAN Department of Computer Science

UNIVERSITY OF SASKATCHEWAN Department of Computer Science
CMPT 215.3 MIDTERM EXAMINATION March 4th, 2020
Total Marks: 50 CLOSED BOOK and CLOSED NOTES no electronic devices
Time: 50 minutes
Instructions
Read each question carefully and write your answer legibly on the examination paper. No other paper will be accepted. You may use the backs of pages for rough work but all final answers must be in the spaces provided. The marks for each question are as indicated. Allocate your time accordingly.
Ensure that your name AND student number are clearly written on the examination paper and that your name is on every page.
Note: two pages are attached listing MIPS machine and assembly language instructions.
Question
Marks
1 ( 7 marks)
2 ( 6 marks)
3 (16 marks)
4 (15 marks)
5 ( 6 marks)
Total
Name:
Student Number:

Name: Page 2 Student Number:
1. General (7 marks in total – 1 mark for each part) Give the technical term that best fits each of the following descriptions or definitions.
2.
(a) The process of combining multiple, independently developed program units.
(b) A type of digital logic circuit without “memory”; the output is a function only of the current input.
(c) An assembly language instruction that has no directly corresponding machine language instruction; an example in MIPS assembly language is “li”.
(d) A memory element storing a single bit, the value of which is changed only on a clock edge.
(e) A data structure created during the assembly process that stores for each label in a program the
memory address to which it corresponds.
(f) Aprogramchosentoserveasthebasisofperformancecomparisonbetweencomputersystems.
(g) With the IEEE 754 floating point standard, the result of dividing 0 by 0.
Computer Performance (6 marks in total)
(a) (2 marks) A processor with a clock cycle time of 0.5 nanoseconds has a CPI of 4 for a particular
program. What is the MIPS rating for this program?
(b) (2 marks) A program is run on a system with two types of machine language instructions: type A instructions each require 3 clock cycles, while type B instructions each require 1 clock cycle. If 100 million type A instructions and 400 million type B instructions are executed, what is the CPI for this program?

Name: Page 3 Student Number:
3.
(c) (2 marks) For a particular program as run on a particular system, the CPU execution time is 1 second, the CPI is 4, and 750 million instructions were executed. What is the clock rate as measured in GHz?
Arithmetic (16 marks in total)
(a) (6 marks) Perform the following conversions:
(i) -1810 to 6 bit 2’s complement. (ii) ABC16 to base 2.
(iii) 0.510 to base 2.
(b) (4 marks) Give a logic equation in sum-of-products form for the logic function F specified by the following truth table. Simplify your logic equation to the maximum extent possible.
A
B
C
F(A, B, C)
0
0
0
1
0
0
1
0
0
1
0
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
(c) (2 marks) Consider the addition of 4 bit values a3a2a1a0 and b3b2b1b0. Give a logic function
for the “carry-in” to the most significant bit position, using quantities gi = ai · bi, pi = ai + bi, and the “carry-in” to the least significant bit position CarryIn0.

Name: Page 4 Student Number:
4.
(e) (2 marks) The IEEE 754 floating point standard allows some numbers to be represented in unnormalized form (called denormalized numbers, or “denorms”). Why?
Machine and Assembly Language (15 marks in total)
(a) (2 marks) In MIPS machine language, the R format instructions need an additional field (the “funct” field) to specify the instruction type (“add”, “sub”, etc.). Why can’t this be done using just the 6-bit “op” field, which all MIPS instructions have, instead?
(b) (3 marks) Give a sequence of MIPS assembly language instructions that adds the contents of $s0 and $s1, storing the result into $s0, if the contents of $s1 are greater than 6. Otherwise, the contents of $s0 should be incremented by 28. In either case, afterwards the contents of $s0 should be copied into $s2.
(d) (2 marks) Give a truth table for a 2 data input, 1 selector input multiplexor.

Name: Page 5 Student Number:
5.
(c) (2 marks) Suppose that the starting address of an array of words is stored in $s0. Give a MIPS assembly language instruction that loads the contents of the second word in the array into $s1.
(d) (4 marks) Suppose that A and B are defined using “A: .word 0”, and “B: .space 100”. Give a sequence of MIPS assembly language instructions that calls a procedure “P” with its two arguments being the contents of A and the address of B, using the standard procedure call conventions, and then stores the return value from “P” into A. (You do not need to show any code for the procedure “P”.)
(e) (4 marks) What is an object file, and what does it contain?
Datapath and Control (6 marks in total)
(a) (4 marks) In the single clock cycle datapath discussed in class, there are two adders, separate from the ALU. What is each adder used for, and why can’t these functions be performed using the ALU?
(b) (2 marks) Give two instruction types for which the “write control signal” for the register file in the single clock cycle datapath discussed in class would need to be 0, so that writes to registers are disabled.
The End