Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/28/10 12:56
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#180315 - "Best code"
Responding to: ???'s previous message
Richard said:
Well, first of all, the "best" code for one architecture or even one chip within that architecture, is not code that's written to be easily portable between architectures.

This has been discussed a number of times.

There are seldom any "best" code.

And there are seldom any "best" architecture.

The majority of embedded problems don't put any special requirements on the core, so the developer is quite free to chose processor based on other criteria.

Remember all projects implemented with the original 12MHz 12-clocker? These projects still exists. With several architectures having processors (at quite low price) managing 100MHz one-clock instructions, it should be obvious that even HLL code running on a core that may be read/modify/write (such as the ARM) or that doesn't have specific bit instructions, will manage just as well.

And because of the greatly lowered cost of transistors, the cost of memory have changed greatly, so having all - or at least the majority - code written in a HLL doesn't really affect the chip cost. Needing to switch from one processor to a big brother with more memory normally costs more. But moving to another processor (change of architecture or same architecture but other family or manufacturer) often allows a change to a processor with twice as much memory at a lower cost than the original processor.

So for the majority of projects, a very large percentage of the source code can be written in a HLL and can have very little "bindings" to a specific architecture. So the code can be moved to a completely different processor at a quite low cost, and without the developer needing to worry about how to optimize for the new core. Fast enough is fast engouh. Moving to a twice as fast processor (released at a lower price) does not mean the product have any advantages from running twice as fast. How fast needs a lamp timer be? Anyone who can notice if it "thinks" for 1ms or 1us before issuing the on or off command? Same thing with power consumption. A processor with 0.13u features will draw less power even if the program is only 50% as efficient than a 0.4u processor with super-optimized asssembly code.

For a few products, the needs are to have super-tight optimized instructions running on a core that is optimally efficient for the specific task. That may sometimes be a 100MHz 8051 one-clocker. That may sometimes be a DSP. That may sometimes be a processor with 32-bit ALU. But these needs are seldom the case. For the majority of situations, it's the number of pins, the number of UART, the amount of RAM, availability of EEPROM, lead times, purchase price, quality of documentation, availability of tools, ... that are the main selection criteria. And that are the criteria to optimize against.

Hunting assembly optimizations when not needed is often counter-productive. It isn't a question of lowering the standards, but of selling the "right" product at the "right" price to the "right" customer. The customer don't care about the architecture or the percentage of assembler. They have completely different selection criteria.

List of 103 messages in thread
TopicAuthorDate
Migrating to AVR            01/01/70 00:00      
   8051-replacement            01/01/70 00:00      
      Yep, I agree            01/01/70 00:00      
         Toolchain            01/01/70 00:00      
            free compilers            01/01/70 00:00      
               GCC            01/01/70 00:00      
               Free ARM compilers            01/01/70 00:00      
                  "Free" vs "Free"            01/01/70 00:00      
   faster '51 derivatives in DIL/PLCC & availability            01/01/70 00:00      
      Tired of hanging around with 5 mips            01/01/70 00:00      
         Re: Tired of hanging around with 5 Mips            01/01/70 00:00      
            experiences prototyping with smd's            01/01/70 00:00      
               Prototype SMD            01/01/70 00:00      
            Nice, but where to buy and how much?            01/01/70 00:00      
               Re: where to buy and how much?            01/01/70 00:00      
                  Yeah, but....            01/01/70 00:00      
                     I agree            01/01/70 00:00      
                        re the XA            01/01/70 00:00      
                     How many 51' compilers make use of the 51's dual DPTR            01/01/70 00:00      
               You must live on a very interesting corner!            01/01/70 00:00      
                  Ha,ha, AVR are ubiquitus            01/01/70 00:00      
                     HUH??            01/01/70 00:00      
                        Lies, Damned Lies, and Statistics            01/01/70 00:00      
                           I think            01/01/70 00:00      
                        'F120            01/01/70 00:00      
                           "bunchload"            01/01/70 00:00      
                              re: bunchload            01/01/70 00:00      
                                 Youse guys in Old Blightly            01/01/70 00:00      
         Prototyping SMD's            01/01/70 00:00      
            Hand-made PCBs with hand-soldered SMDs            01/01/70 00:00      
            SMD's            01/01/70 00:00      
               Well, that's nice, but not necessary.            01/01/70 00:00      
            a very general - and accurate - comment ...            01/01/70 00:00      
               apprehension            01/01/70 00:00      
   nearby            01/01/70 00:00      
      'jumping' from the '51            01/01/70 00:00      
         AVR update            01/01/70 00:00      
            the chip does not crash            01/01/70 00:00      
               Lockup etc            01/01/70 00:00      
                  increase the clock until lockup            01/01/70 00:00      
                     undefined behaviour            01/01/70 00:00      
                     NO, they do not recommend it            01/01/70 00:00      
                        simultaneous posts            01/01/70 00:00      
                           Overclocking            01/01/70 00:00      
                     This is simply an error in judgment            01/01/70 00:00      
                        all bets are off            01/01/70 00:00      
                     overclocking            01/01/70 00:00      
                        Yeah, okay            01/01/70 00:00      
                           Neeed for speeed            01/01/70 00:00      
                              Because of this...            01/01/70 00:00      
                                 Missing the point            01/01/70 00:00      
                                    missing the point?            01/01/70 00:00      
                                       Modern derivatives            01/01/70 00:00      
                                 hogwash            01/01/70 00:00      
                                 I'm not sure you're on track here ...            01/01/70 00:00      
                                    Hi Richard            01/01/70 00:00      
                                       the problem with AVR's is that they're ATMEL only            01/01/70 00:00      
                                          That's one general and one personal problem            01/01/70 00:00      
                                             Yes, that's what it is ...            01/01/70 00:00      
                                                Second source not so important anymore            01/01/70 00:00      
                                                   It's not as convenient now as it once was            01/01/70 00:00      
                                                      Free tools only have investment in knowledge            01/01/70 00:00      
                                                         again. Per            01/01/70 00:00      
                                                            Not at all            01/01/70 00:00      
                                                         it's not just the tools            01/01/70 00:00      
                                                            "Best code"            01/01/70 00:00      
                                                               There are too many definitions of "best"            01/01/70 00:00      
                                                               Don't go for best            01/01/70 00:00      
                                                   yes and no            01/01/70 00:00      
                                                   Single-source chips vs single-source architecture            01/01/70 00:00      
                                 cross purposes            01/01/70 00:00      
                                    DSP PROCS            01/01/70 00:00      
                                       gp ahead, stay behind the curve            01/01/70 00:00      
                                          Got to disagree there,...            01/01/70 00:00      
                                             I do not consider 'luck' a design parameter            01/01/70 00:00      
                                             Flying leads            01/01/70 00:00      
                                       re: DSP PROCS            01/01/70 00:00      
                           100MHz 32-bit ARM            01/01/70 00:00      
                              The Trap...            01/01/70 00:00      
                                 talking out of both sides of the mouth            01/01/70 00:00      
                                 "on the DSP level"            01/01/70 00:00      
                                    Often hand-optimized assembler available            01/01/70 00:00      
                                    Misunderstood me            01/01/70 00:00      
                                       Cross talk            01/01/70 00:00      
                                       What kind            01/01/70 00:00      
                                       nobody has suggested            01/01/70 00:00      
                           no, you are not            01/01/70 00:00      
                           there are '51s with MACs            01/01/70 00:00      
                              and...            01/01/70 00:00      
                                 yes and            01/01/70 00:00      
                                 He wants Plastic Dips            01/01/70 00:00      
                                    very few and            01/01/70 00:00      
                                    the 33 mips DS89C450 is in DIP if you want            01/01/70 00:00      
            no such thing as "Best"            01/01/70 00:00      
               '51 weaknesses outweigh the AVR            01/01/70 00:00      
                  similiar            01/01/70 00:00      
                  Quite so            01/01/70 00:00      
                     3, 4, 5            01/01/70 00:00      
                        Horses for courses            01/01/70 00:00      
                  Have you considered using a DSP?            01/01/70 00:00      
   I'll be off too, but not to AVR            01/01/70 00:00      
      A Guess            01/01/70 00:00      
         Low volume            01/01/70 00:00      

Back to Subject List