exam 3
exam 3
Name: _______________________
(1.1) Fill out the blanks for the machine code (in hex) for each of the instructions contained
in the program.
(1.2) Determine the output and the value stored in the AC when the program terminates.
Page 1 of 8
(2) (2 points) Create a symbol table for the assembly program shown in Problem (1) above.
Start 100
A 108
B 109
C 10A
D 10B
(3.1) For the following MARIE instruction, where is the return address stored?
JnS sub
(3.2) What MARIE instruction is used to pass control back to the caller from the callee?
Instruction JumpI
(4.1) Store the following unsigned integer in big endian starting from memory address 10016:
A3D5916. Be sure to extend the unsigned integer to the appropriate number of bits.
10016: 00
10116: 0A
10216: 3D
10316: 59
(4.2) Store the unsigned integer shown in Problem (4.1) above in little endian starting from
memory address 10016.
10016: 59
10116: 3D
10216: 0A
10316: 00
Page 2 of 8
(5) (2 points) The following shows the contents of a memory and the index register (i.e. R1) for a
computer system. Determine the value loaded into AC using different addressing modes for
the following instruction: Load 400.
10016 60016
......
40016 10016
......
50016 20016
......
60016 50016
R1 = 20016
(6) (2 points) Use a stack to show how the following arithmetic expression represented in postfix
notation is processed. You must (a) use a stack like the following to process the expression,
(b) show the push and pop operations when necessary, and (c) show the contents on the stack
for each step.
ABC–D*+
Page 3 of 8
B
Pop C from the stack: A
B–C
Push B – C onto the stack: A
D
B–C
Push D onto the stack: A
B–C
Pop D from the stack: A
D*(B – C)
Push D*(B – C) onto stack: A
(7) (2 points) Given 16-bit instructions, determine if it is possible to use expanding opcodes to
allow the following to be encoded, assuming there are a total of 32 registers.
216 = 65536
60 × 25 × 25 = 60 × 210 = 61440
30 × 25 = 30 × 32 = 960
3 × 210 = 3 × 1024 = 3072
61440 + 960 + 3072 + 26 = 65498 < 65536, so it is possible to use the expanding opcodes to
encode the instructions.
Page 4 of 8
(8) (1 point) Make a right rotate for the following sequence of 8 bits.
100101102
010010112
(9) (2 points) Determine the tag, line number, and byte offset for a 32-bit memory address space
for the following address that is stored in a cache using the direct mapping method, where the
cache contains 1024 lines and each block contains 8 bytes. Your answer should be
represented in hex.
9A73D82C16
(10) (2 points) Determine the tag and byte offset (in hex) for Problem (9) above for a fully
associative cache.
tag (leftmost 29 bits) = 1001 1010 0111 0011 1101 1000 0010 12 = 134E7B0516
byte offset (rightmost 3 bits) = 416
(11) (2 points) Determine the tag, set number, and byte offset (in hex) for problem (9) above for
a 4-way set-associative cache.
Page 5 of 8
(12) (2 points) Suppose the daytime processing load consists of 60% CPU activity and 40% disk
activity. Suppose the disks can be upgraded for $8000 to make them 150% faster than the
current speed and the CPU can be upgraded to make it 40% faster for $5000.
(12.1) Which option would you choose if you don't care about the money, but want a higher
overall system performance improvement? Justify your answer.
1
The disk option: f = 0.4, k = 2.5, S = 0.4 ≈ 1.32
(1−0.4)+( )
2.5
1
The CPU option: f = 0.6, k = 1.4, S = 0.6 ≈ 1.21
(1−0.6)+( )
1.4
The disk option is chosen because it has a higher overall performance improvement.
(12.1) Which option would you choose if you do care about the money you spent? Justify
your answer.
The CPU option will be chosen because it has a lower amount of money spent on unit
overall performance improvement.
(13.1) In HDDs, A cylinder is a collection of tracks at the same location on all the platter
surfaces. Determine the total number of tracks for a cylinder of a disk drive that has
10 platters mounted on its spindle.
20 tracks
(13.2) Determine the time (in milliseconds) taken to make 1 full rotation by a spindle that
spins at the rate of 14400 rpm.
(13.3) Determine the total number of tracks needed to store an 8 MB file on the disk drive
that supports 400 sectors per track and each sector has 512 bytes.
(8×1048576)/(400×512) ≈ 41 tracks
Page 6 of 8
(14) (2 points) Solve the following two problems.
(14.1) Determine the clock cycles needed to execute a program containing 20 sequential
instructions carried out on a system supporting a pipeline containing 7 stages, each of
which takes 1 clock cycle to carry out its corresponding task.
(14.2) Determine the speedup made by the pipeline for Problem (14.1).
20×7
Speedup = ≈ 5.38
26
(15.1) What is the problem with executing the following 2 assembly instructions using a
pipeline supporting 5 stages (i.e. FI, DI, FO, EI, and SR), where the Add instruction
adds R2 and R3 and leaves the result in R1 and the Mul instruction multiplies R5 and
R1 and leaves the result in R4? Use the pipeline stages (i.e. FI, DI, FO, EI, and SR) to
justify your answer.
Stall the pipeline by 2 clock cycles for Mul or insert 2 NOP instructions between the
2 instructions.
Page 7 of 8
(17) (2 points) Fill in the blanks for the following sequence of data bits using the RS-232 serial
data transmission method shown in class. We assume the data bits are transmitted starting
from the least significant bit.
110101102
idle bit: 0
start bit: 1
1st data bit: 0
2nd data bit: 1
3rd data bit: 1
4th data bit: 0
5th data bit: 1
6th data bit: 0
7th data bit: 1
8th data bit: 1
stop bit: 0
idle bit: 0
(18) (1 point) What is the maximum number of disk operations that can be executed
simultaneously to access a disk system consisting of 4 disk drives and supporting RAID-5?
(19) (1 point) Which of the following (may be multiple) provide(s) the feature of data
redundancy? RAID-0, RAID-1, RAID-2, RAID-3, RAID-4, RAID-5, and RAID-6.
RAID-1
(20) (1 point) Which of the following (may be multiple) provide(s) the feature of system
reliability? RAID-0, RAID-1, RAID-2, RAID-3, RAID-4, RAID-5, and RAID-6.
Page 8 of 8