0x10c Forum|Site Info

Which of the Assemblers do a cycle analysis before running?

6 replies
106 posts
+12 stars
Untagged users
Hi,

I am looking into one of the tools, which gives me the cycles for each assembler instruction in the editor. Also a nice feature would be, if it also summs up loops, so that you easily can see how much cycles you have in this loop.

This could be also done after run if a profiler is included.

If we run into more complext code, I like to see where most of the time is spend in a code (typically in max 10 percent of the code) and where I want to put optimization effort in in terms of speed or in terms of code size.

Code segments with low amount of usage, would be optimized to size (e.g. more loops), but very often used parts would be then optimized to speed, even at the cost of code size.

Any of the existing Assamblers/Emulators/IDEs support that at the moment?
Posted Apr 14, 12 · OP
0  stars
162 posts
+16 stars
Untagged users
I'm not sure, but it's a valid point, and I'll definitely add it to my checklist for when I make an assembler/emulator.
.Png
Posted Apr 14, 12
0  stars
87 posts
+6 stars
Untagged users
That sounds like something that would definitely be worthwhile though I'm not sure how it would be implemented because how would it handle if/else branches where branching may depend on values from somewhere else?
idcsig_astromechza-programmer_c.png
Stealth, Signals Intelligence and Electronic Warfare.
Posted Apr 14, 12
0  stars
106 posts
+12 stars
Untagged users
I am simply working on the ASM Side with my idea. So every instruction have a defined number of cycle consumption. You know this directly if you analyse the instruction. This is part one.

Part two is a runtime analysis. Simply measuring (counting the cycles) and then showing it. Profiling does not work on the base of non executed code. You allways need to execute, cause it will show you which of your complete code is the one, where you spend 90% of your time in. So you then can start optimizing this part where my 1st point come in again. You can then see how much cycles every instruction uses and try to optimize it there.
Posted Apr 14, 12 · OP
0  stars
52 posts
+11 stars
Untagged users
AgentME's assembler does SET PC,LABEL to ADD PC,$RELADDR substitution. Do you know of any assembler with macro facility? Also, which is tool you mention?
Posted Apr 15, 12
+1  stars
1
 stars
32 posts
+3 stars
Untagged users
SerErris wrote:
I am looking into one of the tools, which gives me the cycles for each assembler instruction in the editor.

Any of the existing Assamblers/Emulators/IDEs support that at the moment?

Interesting. I've written an assembler (linux command-line) and was planning to do some work on pretty dumps of assembled code. I could add an instruction cycle dump mode. Would that be of interest to you?

I was planning an annotated output mode along the lines of (PC, ASM, binary).

I could make that display something like (PC, instruction cycles, total cycles, ASM) e.g.
PC Cycles(total) Assembly Binary 0000 1(1) SET A, 0x30 ; 7c01 0030 0002 3(4) SET [0x1000], 0x20 ; 7de1 1000 0020 0005 3(7) SUB A, [0x1000] ; 7803 1000 0007 2(9) IFN A, 0x10 ; c00d


Let me know if that would be useful. My assembler could use some testing and it would be fun to have a "customer".
Current version is here: https://github.com/jonpovey/das
Posted Apr 15, 12
0  stars
24 posts
0 stars
Untagged users
SerErris wrote:
Also a nice feature would be, if it also summs up loops, so that you easily can see how much cycles you have in this loop.
You do realize that this isn't possible in the general case?
Posted Apr 15, 12
0  stars
Login or Register
0x10c.com Feed
There are no entries in this feed
Notices