Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cycle-length for AVR #3153

Closed
condret opened this issue Aug 23, 2015 · 7 comments
Closed

cycle-length for AVR #3153

condret opened this issue Aug 23, 2015 · 7 comments
Labels
AVR AVR architecture support issues enhancement RAnal

Comments

@condret
Copy link
Member

condret commented Aug 23, 2015

right now i just sit beside a guy who is doing decompiling by hand and he uses IDA to view the disassembly, he always has to look at the data-sheet for the cycle-length. I think we could make him us r2 if we support cycle-length for AVR.

@condret condret added the RAnal label Aug 23, 2015
@radare
Copy link
Collaborator

radare commented Aug 24, 2015

Where's that documentation?

On 23 Aug 2015, at 23:38, condret notifications@github.com wrote:

right now i just sit beside a guy who is doing decompiling by hand and he uses IDA to view the disassembly, he always has to look at the data-sheet for the cycle-length. I think we could make him us r2 if we support cycle-length for AVR.


Reply to this email directly or view it on GitHub.

@Maijin
Copy link
Contributor

Maijin commented Aug 24, 2015

@condret
Copy link
Member Author

condret commented Aug 24, 2015

@radare
Copy link
Collaborator

radare commented Aug 24, 2015

Arithmetic operations work on registers R0-R31 but not directly on RAM and take one clock cycle, except for multiplication and word-wide addition (ADIW and SBIW) which take two cycles.
RAM and I/O space can be accessed only by copying to or from registers. Indirect access (including optional postincrement, predecrement or constant displacement) is possible through registers X, Y, and Z. All accesses to RAM takes two clock cycles. Moving between registers and I/O is one cycle. Moving eight or sixteen bit data between registers or constant to register is also one cycle. Reading program memory (LPM) takes three cycles.

On 24 Aug 2015, at 16:54, condret notifications@github.com wrote:

https://en.wikipedia.org/wiki/Atmel_AVR_instruction_set#Instruction_encoding https://en.wikipedia.org/wiki/Atmel_AVR_instruction_set#Instruction_encoding

Reply to this email directly or view it on GitHub #3153 (comment).

@Maijin
Copy link
Contributor

Maijin commented Aug 24, 2015

Everything is in the pdf table but there is two columns for clocks:

#Clocks
#Clocks XMEGA
3. Cycle times for Data memory accesses assume internal memory accesses, and are not valid for accesses via the
external RAM interface.
4. One extra cycle must be added when accessing Internal SRAM.
5. Number of clock cycles for Reduced Core tinyAVR®.

Mμ dependant looks like :p

@condret
Copy link
Member Author

condret commented Aug 25, 2015

the thing is that someone needs to spend some love on the plugin

@Maijin Maijin added the AVR AVR architecture support issues label Nov 27, 2016
@killabytenow
Copy link
Contributor

The current ANAL plugin already supports cycle-counting. I know it is not pretty accurate and I need to improve the cycle counter (depending on current CPU) because some instructions cycles depend on the registers or other surrounding instructions, but anyway the current plugin already counts cycles, and it is precise when calculating the cycle-count on the current instruction pointed by the PC (other instructions are only approximated). So we may consider this issue closed if admins agree with me.

@Maijin Maijin closed this as completed Mar 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AVR AVR architecture support issues enhancement RAnal
Projects
None yet
Development

No branches or pull requests

4 participants