计算机体系结构代写: ICT 121

ICT 121 Introduction to Computer Systems Architecture
Tutor-Marked Assignment July 2017 Presentation
Copyright © 2017 SIM University
[Course code] Tutor-Marked Assignment
TUTOR-MARKED ASSIGNMENT
This tutor-marked assignment is worth 21% of the final mark for ICT121 Introduction to Computer Systems Architecture.
The cut-off date for this assignment is Tuesday 29 August 2017, 2355 hours
_________________________________________________________________________________
Submit your solution document in the form of a single MS Word file on or before the cut-off date shown above. _________________________________________________________________________________
Question 1 (25 marks)
(a) A processor uses 8-bit 2’s complement signed integer representation. Given A = 8610 and B = 3110.
(i) (ii)
(iii)
(iv)
(v)
Give the ASCII character represented by B if its value is 3110.
Express the value of A and the value of B in 8-bit sign-magnitude representation.
(2 marks)
Show how the processor computes the arithmetic operation B – A by performing the computation in 2’s complement arithmetic. Convert the result to decimal and show it is equal to -55.
(6 marks)
Show how the processor computes the logic operation
(NOT(A) AND B) OR (NOT(B) AND A). Express the result in hexadecimal.
(6 marks)
Examine the values of A, B and the result of the operation in (iv). Explain and deduce the logic operation equivalent to the logic operation (NOT(A) AND B) OR (NOT(B) AND A).
(3 marks)
(2 marks)
SIM UNIVERSITY
Tutor-Marked Assignment – Page 2 of 7
[Course code] Tutor-Marked Assignment
(b) The binary bit stream 1100 0001 1011 0000 0000 0000 0000 0000 represents a 32-bit floating point number. Its representation is given in Figure Q1(b). What is the decimal value of this number? Show your working.
(6 marks)
Bit 31 30
Sign
0: positive 1: negative
23 22
Exponent (E) is an unsigned integer
0
Mantissa (M) is an unsigned fixed point fraction
1
8 bits
23 bits
Decimal value = (1.M) * 2E-127
Figure Q1(b)
SIM UNIVERSITY
Tutor-Marked Assignment – Page 3 of 7
[Course code] Tutor-Marked Assignment
Question 2 (25 marks)
Figure Q2 shows the characteristics of a hypothetical machine. This machine has an 8-bit wide memory. The operand of the instruction format shown in Figure Q2(i) is either a Memory address, I/O port number or an integer indicated by a # sign. The assembly language program given in Figure Q2(iv) reads a temperature (in Celsius) from I/O port 200 Hex. The reading is converted to Fahrenheit and the result is stored in memory location 250 Hex. The program starts at memory location 100 Hex. Hexadecimal numbers are prefixed with a $ sign.
Bit 0
3 4
15
Opcode
Memory address, I/O port number or an integer indicated by a # sign
(i) Instruction format
Accumulator (AC) = Temporary storage
(ii) Internal CPU register
0010 = Store AC to memory (STORE) 0011 = Load AC from I/O (IN)
0100 = Add to AC (ADD)
0101 = Subtract from AC (SUB)
0110 = Multiply to AC (MUL) 0111 = Divide to AC (DIV) 1000 = End execution (STOP)
(iii) Partial list of op-codes
Memory Address (in hexa)
Machine Code Instructions in Memory (in hexa)
Assembly Language Instructions
Remarks
100
IN $200
Read temperature in Celsius from I/O port
MUL A, #$9
Multiply AC by 9 and store in AC
DIV A, #$5
Divide AC by 5 and store in AC
ADD A, #$20
Add 32 (20 hex) to AC
STORE A, $250
Store AC to memory address 250
8000
STOP
End of program
(All numbers are in hexadecimal)
(iv) Partial Contents of Memory, Assembly Language Instructions and Remarks
Figure Q2
SIM UNIVERSITY
Tutor-Marked Assignment – Page 4 of 7
[Course code] Tutor-Marked Assignment
Temperature Conversion Formulae between Celsius (C) and Fahrenheit (F): F = (C * 9 / 5) + 32 and C = (F – 32) * 5 / 9
(a) How many memory locations can this processor address?
(b) Use the instruction format in Figure-Q2(i) and op-codes in Figure-Q2(iii) to determine the machine code instructions (in hexadecimal) stored in memory and the starting address of each instruction. In other words, complete all the shaded cells in Figure Q2(iv).
(10 marks)
(c) Use the partial list of op-codes in Q2(iii) to develop a program in Assembly Language instructions. The program is to read the temperature in Fahrenheit from I/O port 400 Hex, convert it to Celsius and store the result in memory location 450 Hex.
(10 marks)
(d) What modification needs to be made to your Assembly Language program developed in Q2(c) if the SUB instruction is not available? That is, you are required to modify the program to add a negative number. Assume 2’s complement number representation is used. Be specific in your modification.
(4 marks)
(1 mark)
SIM UNIVERSITY Tutor-Marked Assignment – Page 5 of 7
[Course code] Tutor-Marked Assignment
Question 3 (25 marks)
(a) What is a stack? Describe TWO (2) important usages of a stack.
(b) Figure Q3(b) is a program segment for the course’s simulated processor. Assume all numbers are in hexadecimal.
(5 marks)
ORG $1000
START MOVE
MOVE #$450, A1
MOVE.B #$A, D0 MOVE.B #$0, D1
LOOP ADD.B
SUB.B #$1, D0
BNE LOOP MOVE.B D1, (A1) STOP #$2700
#$400, A0
(A0)+, D1
(i)
(ii) (iii)
(iv)
Figure Q3(b)
The program includes a loop. Which register is being used as a loop counter and how many times in total will the set of instructions within the loop be executed?
(2 marks)
(2 marks)
From which instruction(s) do you deduce the answers in part (b)(i)?
The loop picks up successive data items from a block of locations in data memory. What are the lowest and highest addresses in hexadecimal of the locations in this block?
(2 marks)
What is the function of the block of instructions that make up the loop in the program? Do not give a description on an instruction-by instruction level; give the overall task of the loop.
(3 marks)
SIM UNIVERSITY
Tutor-Marked Assignment – Page 6 of 7
[Course code]
Tutor-Marked Assignment
(v)
Rewrite the program in Figure Q3(b) to include a subroutine and test its functionality. The subroutine should perform the functions of the loop. The subroutine occupies memory space just below the main program. Use SUBR as the subroutine address label.
Initialise and use test data: 1, 2, 3, … up to the loop counter deduced in part (b)(i). Assume the contents of all data registers are set to zero before the start of the program.
(Reminder: All numbers including the test data are in hexadecimal.)
Test your program with the course’s simulator. Once it is working correctly, copy and pastes your program to your MS WORD answer document.
(9 marks)
Submit a screen shot of the memory contents that include addresses from 3E0 to 470 when the program stops. Use the instructions given below to obtain the screen shot.
Instructions:
1. To view the memory contents at the simulator screen, click on the View
menu and select Memory. Click on the Page down button to the required addresses. Verify that the memory contents are indeed correct.
2. To capture the ‘screen shot’ select the window, press + on your computer keyboard, and then paste it onto your word document.
(2 marks)
(vi)
Question 4 (25 marks)
(a) A computer system has a 16-bit address bus and can address an 8-bit wide memory. The memory of this computer system contains 8 Kbytes of ROM, 32 Kbytes of user RAM and 8 Kbytes of video RAM. The ROM, user RAM and video RAM form a contiguous block of memory starting at address 0. The rest of the address range is not used.
Draw a memory map for the computer system. Indicate the starting and ending addresses in hexadecimal for each block of memory and any unused space.
(15 marks)
(b) Describe the characteristics and operations of a multiplexed bus interconnection in a computer system.
—– END OF TMA —–
(10 marks)
SIM UNIVERSITY
Tutor-Marked Assignment – Page 7 of 7