Skip to main content
Engineering LibreTexts

4: 3-address instruction set

  • Page ID
    76108
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    At its core the ARM instruction is a 3-address load and store CPU. Because the assembly language is built to support the underlying architecture, the ARM assembly instruction set is also based on 3-address load and store instructions. A 3-address CPU says that the instructions will have an operator and 3 operands (a destination register and two source values). The source values can be either two registers, or a register and a number. So, instructions in this chapter will be of the format:

        Operator r1, r2, r3
    

    or

        Operator r1, r2, #number
    

    Many programs can be implemented using only a 3-address instruction subset of the ARM instructions. This chapter will present the ARM instructions as 3-address instructions. Note that this will be done using completely valid ARM instructions, no fake or pseudo instructions will be covered. The instruction set will be developed by restricting the inputs to some operations.

    To actually understand the ARM CPU, a model closer to a real ARM CPU will be developed in Chapter 5, the MSCPU. This CPU will be modified to extend the instructions in this chapter. It will also clarify some questions that may arise from having simplified the architecture. For example, when documenting the instructions in this chapter the use of registers will appear arbitrary. When to use Rn verses Rs will appear to be arbitrary, and Rm will sometimes be the second register in the instruction, and other times the third register in the instruction. The order of the registers and immediate values will be inconsistent. The instructions in this chapter will work as documented, but the reasons for the differences will be explained in Chapter 6.


    This page titled 4: 3-address instruction set is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Charles W. Kann III via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?