Shop OBEX P1 Docs P2 Docs Learn Events
Duration of a NOP? — Parallax Forums

Duration of a NOP?

jmspaggijmspaggi Posts: 629
edited 2010-09-08 19:09 in Propeller 1
Hi all,

When newbie ask a question, what we hate is when he did not searched [noparse];)[/noparse]

So I searched [noparse];)[/noparse]

Can you please confirm if I'm right?

Standard propeller is running at 80Mhz. Which mean one cycle take 12.5ns. Since a NOP take 4 cycles, that mean a NOP is 50ns.

Correct?

Thanks,

JM

Comments

  • jazzedjazzed Posts: 11,803
    edited 2010-08-03 17:04
    Yes.

    Furthermore if you add conditional expression flags to any instruction and the expression evaluates false, the affected instruction temporarily becomes a NOP to the COG and will be 50ns even if the original instruction is something like rdlong or waitcnt.

    Cheers,
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • jmspaggijmspaggi Posts: 629
    edited 2010-08-03 17:20
    OK. Got it!

    Thanks Steve.

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-06 18:41
    Hi folks,

    I'm using this old post regarding the nop to ask you a Spin question.

    Is there something like a NOP in spin?

    Else, what's the smallest delay I can introduce, and how?

    Is it waitcnt(cnt +1)?
    Of waitcnt(cnt)?

    I would like to wait for 4 cycles, if possible.

    Thanks,

    JM
  • KyeKye Posts: 2,200
    edited 2010-09-06 19:52
    Not in spin... but whatever you are trying to do should be done another way because you shouldn't be trying to code NOPs in a HLL.
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-07 06:17
    Hi Kye,

    It was to reduce tue quantity of data displayed in the terminal while I was waiting in a repeat loop ;)

    So I was just wondering what was the smallest delay possible.

    I finished by simply using a repeat 1 to do it.

    Now that everything is working fine, I removed the trace and the delay.

    Thanks,

    JM
  • RinksCustomsRinksCustoms Posts: 531
    edited 2010-09-07 09:40
    im not sure anything can be done in spin within 4 clocks. SPIN is interpreted on chip at run time and its about 20x slower than PASM.
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-07 09:46
    As close as 4 cycles can 50 cycles if there is nothing better.

    Like between:
    waitcnt(cnt +1)
    and
    repeat 1

    Which one is the smallest?

    Or even beter, will repeat 0 be "cleaned" at the compilation? Or will be interpretated?

    Anyway, I agree this is not a very important information in high level langage, but I was just curious...

    Maybe I should try to mesure them ;)

    JM
  • RinksCustomsRinksCustoms Posts: 531
    edited 2010-09-07 10:43
    the manual states waitcnt(381+cnt) as the absolute minimum time to wait. any lower and you run the risk of missing the required value in cnt reg and your program would freeze until the cnt reg wrapped around again (>53 seconds @ 80MHz clkfreq) as far as the repeat 1 with nothing to repeat, i have no idea exact/avg clocks it would take.

    repeat 0 would prob be interpreted as just repeat i think, and reapeat by itself will infinitely reapeat and not have the effect of creating a delay in the program, but just hang it forever.
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 05:55
    Hum.

    Good to know! I didn't think about the minimal duration. That's right. Else I will have to wait for an entire clock cycle.

    So I will probably go with a repeat 1. Safer for my needs.

    Thanks.

    JM
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-09-08 08:06
    jmspaggi,

    There are probably other solutions to a smaller delay in Spin, but here are a couple that I measured with a scope.
          i := 0                    '3.6us
          i := i                    '4.0us
          repeat 0                  '4.0us
          repeat 1                  '6.8us      
    

    ... here is the program I used. Just measure the time that the pulse is HIGH, and subtract 7.6us.
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    PUB TimeTest|i
    
        dira[0]~~
    
        repeat
          outa[0]~~
    '      i := 0                    '3.6us
    '      i := i                    '4.0us
    '      repeat 0                  '4.0us
    '      repeat 1                  '6.8us      
          outa[0]~                   '7.6us
    
  • jmspaggijmspaggi Posts: 629
    edited 2010-09-08 19:05
    Hi Beau,

    Thanks for those details! Nice way to validate that. I think I will have to buy a scope...

    Is that something which is doable with the "Parallax USB Oscilloscope" or the "PropScope"?

    JM
  • kuronekokuroneko Posts: 3,623
    edited 2010-09-08 19:09
    jmspaggi wrote: »
    Thanks for those details! Nice way to validate that. I think I will have to buy a scope...

    Using a cog counter is cheaper.
Sign In or Register to comment.