Re: Moving from 8051 to AVR
- From: David Brown <david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: 12 Feb 2006 22:06:20 +0100
Ulf Samuelsson wrote:
Getting rid of global variables is good programming practicesI'm lost. How do the extra opcode features of the C51, like
but the 8051 will force you to use this costing extra time and
making the C code more unreadable.
direct memory access, and Boolean operators, make code LESS
readable ?
Direct memory access means that you are using up the decoding space that should be used for registers.
It is not "extra" opcode features, it is waste of decoding space.
That's not really a great argument - it would be simple enough to drop a single register (say, r0) and make that refer to "direct memory" with the address given in the next instruction word. That would also have simplified a number of instructions - for example, the "LDS Rd, k" instruction would now be implemented simply "MOV Rd, R0, k".
If you want to argue that this would make a larger core, or increase the critical path lengths of the decoder, or cause problems for the pipelining logic (a more common reason for RISC architectures' omission of direct memory access instructions), that's fine. But there would have been no problem doing a little re-arranging of the opcode space to fit the addressing mode in.
Lack of registers means that local variables cannot be optimized into registers..
This means you are forced to use global variables.
I.E: you are making the code harder to read and thus less maintainable.
If you have more SRAM than you need which is often the case in 0.18u processes
then the use boolean operators makes code less portable/readable.
Writing a boolean variable is more expensive than writing a byte variable
since you have to do a read-modify write - OR go to a much more expensive SRAM implementation.
- Follow-Ups:
- Re: Moving from 8051 to AVR
- From: Ulf Samuelsson
- Re: Moving from 8051 to AVR
- References:
- Moving from 8051 to AVR
- From: ziggy
- Re: Moving from 8051 to AVR
- From: Jim Granville
- Re: Moving from 8051 to AVR
- From: Ulf Samuelsson
- Re: Moving from 8051 to AVR
- From: diggerdo
- Re: Moving from 8051 to AVR
- From: Isaac Bosompem
- Re: Moving from 8051 to AVR
- From: diggerdo
- Re: Moving from 8051 to AVR
- From: Ian Bell
- Re: Moving from 8051 to AVR
- From: David Brown
- Re: Moving from 8051 to AVR
- From: Ian Bell
- Re: Moving from 8051 to AVR
- From: David Brown
- Re: Moving from 8051 to AVR
- From: Jim Granville
- Re: Moving from 8051 to AVR
- From: Ulf Samuelsson
- Re: Moving from 8051 to AVR
- From: Jim Granville
- Re: Moving from 8051 to AVR
- From: Ulf Samuelsson
- Moving from 8051 to AVR
- Prev by Date: Re: Moving from 8051 to AVR
- Next by Date: Re: Moving from 8051 to AVR
- Previous by thread: Re: Moving from 8051 to AVR
- Next by thread: Re: Moving from 8051 to AVR
- Index(es):
Relevant Pages
|