Question

Input The input variables will be named: - Op1 - first operand - Op2 - second...

Input

The input variables will be named:


- Op1 - first operand
- Op2 - second operand
- shiftNum - shift amount

Output

The output will be in registers only. The registers to contain the results are:


R3 - And of operands
R4 - Or of operands
R5 - Exclusive Or of operands
R6 - Bit Clear of operands
R7 - Left Logical Shift of first operand by shift value
R8 - Right Logical Shift of first operand by shift value
R9 - Right Arithmetic Shift of first operand by shift value
R10 - Not operation on first operand

Use of any other registers for the results will not get credit for that part of the assignment.

Sample Input and Output

Your program will be tested using various values. Sample execution data:

Op1: 75
Op2: 42
shiftNum: 3

Sample results:

R3: 0x0A
R4: 0x6B
R5: 0x61
R6: 0x41
R7: 0x258
R8: 0x09
R9: 0x09
R10: 0xFFFFFFB4

Notes

You will need to understand ARM shifting before you can complete this assignment.

Homework Answers

Answer #1

Area pgm,code, readonly

entry

main

LDR R11,=OP1 ; load address of op1 in R11

LDR R1,[R11] ;value of op1 is loaded in R1

LDR R11,=OP2

LDR R2,[R11] ;value of op2 is loaded in R2

LDR R11,=SHIFTNUM

LDR R0,[R11] ; value of shifnum loaded in R0

AND R3,R1,R2 ; R3=R1 AND R2

ORR R4,R1,R2 ;R4=R1 OR R2

EOR R5,R1,R2 ;R5=R1 XOR R2

BIC R6,R1,R2 ; R6=R1 BIC R2 =R1 AND(~R2)

MOV R7,R1 LSL R0 ; R7=R1 << R0 i.e. R1 will be shifted left R0 times

MOV R8,R1 LSR R0 ; R8=R1 >> R0, i.e. R1 will be shifted right R0 times

MOV R9,R1 ASR R0 ; R1 will be shifted right R0 times including sign bit (arithmetic shift)

EOR R10,R1,0XFFFFFFFF ; R10=~(R1), when a bit is xored with 1, it will be toggled, 1⊕ 1=0, 0 ⊕ 1=1

; here declare the var1,var2 and shiftnum with values required

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Input The input variables will be named: - Op1 - first operand - Op2 - second...
Input The input variables will be named: - Op1 - first operand - Op2 - second operand - shiftNum - shift amount Output The output will be in registers only. The registers to contain the results are: R3 - And of operands R4 - Or of operands R5 - Exclusive Or of operands R6 - Bit Clear of operands R7 - Left Logical Shift of first operand by shift value R8 - Right Logical Shift of first operand by shift...
Consider a program having following sequence of instructions, where the syntax consists of an opcode followed...
Consider a program having following sequence of instructions, where the syntax consists of an opcode followed by the destination register followed by one or two source registers: Instruction no Instructions 1 ADD R3, R1, R2 2 LOAD R6, [R3] 3 AND R7, R5, 3 4 ADD R1, R6, R0 5 SUB R2, R1, R6 6 AND R3, R7, 15 7 SUB R5, R3, R4 8 ADD R0, R1, R10 9 LOAD R6, [R5] 10 SRL R7, R0, 8 Assume the...
III. After execution of the following instructions what value will be in register r0? LDR                ...
III. After execution of the following instructions what value will be in register r0? LDR                 r12, =0xA4000000 LDR                 r0, =0x75 LDR                 r1, =0xD2 LDR                 r2, =0x9C LDR                 r5, =0xC STMDB           r12!, {r0-r2, r5} LDR                 r0, [r12, #8] SUB                 r0, #0x77 IV. Assume that the variables f, g, h, i, and j are assigned to registers r0, r1, r2, r3, and r4, respectively. Assume that the base address of the arrays A and...
convert to python 3 from python 2 from Tkinter import * # the blueprint for a...
convert to python 3 from python 2 from Tkinter import * # the blueprint for a room class Room(object): # the constructor def __init__(self,name,image): # rooms have a name, exits (e.g., south), exit locations (e.g., to the south is room n), # items (e.g., table), item descriptions (for each item), and grabbables (things that can # be taken and put into the inventory) self.name = name self.image = image self.exits = {} self.items = {} self.grabbables = [] # getters...
Consider the following code segment, where the branch is taken 30% of the time and not-taken...
Consider the following code segment, where the branch is taken 30% of the time and not-taken 70% of the time. R1 = R2 + R3 R4 = R5 + R6 R7 = R8 + R9 if R10 = 0, branch to linex R11 = R12 + R13 R14 = R11 + R15 R16 = R14 + R17 ... linex: R18 = R19 + R20 R21 = R18 + R22 R23 = R18 + R21 ... Consider a 10-stage in-order processor,...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...