Skip to main content
Engineering LibreTexts

5.6: Problems

  • Page ID
    83030
  • \( \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}}\)

    1. On the MSCPU diagram, show the datapath for each of the following instructions:

    1a. LSL r1, r2, #3
    1b. ADD r1, r2, r3, LSL r4
    1c. SUB r4, r8, r5, ASL #2

    2. Justify the following 3-address register conventions. For example, why is the Add operation ADD Rd, Rn, Rm, but the multiply operation MUL Rd, Rm, Rs? (Hint: use the datapath diagrams)

    LSL Rd, Rm, Rs
    MLA Rd, Rm, Rs, Rn
    

    3. What is the Immediate Operand2 value for the following decimal numbers? Give the 8 bit value and rotate amount.

    a. 198

    b. 260

    c. 9216

    d. 2162688

    e. -75

    f. -260

    1. What is the decimal value for the following Immediate Operand2 values?
    a. MOV  #0b1, 22
    b. MOV  #0b1001, 28
    c. MOV  #0b10010001, 30 d. MOV #0b1001, 16
    e. MVN  #0b100010
    f. MVN, #0b1001, 20

    5. Which of the following decimal immediate values are valid as an operand2 value?

    a. 24

    b. 15

    c. 34

    d. 27

    e. 8

    6. For the following MOV instructions, convert them to a single immediate value or an immediate with a ROR.

    7. What is the largest positive even number that can be represented as an ARM immediate? What is the largest positive odd number that can be specified as an ARM immediate?

    What you will learn (Chapter 6)

    In this chapter you will learn:

    1. the purpose of machine code
    2. how to decode a machine code instruction into it parts
    3. how to create machine code for use by the CPU
    4. the different machine code formats used by the ARM CPU
    5. translation of assembly code to machine code
    6. translation of machine to assembly code

    5.6: Problems is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?