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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/04/09 13:37
Read: times


 
#163063 - Still not needed for other architectures
Responding to: ???'s previous message
Richard Erlacher said:
Per Westermark said:
Richard Erlacher said:
The dual data pointers with automatic increment/decrement, and automatic alternation between them, if you want/need it, is not something I'd expect to see on an ARM anytime soon.

Why do you think the ARM needs it?

I didn't mean to imply that an ARM needs it. I simply said I didn't expect so convenient a feature to appear on an ARM.

But it wouldn't be convenient on the ARM, since the ARM instructions has already reserved bits to specify which register to use and reserved bits to inform if the register should increment or decrement. So there are no need for duplicating the 8051 extension - the ARM solution is already a super-set.

Richard Erlacher said:
Per Westermark said:
With every register a potential pointer, the compiler don't have to think single or double.

It has nothing to do with single or double, but, rather with convenience and performance. The Maxim/Dallas part fetches a byte, and increments the pointer, all in 30 ns.

But the timing isn't part of the instruction set. This is a single instruction for the ARM too. All newer processors can load and increment in a single instruction. In this case it is just a question of how the specific ARM has the memory connected (remember that the ARM is sold as a core and the chip manufacturers may decide what kind of memory interfaces to integrate) that controls if there will be a need of extra clock cycles because the execution stalls.

Richard Erlacher said:
Per Westermark said:
The auto-alternate in the 8051 is smart, but it is a hack since the instruction set doesn't have any bit to select which register to use.

Acually, it has an SFR that determines which to use, so a single instruction will do the trick. Further, there's a bit that makes it switch, automatically, between the two DPTR's on every use of DPTR.

Yes, I know how this extension has been implemented in some 8051 derivatives. But the extension is meaningless in the ARM since the actual load/store instruction in the ARM already has dedicated flags for this. There is no need to use a configuration register somewhere to get the ARM to know which register to use for a memory access, or if the register should be updated after the access. It is actually the reverse situation from what you consider. The 8051 has a hack to try to become almost as convenient as the ARM (or x86 or PPC or MIPS or ...) but the 8051 hack only comes halfway.

Richard Erlacher said:
Per Westermark said:
All real processors have indexed reads with automatic increment/decrement.

Yes, but we're not talking "real" processors here ... we're talking microcontrollers.

Dangerously close to religious war here - I consider many of the ARM chips available to be microcontrollers. It is just a question of what kind of peripherials etc that has been integrated, and how they have been integrated. The microcontroller world is not a subset only allowing some 4- and 8-bit processors.

Richard Erlacher said:
Per Westermark said:
Richard Erlacher said:
There are some things, however, that will likely cause 'C' and other HLL's to cough, for example moving an array from external XRAM to internal XRAM at the same physical address. I can't imagine am elegant way to do that in any HLL since it requires the pointers to have the same value and I'd expect the compiler to complain.

Keil doesn't have support for it, but what you are talking about is basically the based pointers used by Borland to get a 16-bit near pointers that addressed code (__cs) or stack (__ss) which in the 16-bit and 32-bit segmented modes of the x86 processors do represent different memory areas with identical offsets.

I didn't realize I was talking about that ... but neither of the data pointers is stack-related. This feature is on the Maxim/Dallas DS89C4x0, with either 16KB or 64KB of code space and 1 KB of on-chip XRAM.

I don't think you understood what I was talking about. In the 16-bit x86 world, the processor accessed all memory based on four segment registers, CS, DS, ES and SS. They are basically a form of index registers. And pointers could be defined that had their addressable range defined as offsets relative to one of these segment registers. That is extremely close to teaching a 8051 C compiler to define pointers that are relative to one of several index register. In the end, a compiler vendor can do a lot with extended attributes for pointers. Just as Keil have already added attributes for the different memories in the 8051, that concept can be extended further. All it takes is that Keil see an interest in it and that they can make money by extending the language further.

But the 8051 isn't the only processor in this world with special features that a HLL compiler needs to take into account. It's just that the 8051 represents a quite small market for a compiler vendor. There are a huge number of 8051 chips in use, but a very large part of the chips are used in quite few products developed by even fewer developers. And it is an even fewer number of developers who needs (and are interested in paying for) compiler extensions for MAC, multiple index, ... For the ARM, the quality of the compiler is an important factor if ARM wants to sell their core to other companies. For the x86, the amount of money to spend on development tools are almost infinite.

Richard Erlacher said:
Per Westermark said:
What a HLL can do is very much a factor of the ingenuity of the developers of the compiler, and the number of users paying for the compiler maintenance.

Well, I doubt that using HLL produces much sensible code, though it might run after a bit of work, from the average 'C' programmer who could pull down a fancy salary working on PC's. These aren't PC's however. They're microcontrollers.


First off: You are basically saying that C developers are quite stupid. Such a claim only falls back on yourself. Don't assume that people who do other things or uses other tools than you are not clever and professional and openminded... Maybe you do see failed projects and have to make them work. But in that case you have to remember that you will not see the working projects.

But this isn't a question of PC or microcontroller. The question is: Have you spent time looking at the generated code for the biggest/best compilers on the market? They just happen to not include any 8051 compiler, since there isn't market enough to invest millions of dollars in a 8051 compiler. But have you looked at the code generated by the ARM compiler? I definitely think that it produces sensible code.

I have spent time looking at ARM output for time critical sections. I have also written my own assembler code. I have been able to win on instruction counts on several occations. But I may not have won on cycle count, because the compiler can rearrange the instructions in ways that is hard to do for me without losing track of the contents in the registers - unless I document the source in ways that the next developer will shoot me.

Right now, you are programming a 8051 chip. It is one of the simplest processors in the world to program by hand in assembler. It is one of the least suitable processors for a HLL language. If you look at many of the newer architectures - where the transistor count wasn't important in the design - you will note the reverse. They are designed to be easy to implement compilers for but can be extremely hard to program for a human being who can't keep 20 or 50 or 500 facts in the head at the same time. I'm ok with moving a few individual assembler instructions two or three steps up or down in the code, to optimize access patterns but that is my limit. I can't keep track of 20 or 50 instructions that are moved +/- 20 steps up or down or more.

I think you are condemning compilers based on experience with small compilers maintained by maybe 1 or 2 developers, totally missing the advances there have been in code quality for the best compilers. You are always free to have any opinion you like, but be careful in underestimating things.

The world where you can count individual clock cycles in your loop is quickly shrinking because of the additions of caches, out-of-order execution, extra shadow registers, ...

List of 76 messages in thread
TopicAuthorDate
NXP P89LPC936 Auxilary RAM            01/01/70 00:00      
   Compiler Cannot Save the Day At Runtime            01/01/70 00:00      
      I found it.....            01/01/70 00:00      
         Incorrect!            01/01/70 00:00      
            To be fair,...            01/01/70 00:00      
               Its good info to know...            01/01/70 00:00      
   how is it done in C?            01/01/70 00:00      
   Maybe you should try doing it ASM!            01/01/70 00:00      
      You should start a new thread on that!            01/01/70 00:00      
      Not in this case!            01/01/70 00:00      
         A compiler should support ALL MCU features ...            01/01/70 00:00      
            A compiler should translate the language            01/01/70 00:00      
               Still C - just not strict.            01/01/70 00:00      
            I didn't say that!            01/01/70 00:00      
               It is not that clean and clear            01/01/70 00:00      
                  Deviants are deviant            01/01/70 00:00      
                     Keil and SDCC need no macros ...            01/01/70 00:00      
                        Are you sure?            01/01/70 00:00      
                     That's probably correct, but ...            01/01/70 00:00      
                        A C compiler can map the hardware quite well            01/01/70 00:00      
                           compiler vendors are looking at the new processors            01/01/70 00:00      
                              I once mentioned that ...            01/01/70 00:00      
                           It's not what I'd choose, but it is a matter of perefernce            01/01/70 00:00      
                              As flash gets bigger, the code steps do too.            01/01/70 00:00      
                              Still not needed for other architectures            01/01/70 00:00      
                                 We will have to agree to disagree ... I guess            01/01/70 00:00      
                                    Which single-clocker is cheaper than an ARM?            01/01/70 00:00      
                                       RE: Which single-clocker is cheaper than an ARM?            01/01/70 00:00      
                                       differs considerably from the classic microcontroller?            01/01/70 00:00      
                                       Horses for courses            01/01/70 00:00      
                                          Always start each project by scanning the market            01/01/70 00:00      
                                             On that we can agree            01/01/70 00:00      
                                          Maybe, but what are they comparing?            01/01/70 00:00      
                                             Did you actually look?            01/01/70 00:00      
                                                Yes, I did.            01/01/70 00:00      
                                       it's a tradeoff            01/01/70 00:00      
                                          Is it 2006 already?            01/01/70 00:00      
                                             Really?            01/01/70 00:00      
                                                that's outright silly            01/01/70 00:00      
                                                   Maybe ... which is why it is not yet the case            01/01/70 00:00      
                                                      the eyes of the beholder            01/01/70 00:00      
                                                         Look at it from another viewpoint for a moment            01/01/70 00:00      
                                          RE: I'm not the one to ask about IC prices            01/01/70 00:00      
                                             doesn't mean I'm totally in the dark            01/01/70 00:00      
                                                Richard Erlacher has left the planet            01/01/70 00:00      
                                                   Maybe Andy's the one who's lost            01/01/70 00:00      
                                                      I cannot believe you even looked at ARM            01/01/70 00:00      
                                                         It's all relative            01/01/70 00:00      
                                                            Price doesn't directly follow processor size            01/01/70 00:00      
                                                            What about performance?            01/01/70 00:00      
                                                         Be specific please.            01/01/70 00:00      
                                                            You can use your own supplier            01/01/70 00:00      
                                                               Your test simulates as 41.04us            01/01/70 00:00      
                                                                  RE: ARM compiles do not like byte-addressing            01/01/70 00:00      
                                                                     A typo on my part            01/01/70 00:00      
                                                                        Case of full unroll            01/01/70 00:00      
                                                                           ... and what does THAT ARM MCU cost?            01/01/70 00:00      
                                                                              WHO CARES            01/01/70 00:00      
                                                                                 Absolutely true!            01/01/70 00:00      
                                                                              $5 or lower            01/01/70 00:00      
                                                                                 My Simulation times were wrong.            01/01/70 00:00      
                                                                                    67% of your loop was your loop            01/01/70 00:00      
                                                                                    re-written the loop in C            01/01/70 00:00      
                                                                                       Try without loop counter            01/01/70 00:00      
                                                                                          You're right!            01/01/70 00:00      
                                                                                             Similar trick with ARM7 would require 66.67MHz            01/01/70 00:00      
                                                                                             60ns with no store instruction.            01/01/70 00:00      
                                                                                                25% speedup            01/01/70 00:00      
                                                                                                   Actually, I found the for loop faster.            01/01/70 00:00      
                                                                                                      Compiler setting?            01/01/70 00:00      
                                                                                                         I made NO optimisation            01/01/70 00:00      
                                                                                                            Avoid variable aliasing if you like high optimization levels            01/01/70 00:00      
                                                                                                               The RealView compiler is very competent            01/01/70 00:00      
                                                                                                                  Yes, caching            01/01/70 00:00      
                                                                                                                  Yes, caching            01/01/70 00:00      
                                                                                                It's much easier with the 8-bit single-clocker            01/01/70 00:00      

Back to Subject List