Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) A) For each of the following instructions, list the instruction format type: SUB: ANDI: B: LDUR: CBZ: STURB: (note: you will likely want to

image text in transcribed

1)

A) For each of the following instructions, list the instruction format type:

SUB:

ANDI:

B:

LDUR:

CBZ:

STURB:

(note: you will likely want to use the Green Sheet in your book to answer this)

B) Write the binary encoding for the following instructions. Indicate the different fields in the encoding by placing a space between them.

ADD X3,X2,X5:

ADDI X3, X2, #40:

SUB X3,X5, X3:

C) Translate the following high-level code into assembly language.

Assume variables a c are held in registers X0 - X2 and f j are in X19 - X23

a=b-c;

f=(g+h)-(i+j);

D) Write an assembly program to swap the contents of 2 variables stored in registers X4,and X5. If you need an extra register you may use X1.

Objective The main objective of this prelab is to familiarize you with several basic ARM LEGv8 instructions and their appropriate encoding formats (LEGv8 is the book's subset of the full ARMvB instruction set Prerequisites Before proceeding, ycu should lean basic ARM instructions such ADD, SUB, ADDI, LDUR, STUR and their appropriate formats (refer to Sections 2.5-2.7 of the text book Note: InstructionADDl and other rmediate ristruction of LEG 8 s implemented dif rent y in the AAR -64 c oss comp er that we use in lab eg ADDI 0 X1 #5 is re resented with A D X1 # Introduction Before commanding a computer's hardware, you must speak its language. The words of acomputer language are called instructions, and its vocabulary is called an instruction set.For example, the following ADD instruction tells a computer to add the two varlables b andc and store the result in a ADD X1, X2, X3 In this lab, we will explore several instructions in the ARM instruction sat and understandtheir encoding formats Instruction encoding Instructions inside the computer are represented as a series of ones and zeros (binary digits) For example the instruction ADD X1, X2, X3 is encoded as: 10001011000 00011 00ODDO 00010 0001 bits bits its bits 1bits 5 Each of these segments of an instruction is called a field. The first field from the left tells the ARM computer that this instruction perfcrms addition. The second field specifies the address (name), Rm, of the register which corresponds to the second source operand of the addition operation 3 = 3 The third field specifies the shift amount and is unused for th stance hus set to 0. and he fourth field specifies the address na e An of the register which oorresponds to the rst source operand of the addition operation (X2 = 2). The fifth field is used to hold the addressname. Rd. of the register to hold the result pi-1). is layo o the instruction s referred to as in truction format. n A M, the size o each instruction exactly of 32 b he ns no or immediate move IM The above e ample is an R-format instruction. For this lat, we wil o no trate on the register RI and immediate n A N can be categorized as r formats. ster , mme ate load br n a condit al rar Note: A word is defined as the unit of access in a computer. In LEGvB, all instruction accesses are 32-bits, while data accesses default to 64-bits (though smaller sized accesses are possible). A 32-bit value is called a word in ARM, while a 64-bit value is called a double-word. For the following questionis, feel free to use the ARM refarence card that can be found in your bock

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago