Subject: How long ????

From: "Marc H" <[email-masked]>
Date: Sun, 29 Aug 2010 18:48:12 -0000

Can anyone give me a time in Us that this code would take to execute please....

NOP
MOVB  R1,R2

Just 2 instructions ....

Thanks...

Marcus

---

From: "Tursi" <[email-masked]>
Date: Sun, 29 Aug 2010 13:28:50 -0700

>Can anyone give me a time in Us that this code would take to execute 

Marc, do you have a copy of the datasheet there? Or are you just 
double-checking your reading of it? I'll go through it step by step.

First, the known bits about the machine. Clock runs at 3MHz, so one cycle is 
333.33 nS. 8-bit RAM induces a 4 cycle wait state per access, and 16-bit RAM 
has 0 cycles of wait state.

Now, the datasheet. Start with Table 3 for instruction timing:

NOP isn't an instruction on the TMS9900, rather, it assembles as a JMP to 
the next instruction. A JMP is always taken, so it takes 10 cycles, and 1 
memory access, with no penalty for addressing modes.

MOVB takes 14 cycles, has 4 memory accesses, and uses Address Modification 
Table 'B' for both source and dest. Both arguments are using Workspace 
Register mode, so there are 0 additional cycles and 0 additional memory 
accesses. The values remain 14 and 4.

The cycles then are 10+14 = 24 cycles.
The memory accesses are 1+4 = 5, 2 are instructions and 3 are registers 
(read, read, write in the MOVB).

So now we just have to turn the memory accesses into cycles, by multiplying 
against the wait states.

If code and registers are both in scratchpad, then it's (2*0) + (3*0) = 0. 
The total cycles are 24+0 = 24.
If code is in 8-bit and registers in scratchpad, then it's (2*4) + (3*0) = 
8. The total cycles are 24+8 = 32.
If code is in scratchpad and registers are in 8-bit, then it's (2*0) + (3*4) 
= 12. The total cycles are 24+12 = 36.
If code and registers are both in 8-bit, then it's (2*4) + (3*4) = 20. The 
total cycles are 24+20 = 44.

To get time, multiply the clock cycle time by the number of cycles:

24 * 333.33 = 7999.9 nS
32 * 333.33 = 10666.5 nS
36 * 333.33 = 11999.8 nS
44 * 333.33 = 14666.5 nS

Of course, you asked for uS. There are 1000 nS in a uS, so just divide by 
1000 to get your unit. The end results are (rounded up):

Code16/Reg16 = 24 cycles = 8.0 uS
Code8/Reg16 = 32 cycles = 10.7 uS
Code16/Reg8 = 36 cycles = 12.0 uS
Code8/Reg8 = 44 cycles = 14.7 uS

---

From: Marc Hull <[email-masked]>
Date: Sun, 29 Aug 2010 16:10:56 -0700 (PDT)

Thanks Mike.  Truth be told I was looking for a quick answer in which I had no way to determine so I appreciate your effort.  Anyway you answered my question which means that my theory #68 is blown out of the water.... as usual ;-)

Marc

--- On Sun, 8/29/10, Tursi <[email-masked]> wrote:

From: Tursi <[email-masked]>
Subject: Re: [TI994A] How long ????
To: [email-masked]
Date: Sunday, August 29, 2010, 3:28 PM

  

      >Can anyone give me a time in Us that this code would take to execute 

>please....

against the wait states.

24 * 333.33 = 7999.9 nS

32 * 333.33 = 10666.5 nS

36 * 333.33 = 11999.8 nS

44 * 333.33 = 14666.5 nS

---

From: "kabldb" <[email-masked]>
Date: Mon, 30 Aug 2010 06:29:15 -0000

Very nice explanation. Thanks.

:-)

---

From: "hjalmarii" <[email-masked]>
Date: Mon, 30 Aug 2010 15:13:59 -0000

Wow, Tursi, even I, technoklutz numero uno, understood that.  Thanks. --Hal

--- In [email-masked], "kabldb" <kabldb@...> wrote:
> --- In [email-masked], "Tursi" <yahoogroup@> wrote:
> >

---

From: mark wills <[email-masked]>
Date: Mon, 30 Aug 2010 20:42:16 +0000 (GMT)

Yeah, that rocked!

----- Original Message ----
> From: kabldb <[email-masked]>
> Sent: Mon, 30 August, 2010 7:29:15
> Subject: [TI994A] Re: How long ????
> 

> ------------------------------------
> 
> Yahoo!  Groups Links
> 
> 
> 
>