M8 Code Execution Time

Question: Is there an easy way to tell how much time a section of code takes to execute?

 

Answer:

Yes. The .LST file produced by the CYASM assembler includes three fields in the leftmost column of the listing. The first field is the address field, which contains the address of the instruction contained on that line. The second field contains one or two bytes that represent the actual hex code assembled for that instruction. The third field is a single-digit number in brackets. That number indicates the number of clock cycles required to execute the instruction. Assuming that you're running the part at 12 MHz, multiply that number times the clock cycle time of (1/12000000) or 82 ns to determine the time required to execute the instruction. If you have a series of instructions that you want to measure, just add all of the cycle time values in the listing and multiply the total by the clock cycle time to determine the execution time of the code section.


Related Document :


CYASM Assembler Guide