For the assembly language map and memory map given below: LOADI R0, 2 LOADI R1,
ID: 2292599 • Letter: F
Question
For the assembly language map and memory map given below:
LOADI R0, 2 LOADI R1, 3 loop: JNZ R0, continue JNZ R1, done continue: SR0 R0, R0 ADDI R0,1 OUT R0 ADDI R1, -1 JNZ R1, loop done: ADDI R0, -3 For each macro-operation the number of micro-operations it required are listed below. The Fetch and Decode Cycles have already been included IN DR OUT DR MOV DR, SR OADI DR ADDI DP ADD DR, SR SRO DR, SR JNZ DR, Address 2 clock cycles 3 clock cycles 2 clock cycles 3 clock cycles 2 clock cycles 1 clock cycles 3 clock cycles 3 clock cycles cycles a) The total number of micro-operations for the execution of the Assembly program. b) The clock frequency of the microprocessor is 1/6 GHz, determine the execution time of the program c) How many bits do you need to designer your Timer Counter for the control unit. ns bitsExplanation / Answer
1 LOADI R0, 2
2 LOADI R1, 3
3 loop: JNZ R0, continue
4 JNZ R1, done
5 continue: SR0 R0, R0
6 ADDI R0,1
7 OUT R0
8 ADDI R1, -1
9 JNZ R1, loop
10 done: ADDI R0, -3
>> Initially R0 is loaded with value 2. no. clock cycles 3, Total clock cycles 3
>> R1 is loaded with value 3. no. clock cycles 3, Total clock cycles 6
>> JNZ R0, continue => jump continue if R0 = 2 != 0, program jumps to Continue. clock cycles 3, Total clock cycles 9
>> SR R0,R0 , clock cycles 3, total clock cycles 12.
>> ADDI R0,1 => R0 = 3, no. clock cycles 2, total clock cycles 14.
>> OUT R0, no. clock cycles 3, total clock cycles 17.
>> ADDI R1, -1 => R1 = 2, clock cycles 2, total clock cycles 19.
>> JNZ R1, loop => R1 = 2 != 0 so jumps to loop, clock cycles 3, total clock cycles 21.
>> JNZ R0, continue => jump continue if R0 = 3 != 0, program jumps to Continue. clock cycles 3, Total clock cycles 24
>> SR R0,R0 , clock cycles 3, total clock cycles 27.
>> ADDI R0,1 => R0 = 4, no. clock cycles 2, total clock cycles 29.
>> OUT R0, no. clock cycles 3, total clock cycles 32.
>> ADDI R1, -1 => R1 = 1, clock cycles 2, total clock cycles 34.
>> JNZ R1, loop => R1 = 1 != 0 so jumps to loop, clock cycles 3, total clock cycles 37.
>> JNZ R0, continue => jump continue if R0 = 4 != 0, program jumps to Continue. clock cycles 3, Total clock cycles 40
>> SR R0,R0 , clock cycles 3, total clock cycles 43.
>> ADDI R0,1 => R0 = 5, no. clock cycles 2, total clock cycles 45.
>> OUT R0, no. clock cycles 3, total clock cycles 48.
>> ADDI R1, -1 => R1 = 0, clock cycles 2, total clock cycles 50.
>> JNZ R1, loop => R1 = 0 so instruction pointer moves to next address, clock cycles 3, total clock cycles 53.
>> done: ADDI R0, -3 => R0 = 5-3 = 2, clock cycles 2, total clock cycles 55.
a) The total no of micro operations for execution of program is 21 and total clock cycles are 55.
b) clock frequency is 1/6 GHz => time period for clock cycle = 6*10^-9 sec = 6nsec, so total program execution time is 55*6nsec = 330nsec
c) total clock cycles are 55 => nearest 2 power is 64 => 2^5 so 5 bits are required for timer counter