Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Kartman
PostPosted: Feb 09, 2010 - 05:16 AM
Raving lunatic


Joined: Dec 30, 2004
Posts: 4295
Location: Melbourne,Australia

It used to be fun but tedious to reduce state tables to the required logic, but now we have logic compilers that allow us to use a high level description and produce output in next to zero time. Much the same thing as C vs Asm. You won't see much asm in my recently written stuff.....
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: Feb 09, 2010 - 05:44 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 12827
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
We couldn't beat the compiler's code
You mean the compiler's code writer..he/she/them was/were much more experienced in asm coding than the "very experienced developers"..... Wink

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
darshshah
PostPosted: Feb 09, 2010 - 06:48 AM
Wannabe


Joined: Dec 06, 2008
Posts: 53
Location: india

what i meant easy was that i had done assembly programming course in college and it was quite the same as 6502 except the sizes,memory,speed,registers,etc. so i easily adapted the assembly language of 6502.

But i feel C is good than asm as abstraction level is more. i.e. to write loop in C is 1 line code whereas in asm we have to write 5-6 lines...

So i prefer C but have no objection for using assembly.

_________________
regards
www.darshshah.blogspot.com
 
 View user's profile Send private message  
Reply with quote Back to top
Kartman
PostPosted: Feb 09, 2010 - 06:49 AM
Raving lunatic


Joined: Dec 30, 2004
Posts: 4295
Location: Melbourne,Australia

The compiler writers write rules that for a human to implement would take an inordinate amount of time to implement each time a small change was done - register allocation for example. A human tends to write more 'regular' code, for example with an AVR we might use R16 as a temp register whereas the compiler will use what it wants given the circumstances at that point in the code. If we wrote code that way it would be a pig to maintain.
 
 View user's profile Send private message  
Reply with quote Back to top
wek
PostPosted: Feb 09, 2010 - 07:28 AM
Posting Freak


Joined: Dec 16, 2005
Posts: 1390
Location: Bratislava, Slovakia

stevech wrote:
(a MIPS).

MIPS is one of the least human RISCs. And RISCs are deliberately built to be used with a compiler.

But you all miss the point. The point is not that A or B is better or worse; but that A or B is fit for a purpose.

JW
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
jfiresto
PostPosted: Feb 09, 2010 - 08:46 AM
Hangaround


Joined: Oct 07, 2002
Posts: 395
Location: Germany

wek wrote:

But you all miss the point. The point is not that A or B is better or worse; but that A or B is fit for a purpose.
And to answer that you need to know the costs and benefits of each approach. I and probably others have been ignoring the suitability of A or B because we don't know the OP's purpose.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Feb 09, 2010 - 11:15 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 33138
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Most C afficionados sincerely do believe that asm is hard and C is easy

For me it's not a question of "hard" vs "easy" but more vs less typing. You can achieve in one line of C what you'd need to type 10 lines of Asm to do (the output of the C compiler will show this regularly). THAT is why I switched to using C in about 1995 after having done Asm (mainly Z80) for 15 years. In my time I've written a WYSIWYG word processor/spreadsheet in Z80 Asm: http://web.ukonline.co.uk/cliff.lawson/anne.htm and http://toastytech.com/guis/pcw.html as well as some of the Sinclair Spectrum operating system so I've done more than my share of Asm but if I had the time again and the tools had been available at the time I'd have done the word pro in C (maybe not the Spectrum - that did need hand optimised Asm)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Feb 09, 2010 - 05:11 PM
Raving lunatic


Joined: Dec 18, 2001
Posts: 2939


js wrote:
Quote:
We couldn't beat the compiler's code
You mean the compiler's code writer..he/she/them was/were much more experienced in asm coding than the "very experienced developers"..... Wink
I disagree. The algorithms used for register/RAM allocation in non-trivial nested loops and function calls, I contend, are impractical for a person to do.

I am not a dope!
 
 View user's profile Send private message  
Reply with quote Back to top
damien_d
PostPosted: Feb 09, 2010 - 11:14 PM
Resident


Joined: Dec 15, 2008
Posts: 587
Location: Brisbane, Australia

stevech wrote:

We could beat the compiler for smaller functions. And we probably could for a computer with fewer registers than the one we were using (a MIPS).


I can't remember who to attribute the quote to, but someone once said:

"Beginners should not optimise code. Experts should not optimise code... yet"

The quote was about profiling code before introducing "efficiency" hacks. IMO, writing in assembler is one of those.

-- Damien
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Feb 10, 2010 - 12:02 AM
Resident


Joined: Oct 07, 2002
Posts: 978
Location: Skørping Denmark

Kartman:
Quote:
A human tends to write more 'regular' code, for example with an AVR we might use R16 as a temp register whereas the compiler will use what it wants given the circumstances at that point in the code.
For me it's the other way round, the C compiler allways want to use the samme registers over and over again that give a lot of useless mov's that you can avoid. (And yes I do know that the compiler do it that way because the lib's are written to a special register use).
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits