--- In AVR-Chat@yahoogroups.com, Martin Jay McKee <MartinJayMcKee@d...> wrote: > I'd like to find a way to minimize the difference between the > run times of the subroutine for states 1 and state N. Instead of using a sequential set of comparisons (sometimes called a skip chain), use a dispatch table instead. The table would contain code space addresses, you index it with the state value (after checking validity), load the address from the table into r31:30, and them do an ijmp or icall. (Your target processor may or may not support these instructions.) As a side note, in the code that you showed the clz instruction is superfluous. The compare instruction will either set or clear the Z flag depending on the values. Don
Message
State Machine Coding (was no subject)
2005-10-26 by Don Kinzer
Attachments
- No local attachments were found for this message.