Knowee
Questions
Features
Study Tools

What is the delay of the following program? MVI B, 10H LOOP2 MVI C, 0FH LOOP1 DCR C JNZ LOOP1 DCR B JNZ LOOP2 A) 3652 T-states B) 3533 T-states C) 2510 T-states D) 3600 T-states

Question

What is the delay of the following program? MVI B, 10H LOOP2 MVI C, 0FH LOOP1 DCR C JNZ LOOP1 DCR B JNZ LOOP2 A) 3652 T-states B) 3533 T-states C) 2510 T-states D) 3600 T-states

🧐 Not the exact question you are looking for?Go ask a question

Solution

The delay of the program can be calculated by understanding the number of T-states each instruction takes and then multiplying it by the number of times the instruction is executed.

  1. MVI B, 10H: This instruction will load the B register with the value 10H. It takes 7 T-states to execute and it is executed once. So, total = 7 T-states.

  2. LOOP2 MVI C, 0FH: This instruction will load the C register with the value 0FH. It also takes 7 T-states to execute. It is executed 16 times (once for each value of B from 10H to 01H). So, total = 7 * 16 = 112 T-states.

  3. LOOP1 DCR C: This instruction will decrement the value in the C register by 1. It takes 4 T-states to execute. It is executed 240 times (15 times for each value of B from 10H to 01H). So, total = 4 * 240 = 960 T-states.

  4. JNZ LOOP1: This instruction will jump to LOOP1 if the zero flag is not set (i.e., if the previous operation did not result in a zero). It takes 7 T-states if the jump is taken and 10 T-states if not. It is executed 240 times with the jump taken (15 times for each value of B from 10H to 01H) and 16 times without the jump (once for each value of B from 10H to 01H). So, total = (7 * 240) + (10 * 16) = 1680 + 160 = 1840 T-states.

  5. DCR B: This instruction will decrement the value in the B register by 1. It takes 4 T-states to execute. It is executed 16 times (once for each value of B from 10H to 01H). So, total = 4 * 16 = 64 T-states.

  6. JNZ LOOP2: This instruction will jump to LOOP2 if the zero flag is not set. It takes 7 T-states if the jump is taken and 10 T-states if not. It is executed 15 times with the jump taken (once for each value of B from 10H to 02H) and once without the jump (when B is 01H). So, total = (7 * 15) + (10 * 1) = 105 + 10 = 115 T-states.

Adding up all these T-states gives the total delay of the program: 7 + 112 + 960 + 1840 + 64 + 115 = 3098 T-states.

So, none of the options A) 3652 T-states B) 3533 T-states C) 2510 T-states D) 3600 T-states are correct. The correct answer should be 3098 T-states.

This problem has been solved

Similar Questions

Discuss: 1. TMOD, TCON, IE and IP register2. Procedure (Steps) for Time Delay calculation with an example

How many times JNZ instruction is executed in the following program? MVI C, 20H LOOP: DCR C JNZ LOOP A) 20 B) 30 C) 32 D) 40

In which of the following pipeline, all the tasks includes equivalent processing time ?ans.ArithmeticUniform DelayProcessorInstruction Previous Marked for Review Next

Describe the different types of delays at each node along the path the packet traverses. State an expression to represent the total node delay with a diagram.

Consider an instruction pipeline with four stages with the stage delays 5 nsec, 6 nsec, 11 nsec, and 8 nsec respectively. The delay of an inter-stage register stage of the pipeline is 1 nsec. What is the approximate speedup?Question 7Select one:a.0.25b.250c.25d.2.5

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.