;
since in ARM immediate operand can only be a 32
bit number such that it can be
;
formed by shifting an 8 bit number
;
hence the number should be in the form:
;
from 0x00000000 to 0x000000FF
; or
from 0x00000100 to 0x0000FF00 etc.
;
means only 1 byte or 8 bits of the immediate operand can be non
zero
;
hence to move 0xE3A01CFA we need to first move the first right most
byte into register
;
and then add another bytes into register
MOV
R1,
#0x000000FA ;
move first right most byte into register r1
ADD
R1, R1, #0x00001C00 ; adding second
right most byte
ADD
R1, R1, #0x00A00000 ; adding third
right most byte
ADD
R1, R1, #0xE3000000 ; adding fourth
right most byte
;
Now register r1 contains 0xE3A01CFA
MOV
R2,
#0x00000000 ;
setting r2 to 0
MOV
R3,
#0x00000000 ;
setting r3 to 0
MOV
R4,
#0x00000000 ;
setting r4 to 0
;
isolating right most byte of r1 into register r2 by doing and
operation
AND
R2, R1, #0x000000FF
;
isolating bits 8-11 into register r3
AND
R3, R1, #0x00000F00
;
rotate to bring the number to the right most
LSR
R3, R3, #8
;
multiplying r3 with 2 by just rotating r3 1 bit left
LSL
R3, R3, #1
;
rotating r2 right as many bits as the value in r3 is. and storing
the result into
;
register r4
ROR
R4, R2, R3
At right in the image, you can see the value of registers.
the code 0xE3A01CFA
is a code for a mov instruction into a register with value #FA00. So at the end in our program, the register r4 contains the value #FA00.
The tool that i have used to visualize is "Visual" arm emulator.
Note: All assembly code should be well commented-similar level of detail to samples. 7. Write ARM...
Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...
Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...
2. a)Write the ARM ALP conditional code snippet for the following statements written in C-language. Assume R1 to Rn as06 variables Let R1, R2, R3 contain the starting addresses of arrays X, Y and Z respectively Use Register R4 for variable i. Display appropriate messages. While (i+10) else Z[i] XiYi; b)i Write a program to display a message "This is an examination Question" on the screen using 06 a function sub program Note the following Address of the string to...
1.) a.) Using the simplified instruction set shown for part b, write code for the following. Suppose memory locations 1400 to 1449 contain 16-bit words. Each word represents 2 ASCII characters. Write code to read in and write out these 100 characters. Left-side character from location 1400 should be first, right-side character from location 1400 should be second, and remaining characters follow in numeric order. Assume you have access to 4 registers: R1, R2, R3, R4. Each register holds one...
You are given a homework processor (HPro) capable of addressing 32 8-bit (1 byte) wide registers. However, it has only 29 physical registers. Register RO, R1 and R31 are not physically implemented. Instead, every read from RO, R1 and R31 will return a constant zero (00000000), constant one (00000001) and all ones (11111111), respectively. Every write to RO, R1 and R31 will go to null (dummy write). Assume that all other registers have initially unknown (X) state (This in fact...
third photo is problem 8 pt 2. anything would help please Problem 7 (15pts) Convert this following pseudo-code in high level language into a piece of an assembly code (NIOS 2). In the following pseudo-code in high level language, r4, r5, r6, and r10 represent registers 4,5, 6, and 10, respectively Consider this pseudo-code in high level language: If ! (r4 >r5 or rs <r6) r10=r10+1 else r10- r10-1 This becomes the following piece in assembly code (put you answers...
5. Consider the SPIM code below. globl main .text main: ori $t1, $0, 10 ori $t2, $0, 11 add $t3, $t1,$t2 move $t4, $t3 The following image shows a screen shot of QtSPIM page when this program is loaded, and executed in step-by step fashion. Current instruction is highlighted. Data Text x Text Regs Int Regs [16] Int Regs [16] PC = 400028 EPC 0 Cause = 0 BadAddr = 0 Status = 3000ff10 HI LO = 0 = 0...
Note: The question needs to be answered in "C Programming Languange ". And after the question find 3 pages for needed informations. Spring CE4717 Language Processors Q1. Consider the following LEx program. return R1 return R2 return R3 return R4 return R5; return R6; IA-2a-z)[A-Za-z0-9]- -2 10-91+ 10-9a-EA-FI Ihi] [01] [01] 이삐 t Vtin) int main (void) int tcode; do f tcode -yylex()i printf ("token type td \"%s\"\n", tcode, yytext); ) while (tcode)i return 0; i. Explain the steps needed...