Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How many cycles is a DEC instruction ?

Status
Not open for further replies.

aral

New Member
How many cycles is a DEC instruction for the MSP430 ucontroler ? The documentation for the msp430 doesn't say .
 
I am not familiar with that chip, but I'm going to assume that the DEC instruction decrements a register by 1, and that it only takes 1 cycle. I see no reason for it to take any additional cycles. It is only performing one function, there are no jumps or additional comparisons or anything else. I would treat it as any other single function instruction.
 
It seems like DEC is an emulated instruction for the msp430 ,I read this in the msp430 documentation, and it is emulated with SUB . Problem is the documentation doesn't specific the number of cycles for DEC and neither for SUB . Also , by my calculations , after mesuring a periodic signal on the oscilloscop, it has to be somwhere between 8 and 10 cycles , I can't seem to find out exactly how many ... If someone know , please tell me !
 
Here's the document that describes the instructions: **broken link removed**

PDF page 71 says that DEC is an emulation of the SUB instruction, and that it performs "destination -1 -> destination".

Page 51 says: There is no code or performance penalty for using emulated instruction.

Page 106 says that the number of instruction cycles do not depend on the instruction itself; instead it depends on the instruction format and the addressing mode.

Page 107 has a big table with lots of symbols, which I do not understand what they mean, and it has lots of different possible timings depending on exactly what you are doing. The number of cycles can vary anywhere from 1 to 6. So whatever you are doing in your code, look for a similar construction on this page.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top