chipKIT® Development Platform

Inspired by Arduino™

Is PIC slower than AVR at same clock freq?

Created Wed, 10 Apr 2013 02:13:55 +0000 by light


light

Wed, 10 Apr 2013 02:13:55 +0000

Some fans of AVR told me that at the same clock frequency, PIC is slower. Is this true for 8-bit MCUs? Does this apply when we compare Atmega328 with its PIC equivalent?

I like PIC because it offers value for money in terms of number of hardware peripherals, flash size and SRAM size than AVR at around the same price.


majenko

Wed, 10 Apr 2013 08:36:21 +0000

Low end PICs (8-bit) run at 1 instruction every 4 clock cycles. AVR runs at 1 instruction every clock cycle (or thereabouts - some instructions take 2 cycles).

So at 16MHz on an AVR you get about 16 MIPS. On a PIC you get 4 MIPS. Having said that, though, PIC tends to have the ability to run at much higher clock speeds - up to 64MHz in some cases.

So from a purely clocking POV yes, the AVR is faster at the same frequency.

The AVR has more internal registers, too, compared with the 8-bit PIC's single W register, which makes code somewhat more efficient.

What AVR doesn't have is the choice. They have a handful of devices, so you are often stuck with a device that does more than you want it to, and at a price considerably higher than the equivalent PIC.

With PIC the choice of devices you have is so great you can bet there will be one that pretty much precisely fits your needs, saving you both money and power.

But that's just the 8 bit offerings. When it comes to the 32 bit offerings there is more complexity. It's purely down to the efficiency of the core.

AVR uses an ARM core, while PIC32 uses a MIPS core. According to Wikipedia, the ARM core Cortex-M3 (closes to the one the AVR uses in the list) is 1.25 MIPS/MHz - that's for every 1MHz of clock speed it can process on average 1.25 million instructions. The MIPS32 core, however, is 1.5MIPS/MHz, so it can process an extra 250,000 instructions for every million clock cycles - a 20% increase in performance.

So for the 32-bit architectures, for the same clock speed, the PIC32 is faster than the AVR.

And the same goes for the choice comments above - PIC has about 100× more selection.


WestfW

Thu, 11 Apr 2013 05:42:58 +0000

AVR uses an ARM core

No. Arduino Due uses an ARM-cored Atmel chip, but "AVR" is a CPU that is NOT ARM-based. "AVR" is a proprietary Atmel 8-bit CPU, and AVR32 is a proprietary Atmel 32-bit CPU. (And Atmel also makes ARM9, ARM CM3, and ARM CM4 chips. Just to keep you confused.)


majenko

Thu, 11 Apr 2013 08:43:11 +0000

That's what I meant :P