Semester One Final Examinations, 2021 CSSE2010 Introduction to Computer Systems Page 1 of 22 This exam paper must not be removed from the venue Venue ____________________ Seat Number __________ Student Number |__|__|__|__|__|__|__|__| Family Name ____________________ First Name ____________________ School of Information Technology and Electrical Engineering EXAMINATION Semester One Final Examinations, 2021 CSSE2010/7201 Introduction to Computer Systems This paper is for St Lucia Campus students (All flexible delivery students and external mode students who have been approved for an on-campus exam) Examination Duration: 120 minutes Reading Time: 10 minutes Exam Conditions: This is an Open Book examination Casio FX82 series or a calculator on the UQ approved list During reading time – write only on the rough paper provided This examination paper will be released to the Library Materials Permitted In The Exam Venue: (No electronic aids are permitted e.g. laptops, phones, e-readers) Calculators – Casio FX82 series or UQ approved (labelled) Written or printed material is allowed Materials To Be Supplied To Students: None Instructions To Students: Additional exam materials (e.g. answer booklets, rough paper) will be provided upon request. Answer all questions on this exam paper. Questions are worth the number of marks indicated For Examiner Use Only TOTAL: Question Mark 1 2 3 4 5 6 7 8 9 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 2 of 22 Question 1. (10 marks) (a) Consider the octal number 1556. Write down the hexadecimal representation of this number (1 mark) (b) Consider the decimal number –98. Write down this number using each of the following binary representations. (1 mark each) i) 9-bit ones’ complement ii) 8-bit two’s complement iii) 10-bit excess-512 iv) 9-bit signed magnitude 1 4 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 3 of 22 Question 1. (continued) (c) What is the decimal value of the IEEE single-precision floating point number 0xB3A5C600. Show your working. (3 marks) (d) Consider the 10-bit two’s complement binary numbers 1110111010 and 1101101111. i) What is the result (in 10-bit binary) of adding these two numbers (1 mark) ii) What would be the values (0 or 1) of the V (overflow), C (carry), N(negative) and Z (zero) flags after the addition operation in (d)-(i) above (1 mark) V: C: N: Z: 2 Q1 /10 3 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 4 of 22 Question 2. (12 marks) (a) Consider the logic function = . &&&&&. ( &&&&&&&) i) Draw a logic circuit which implements this function only using 2-input AND, OR gates and NOT gates. (2 marks) ii) Complete the following truth table for Z. (2 marks) A B C Z 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 iii) Write down a sum-of-products expression for Z. (2 marks) Z = 2 2 2 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 5 of 22 Question 2. (continued) (b) Consider the logic function = . + ‘. i) Draw a circuit which implements X from inputs A, B and C using only two-input NAND gates. (2 marks) ii) Using a logic diagram, show how you can implement the above function X given in (b)-i) using a 4 to 1 multiplexer. You do not need to show the gate level details of the multiplexer (i.e. you can use the standard symbol for a 4 to 1 MUX). (4 marks) 4 2 Q2 /12 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 6 of 22 Question 3. (10 marks) (a) Using positive edge triggered D-flip flops and other gates, draw the logic diagram for a 3- bit synchronous counter which counts through the sequence 000 à 001 à 100 à 011 à 110 à 101 à 111 à 010 à 000 à … Show all your working. (5 marks) 5 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 7 of 22 Question 3. (continued) (b) You are given a 4-bit adder/subtractor module having the 4-bit inputs A=A3A2A1A0 and B=B3B2B1B0 and control input M (M=0 for addition and M=1 for subtraction), and the 4- bit output S=S3S2S1S0 and carry out from the most significant bit C4. Show in a logic diagram, how you can use this module to design a 4-bit signed comparator circuit to detect whether A is greater than B in signed two’s complement format. That is, the final output of the circuit F=1 if A > B (in signed two’s complement format)
and F=0 otherwise. You can use basic logic gates freely and you do not have access to internal signals of the 4-bit adder/subtractor module, such as the internal carry-in/out signals (except for C4, which is the carry out from the MSB). (5 marks) 5 Q3 /10 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 8 of 22 Question 4. (13 marks) Consider the ALU bit slice shown below. [Note that for the output multiplexer on the right hand side, F2 is the most significant of the select bits, so for example, if F2,F1,F0 =0,0,1 then input 1 of the multiplexer will be selected.] (a) Consider 16 of these ALU bit slices put together to form an 16-bit ALU (i.e. with 16-bit data inputs A and B). Complete the following table to show the required control inputs for the ALU to perform the given functions. (Each control input will have value 0 or 1 or X (don’t care). The “carry in” control input applies only to the least significant bit, the “carry in” input of other bit slices comes from the “carry out” output of its neighbouring bit slice. The “right shift in” control input applies only to the most significant bit; the “right shift in” input of other bit slices comes from the “right shift out” output of its neighbouring bit slice.) If it is not possible to generate the given function, make a comment to this effect below the table. If there is more than one way to generate the given function, just show one way. (2 marks each) Description of Function Output ENA INVA ENB INVB Carry In Right Shift In F2 F1 F0 (i) Increment A (i.e., A+1) (ii) Decrement B (i.e., B-1) (iii) Logical shift left of B (iv) * + ‘ (bitwise)(+ is OR) K Z ^ K / /Es E E Z ^ / K & & & /Es 8 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 9 of 22 Question 4. (continued) (b) Write AVR assembly code segments to carry out the following operations. You may use registers other than specified freely as you wish. i) Initialise a 16-bit signed variable (in two’s complement) stored in registers r8:r9 to value (-2). r8 contains the most significant byte and r9 contains the least significant byte. (1 mark) ii) Multiply an 8-bit signed variable (in two’s complement) stored in r5 by 7 and place the result in r6, without using any variant of the multiplication instructions and only using shift/rotate/addition/subtraction operations. You must use only 6 instructions or fewer to accomplish this task. (2 marks) iii) Divide a 16-bit signed variable (in two’s complement) stored in r9:r10 by 4 and place the result back in r9:r10, if r9 stores the most significant byte and r10 stores the least significant byte. (2 marks) 2 Q4 /13 1 2 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 10 of 22 Question 5. (11 marks) This question applies to the AVR ATmega324A microcontroller. (a) Write down the machine code corresponding to the AVR assembly language instruction mov r18, r21 (1 mark) (b) What will be the binary value in register r30 after the execution of the nominated instructions (i) to (x) in the sequence of instructions below. Note that the instructions are not independent – registers and RAM maintain their values from one instruction to the next. You may assume that the stack pointer has been appropriately initialised. (1 mark each) ldi r30, 0x17 push r30 ldi r30, 0166 (i) r30: dec r30 (ii) r30: ldi r30, $FE (iii) r30: ldi r17, 100 lsl r17 rol r30 (iv) r30: ldi r30, 0x50 clr r31 st Y+, r30 (v) r30: ldi r30, low(595) (vi) r30: ldi r31, high(595) adiw ZH:ZL, 8 (vii) r30: ser r30 (viii) r30: push r30 inc r30 pop r30 (ix) r30: pop r30 (x) r30: Q5 /11 1 10 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 11 of 22 Question 6. (13 marks) For each of the following C statements for the Atmel AVR ATmega324A, write down the assembly language equivalent. (You may assume that definitions in the m324Adef.inc file are available. Several instructions may be required. You can freely use general purpose registers). (a) PORTC = 0xF3; (1 mark) (b) UBRR1 = UBRR0; (2 marks) (c) EEAR = 1992; (2 marks) (d) EECR |= (1< 2 1 2 2 Semester One Final Examinations, 2021 CSSE2010 / CSSE7201 Introduction to Computer Systems Page 12 of 22 Question 6. (continued) (e) ADMUX &= ~(1> 2); (3 marks) (f) while (EECR & (1< ; } EECR |= (1