Learn about the microarchitecture of an ARM core, including an explanation of the register file and how it functions within a processor.

In this article, we'll define what a microarchitecture is. We'll also explain what an ARM register file is and where it resides within a processor's microarchitecture.

This article is intended to provide foundational information for the next article, in which we'll go over the basics of assembly and show some basic assembly instructions for a 32-bit ARM core written using a Raspberry Pi.

 

Supporting Information

 

What Is a Microarchitecture?

A microarchitecture (sometimes written as "micro-architecture") is the digital logic that allows an instruction set to be executed. It is the combined implementation of registers, memory, arithmetic logic units, multiplexers, and any other digital logic blocks. All of this, together, forms the processor.

A microarchitecture combined with an instruction set architecture (ISA) makes up the system's computer architecture as a whole. Different microarchitectures can implement the same ISA, but with trade-offs in things like power efficiency or execution speed. The most basic processor will include a register file, an ALU, system memory, and a control unit that allows the processor to make decisions based on the instruction it's executing.

 

The ARM Register File

To perform operations on data, there needs to be a place to temporarily store that data. This is what a processor's register file is for. The register file is a bank of registers that are used to store temporary values and perform actions on those values. Outside of the registers, data can be retrieved and stored in the computer's memory. While this is a slower operation, far more can be stored out in memory than in the relatively few registers available. The register file usually comes in the form of SRAM.

Let's use a 32-bit ARM core as an example. In this case, we will focus on 32-bit ARMV7 instructions and 32-bit registers. 

A 32-bit, or four-byte, quantity corresponds to a word in the ARM instruction set. The ARM register file contains sixteen registers used to execute instructions. A status register also exists to store information about the results of an operation and allow the processor to make decisions based on that result.

 

Register Denotations

A register is denoted with the letter R and a number.

  • R0–R3 are used to store temporary values or variables, but also play a role during subroutine calls.
  • R4–R12 are general purpose.
  • R13, or SP, is the stack pointer. The stack pointer contains a memory address where the program can store information that it will need to retrieve later.
  • R14 is the link register, used with branching instructions to return to a previous spot in the program.
  • R15, called PC for program counter, stores the address of the next instruction to be executed. This gives the PC a huge responsibility, as it controls what instruction executes on the processor. Put the wrong value in the PC and your program could suddenly stop running; this is usually referred to as a crash.

 

Register Flags

The current program status register (CPSR), mentioned earlier, contains a number of flags that can be set when an instruction executes.

These flags are the N, Z, C, and V flags:

  • N stands for negative and is used when the result of an instruction is negative.
  • Z, for zero, is set when the result is zero.
  • C stands for carry and is set when the instruction results in a carry out.
  • V stands for overflow and is set when an overflow occurs.

To check these flags, certain condition suffixes (discussed in a later article) are appended to the instructions when writing the assembly code.

 

Parts of the Processor: The Datapath and Control Unit

While we won't go into the details of designing an ARM processor (maybe in a future article), it might be nice to have a basic idea of where the register file fits into the system running our instructions. Figure 1 below is a highly simplified block diagram of a processor.

The register file contains the current state of the processor, and the ALU and memory interact with that state. The memory is split into sections. One contains a list of instructions, the assembly program, that is being executed; the other holds data that the program will use. All of these components, along with the lines highlighted in green, make up the datapath of the processor.

The datapath contains everything needed to execute all instructions within the ISA being implemented. But how does the datapath know which operation to perform?

 

Figure 1. Highly simplified processor

 

Above the datapath is the control unit. The control unit interprets opcodes (operation codes) and condition codes, found within each instruction, to open or close routes within the datapath. It is the control unit that enables the processor to execute different operations based on the instruction currently being read from memory. Together, the control unit and datapath make up the CPU, or central processing unit.

Adding memory that allows the CPU to interact with other components forms what we call a processor.

 


 

Now that we have a basic understanding of microarchitectures, in the next article, we'll go over basic assembly code instructions for programming a 32-bit ARM core.

Want to see a particular article on processor architectures? Let us know in the comments below.

 

Comments

1 Comment


  • andyolivares 2019-02-09

    It would be nice to know how more basic logic components like adders, registers, etc., form more complex structures like the ALU or Control Unit.

    Even though I studied a great deal of computer architectures on my university EE classes I never had the chance to actually design a simple processor.

    Maybe a series of articles on designing a basic 8 bit processor with Verilog? That would put many doubts to closure that I’ve had during years.

    That will also be a good practical exercise for other Verilog AAC articles smile