CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@vick5821 • 25 May, 2013
DELAY_1: MVI C,0AH
LOOP: MVI D,64H
LOOP_5: MVI E,0DEH
LOOP_6: DCR E
JNZ LOOP_6
DCR D
JNZ LOOP_5
DCR C
JNZ LOOP
RET

How do I calculate for the total delay of this code ?

Anyone can help ?

Thanks ><

Pretty confused
@Abhishek Rawal • 25 May, 2013 You need value of clock cycle or clock period to calculate delay.
@vick5821 • 25 May, 2013 clock period is 0.5us.

Thanks
@vick5821 • 25 May, 2013 I am just very confuse on how I can calculate this kind of question systematically ><
@Abhishek Rawal • 25 May, 2013 Do you know how to calculate T-states ?
@vick5821 • 25 May, 2013 I know for a simple one. But still very confuse. Can you help me out ? Having an exam next week 😔

Thnaks and appreciate 😀
@Abhishek Rawal • 25 May, 2013 This program is quite simple.
You see first instruction ? That is counter 0A = 10 in decimal.
Now step by step execute the instruction & note how many times a instruction executes the loop until the number turns to zero.
Find total T-states & multiply it with clock period, You will get the answer.

The calculation of T-states don't have any specific step. It depends upon the program & it's logic.
In short I will say :
Find total number of T-states& multiply it with clock period & get the execution time.
In your case, The outer loop sets the multiplying count to the delay provided by the innermost loop. Though it seems tough it's quite easy.

If you still have problem, I will explain you with a similar example but I won't answer this specific question. You have to obtain answer on your own.
Sorry but that's where fun of logic lies, isn't it ? 😉
@vick5821 • 25 May, 2013 I think I need a similar example for this is it ok ?

I really get my brain cell accident >< LOL
@Abhishek Rawal • 25 May, 2013 Haha! Okay Here it is :

Consider the program (which is very similar to yours) :
MVI D,multiplier count (7T)
L2: MVI C, DelayCount (7T)
L1 : DCR C (4T)
JNZ L1 (10T or 7T)
DCR D (4T)
JNZ L2 (7T or 10T)
HLT

T-states I have mentioned on right side of instruction with round brackets.
Now calculations :
T-states for innermost loop : 7 + (delay count - 1) x 14 + 11
(*)T-states required for exe of program : (multiplier count - 1) x (T inner x 14) + 11

Delay count : 0Ah (10) & multiplier count 5h

Now you can easy calculate T inner : 7 + (10-1) x 14 + 11 = (Something something)
Now put this value of T-states obtained in equation (*) & then multiply with clock period & you'll get the time required for executing the program 😀

This is mere logic. Please note that there is no ideal method to calculate time delay for x-y-z program.
The easiest thing to keep in mind is : Understand the program, calculate total T-states keeping no. of loops in mind & multiply it with clock period.

I guess this helps 😀
@vick5821 • 25 May, 2013 Thank you so much for the guide ! I will try to solve mine and see how it goes !

Appreciate your help 😀
@Abhishek Rawal • 25 May, 2013 Pleasure,Free feel to explore CrazyEngineers.
And hey! spread the word 😀
@vick5821 • 25 May, 2013 Still very confuse on how I can categorised it ><
sigh
@vick5821 • 26 May, 2013 (multiplier count - 1) x (T inner x 14) + 11,

I do not understand this equation. (T inner x14) <--- very confuse for this .. Which part is it ?

Thanks !
13.3k views

Related Posts

@Vivien.hugo · May 24, 2012

I'm wondering how to be cunning in associating with other people? Do you have good ideas?
8.4k views

@Prajakta Kelapure · Sep 16, 2014

Numerical on current , amplification factors of transistors Some basics: 1. Generalized expression for collector current: IC = α IE +IC0[1-e(Vc/VT)] Where VC is the negative and is very large...
8.2k views

@Vikram pai · Aug 17, 2012

Can anyone here can help me in building or giving me ideas for project for marine engineerin related to ships machinery...
4.5k views

@Kaustubh Katdare · Jan 22, 2015

While accessing Whatsapp via Web if you are getting error "Trying to reach phone, make sure your phone has an active internet connection" along with "retrying in x seconds" message...
34.3k views

@Sahithi Pallavi · Nov 17, 2009

My friend asked me this question.! Do a java program runs without the main method? If NO, why? What is the need of main method there in the java program?...
6.9k views