In fact, this statement in the development of DSP and other systems are often used, such as the change of some configurations need to delay a few clock cycles before it can take effect, when the ASM ("RPT #7 | | NOP ") can be a shining debut. Although this function we all know and often use, but the specific details many people do not know, including me. Today, in an exchange group, someone suddenly asked the instructions to go down after the execution, how many clock cycles will be occupied. The result is conceivable to ask the monk.
The Simple writing section code compiles the download to the movie inside (I am uses 28335 to carry on the test. ) to observe the TIMER0TIM bit of the CPU TIMER0 registers. Discovery execution asm ("RPT #7 | | NOP "), the Timer0tim bit increment is 8. That is to say 8 cycles per execution. 8 instruction cycles, to be exact. This is only the case of CPU idle, because in idle time, a instruction cycle is about a clock cycle. If 28335 has a task, it may take up 9 or more clock cycles, which is to analyze the pipeline and other factors. In practical applications, it is not necessary to be so precise. Other films may also have more than 8 clocks, mainly to see how many cycles each instruction needs to perform. But one thing is for sure is ASM ("RPT #7 | | NOP ") This instruction is bound to encroach on 8 instruction cycles. Because this instruction means repeating 7+1=8 NOP instructions.
A simple summary:
For tms320f28335 ASM ("RPT #N | | NOP ") executes the n+1 secondary NOP instruction, consuming n+1 instruction cycles. Normally takes up a n+1 clock cycle. Other films occupy a clock cycle of their own calculations. O (∩_∩) o ...