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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Per Westermark
12/28/10 05:56
Read: 1251 times
Sweden


 
Msg Score: +1
 +1 Good Answer/Helpful
#180315 - "Best code"
Responding to: Richard Erlacher'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      Jason Arkwright      12/06/10 10:02      
   8051-replacement      Andy Neil      12/06/10 11:37      
      Yep, I agree      Jason Arkwright      12/06/10 13:47      
         Toolchain      Andy Neil      12/06/10 14:41      
            free compilers      Jason Arkwright      12/06/10 15:32      
               GCC      Andy Neil      12/07/10 00:24      
               Free ARM compilers      Oliver Sedlacek      12/07/10 07:14      
                  "Free" vs "Free"      Andy Neil      12/07/10 07:54      
   faster '51 derivatives in DIL/PLCC & availability      Jan Waclawek      12/06/10 13:26      
      Tired of hanging around with 5 mips      Jason Arkwright      12/06/10 14:04      
         Re: Tired of hanging around with 5 Mips      Valentin Angelovski      12/06/10 17:59      
            experiences prototyping with smd's      Andy Neil      12/07/10 00:09      
               Prototype SMD      Oliver Sedlacek      12/07/10 09:24      
            Nice, but where to buy and how much?      Jason Arkwright      12/07/10 04:57      
               Re: where to buy and how much?      Valentin Angelovski      12/07/10 07:48      
                  Yeah, but....      Jason Arkwright      12/07/10 08:36      
                     I agree      Valentin Angelovski      12/07/10 17:11      
                        re the XA      Erik Malund      12/08/10 06:39      
                     How many 51' compilers make use of the 51's dual DPTR      Andy Neil      12/07/10 17:54      
               You must live on a very interesting corner!      Andy Neil      12/07/10 07:55      
                  Ha,ha, AVR are ubiquitus      Jason Arkwright      12/07/10 08:22      
                     HUH??      Erik Malund      12/07/10 08:36      
                        Lies, Damned Lies, and Statistics      Andy Neil      12/07/10 09:08      
                           I think      Erik Malund      12/07/10 12:01      
                        'F120      Andy Peters      12/07/10 10:36      
                           "bunchload"      Andy Neil      12/07/10 11:35      
                              re: bunchload      Andy Peters      12/08/10 09:28      
                                 Youse guys in Old Blightly        Andy Neil      12/08/10 10:04      
         Prototyping SMD's      John D. Maniraj      12/07/10 00:58      
            Hand-made PCBs with hand-soldered SMDs      Andy Neil      05/04/11 08:30      
            SMD's      Jerry Hudson      05/08/11 09:24      
               Well, that's nice, but not necessary.      Richard Erlacher      05/09/11 09:42      
            a very general - and accurate - comment ...      Erik Malund      05/11/11 07:14      
               apprehension      Andy Neil      05/11/11 07:33      
   nearby      JecksonS Ben      12/07/10 22:12      
      'jumping' from the '51      Erik Malund      12/08/10 06:52      
         AVR update      Jason Arkwright      12/18/10 07:43      
            the chip does not crash      Andy Neil      12/18/10 11:34      
               Lockup etc      Per Westermark      12/18/10 13:41      
                  increase the clock until lockup      Jason Arkwright      12/18/10 15:50      
                     undefined behaviour      Andy Neil      12/18/10 16:24      
                     NO, they do not recommend it      Erik Malund      12/18/10 16:27      
                        simultaneous posts      Erik Malund      12/18/10 16:28      
                           Overclocking        Per Westermark      12/19/10 04:30      
                     This is simply an error in judgment        Richard Erlacher      12/19/10 09:38      
                        all bets are off      Andy Neil      12/20/10 01:19      
                     overclocking        Andy Peters      12/22/10 09:27      
                        Yeah, okay      Jason Arkwright      12/22/10 10:31      
                           Neeed for speeed      Andy Neil      12/22/10 10:56      
                              Because of this...      Jason Arkwright      12/22/10 16:55      
                                 Missing the point      Andy Neil      12/22/10 17:16      
                                    missing the point?      Jason Arkwright      12/22/10 17:46      
                                       Modern derivatives      Andy Neil      12/23/10 01:02      
                                 hogwash      Erik Malund      12/22/10 18:22      
                                 I'm not sure you're on track here ...      Richard Erlacher      12/22/10 20:39      
                                    Hi Richard      Jason Arkwright      12/23/10 14:44      
                                       the problem with AVR's is that they're ATMEL only      Richard Erlacher      12/25/10 08:59      
                                          That's one general and one personal problem      Andy Neil      12/26/10 12:08      
                                             Yes, that's what it is ...      Richard Erlacher      12/26/10 19:29      
                                                Second source not so important anymore      Per Westermark      12/27/10 07:40      
                                                   It's not as convenient now as it once was      Richard Erlacher      12/27/10 08:01      
                                                      Free tools only have investment in knowledge      Per Westermark      12/27/10 08:29      
                                                         again. Per      Erik Malund      12/27/10 09:04      
                                                            Not at all      Per Westermark      12/27/10 09:46      
                                                         it's not just the tools      Richard Erlacher      12/27/10 14:44      
                                                            "Best code"        Per Westermark      12/28/10 05:56      
                                                               There are too many definitions of "best"      Richard Erlacher      12/28/10 15:47      
                                                               Don't go for best      Steve M. Taylor      01/03/11 08:50      
                                                   yes and no      Erik Malund      12/27/10 08:29      
                                                   Single-source chips vs single-source architecture      Andy Neil      12/27/10 10:23      
                                 cross purposes      Andy Peters      12/23/10 11:12      
                                    DSP PROCS      Jason Arkwright      12/23/10 14:25      
                                       gp ahead, stay behind the curve      Erik Malund      12/23/10 14:37      
                                          Got to disagree there,...      Jason Arkwright      01/02/11 15:55      
                                             I do not consider 'luck' a design parameter      Erik Malund      01/03/11 05:24      
                                             Flying leads      Valentin Angelovski      01/03/11 05:33      
                                       re: DSP PROCS        Andy Peters      12/27/10 10:48      
                           100MHz 32-bit ARM      Per Westermark      12/22/10 12:49      
                              The Trap...      Jason Arkwright      12/22/10 17:11      
                                 talking out of both sides of the mouth      Erik Malund      12/22/10 18:27      
                                 "on the DSP level"        Andy Neil      12/23/10 01:07      
                                    Often hand-optimized assembler available      Per Westermark      12/23/10 07:59      
                                    Misunderstood me      Jason Arkwright      12/23/10 16:14      
                                       Cross talk      Per Westermark      12/23/10 16:37      
                                       What kind      JecksonS Ben      12/23/10 18:19      
                                       nobody has suggested      Erik Malund      12/24/10 10:11      
                           no, you are not      Erik Malund      12/22/10 14:59      
                           there are '51s with MACs      Erik Malund      12/22/10 15:05      
                              and...      Andy Neil      12/22/10 16:21      
                                 yes and      Erik Malund      12/22/10 18:28      
                                 He wants Plastic Dips      Neil Kurzman      12/22/10 18:28      
                                    very few and      Erik Malund      12/22/10 18:33      
                                    the 33 mips DS89C450 is in DIP if you want      Richard Erlacher      12/22/10 20:42      
            no such thing as "Best"      Andy Neil      12/18/10 11:38      
               '51 weaknesses outweigh the AVR      Jason Arkwright      12/18/10 16:02      
                  similiar      JecksonS Ben      12/18/10 21:07      
                  Quite so      Andy Neil      12/19/10 08:59      
                     3, 4, 5        Michael Karas      12/20/10 08:25      
                        Horses for courses      Andy Neil      02/14/11 01:22      
                  Have you considered using a DSP?      Richard Erlacher      05/11/11 16:55      
   I'll be off too, but not to AVR      Oliver Sedlacek      02/14/11 03:31      
      A Guess      Michael Karas      05/04/11 18:54      
         Low volume      Oliver Sedlacek      05/05/11 06:25      

Back to Subject List