[?] Atmega328P - ALU and multiplier question

Go To Last Post
58 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:

Why do I think of a stack machine when I read #50 ;)

Yes, and Forth also came to mind thereafter. ;)

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The flag instruction is a good idea, in fact they could make some kind of extended status register with new flags.

 

This reminds me of something that occurred to me a while ago: the new avr1 design should have placed the status register within range of cbi/sbi, since these instructions are now 1 cycle. This would make all flag clear/set instructions redundant and the opcodes could have been recycled.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

because of old code you can't recycle opcodes, but you add features as long it boot compatible

 

same why did they make a NOP instruction, something like mov r0,r0 would have been fine (as I remember there are 256 nop instructions or perhaps they are used now)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you really want a 16-bit ADD you could probably write a macro to do it and hide the underlying 8-bit operations.

Tis tru, though you could cut the number of instructions needed (flash usage) by half with a word instruction.  Not a big gain, but every 'bit' helps.

 

Too bad the instruction set space is used up...no more goodies for a while. 

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This remind me of a 4 bit controller (SAM47) I have used, there are something like 48 instructions that isn't used, and those can be programmed as combinations

of any (almost) two instructions, that could really compress the code size, (which also improve the reach of jumps etc. ) 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can always have a compatibility mode, controlled by a fuse or flag. But anyway, which instructions are really missing in AVR? I rarely feel the need for more instructions.

These are a few situations:

 

  • parity flag in the ALU
  • bit order reverse instruction
  • flag complement instruction, especially carry and zero flags
  • move other flags, especially the carry, to/from the T flag, to save their value for later
  • destination of mul to r16:r17 instead of r0:r1

 

 That's about it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

some kind of bank switching of XYZ for interrupts, either an other set like the Z80 or like the 8051 where they can be placed 4 different places, or perhaps just exchange with normal registers.

In general a exchange instructions is the one I miss the most. (16 bit for at least Z would be very nice)

CPSNE would be usefull (CPSE is hard to use) 

 

Pages