We live in a world where convenience is king. Millions of electronic devices work in tandem to simplify our lives. The brain in these devices is the microcontroller. Today, we’re going to talk about the ARM microcontroller, which is the heart and soul of consumer electronic devices like smartphones, tablets, multimedia players, and wearable devices.
To start off, there are two main processor architecture designs, namely RISC (reduced instruction set computers) and CISC (complex instruction set computers). ARM is the poster child for RISC, in fact, it is included in its name Advanced RISC Machine.
Its highly optimized and power-efficient architecture makes it indispensable in today’s world. Let’s look at its design in more detail.
A Powerful Brain for Embedded Systems
A mobile or tablet is a shining example of an extremely portable computing device.
It’s a great way to keep your life organized, communicate with practically anyone, consume media content, and enjoy unlimited games and entertainment. These capabilities just keep improving over time.
But there is a silent struggle between applications and the hardware they run on. We all have experienced that annoying lag on our smartphones and not to mention the battery giving up on us when we need it the most. Luckily, ARM is packed with features to help us manage this.
Let’s Talk Simplicity
An ‘assembly instruction set’ is the language understood by the ARM controller. Its design plays a crucial role in enabling us to perform a task in an efficient and optimized manner. ARM has a reduced instruction set (RISC). This does not denote there are fewer instructions available for use. It means a single instruction does less work, i.e., a small atomic task.
As an example, let’s consider adding two numbers that would involve separate instructions for loading, adding, and storing the result using RISC design. Comparatively, a CISC design would have handled all of this in a single instruction. A simple instruction set does not require complex hardware design. This enables an ARM controller design to use fewer transistors and take up less silicon area. This reduces the power consumption, which is critical for battery-operated devices, along with corresponding savings in cost. But RISC controllers need a greater number of instructions to execute a task as compared to CISC. The compiler design for generating machine code from higher-level languages such as C is more complex in this case.
Hence one needs to write optimized code to extract the best performance from ARM.
Dealing with the Energy Vampire
An hour of intense gaming drains your battery and leaves you scrambling for a wall charger or power bank. This is because a lot of computations are done in specially designed hardware units in ARM, which need extra power. These units barely consume any power when your device is idle. This means there is a direct relation between the intensity of computations and energy consumption.
Every microcontroller needs a clock pulse, which is comparable to the heartbeat of the controller. It governs the speed at which instructions are executed and helps the controller keep time while performing tasks or governing the rate at which peripherals are run. The commencement and duration of any action that a processor may perform can be expressed in terms of clock cycles. A lower clock rate reduces the power consumption, which is critical for embedded devices but unfortunately also leads to a drop in performance. An instruction pipeline helps to boost performance and throughput while enabling a lower clock rate to be used. This can be compared to the functioning of a turbocharger in a car engine, where the real saving is in the benefits of using a smaller capacity engine but boosting it to match one that is larger and more powerful.
With careful programming, we can increase the instruction throughput to do a lot more in a single clock cycle. Such judicious use of the system clock preserves battery life, reducing the need to charge the battery frequently.
Busy as a Bee
Another critical feature that speeds up execution is the instruction pipeline. It introduces parallelism in the execution of instructions. All instructions go through the fetch, decode, and execute stages which involve loading the instruction from program memory, understanding what task it performs, and finally, its execution. We have an instruction in each stage of the pipeline at any point in time. This increases throughput and speeds up code execution. Imagine you are at work, and each time you complete a task, your manager has a new one kept ready so that you are never idle. Yes, that would be the perfect analogy for the instruction pipeline. It reduces the wastage of clock cycles by ensuring there are always instructions fetched and available for execution.
A Math Specialist
A core part of computing involves transforming data and making decisions. Speed and accuracy are paramount in such situations. ARM has you covered with hardware units for arithmetic and logical instructions, enhanced DSP, and NEON technology for parallel processing of data. In short, all the bells and whistles needed to handle everything from music playback to powering drone platforms.
The NEON coprocessor is capable of executing multiple math operations simultaneously.
It reduces the computational load on the main ARM controller. The design of these math units allows us to balance the tradeoff between computational speed and accuracy. As per the application requirement, we may choose to perform 4x16 bit multiply operations in parallel via NEON over 4x32 bit multiply operations sequentially in the ARM ALU (arithmetic and logical unit). The precision of the final result is reduced due to the usage of 16 bit operands in NEON, but the change in computational speed is significant. The ability to provide such multimedia acceleration is what makes ARM the main choice for portable audio, video, and gaming applications.
We see that the system designers have attempted to balance performance, power consumption, and cost to produce a powerful embedded computing machine. As portability and efficiency demands increase, we can see ARM’s influence continue to expand.
An application, if designed appropriately to leverage all of ARM’s features, can provide stunning performance without draining the battery.
It takes a special level of skill to tune an application in “assembly language,” but the final result exceeds expectations. The next time you see a tiny wearable device delivering unbelievable performance, you know who the hidden star of the show is.