Question

In: Computer Science

how multiplication of two numbers (50 & 25) stored in RAM is carried out on the...

how multiplication of two numbers (50 & 25) stored in RAM is carried out on the Cortex-M4 processor using the MUL instruction.

Solutions

Expert Solution

ARM has 37 registers all of which are 32-bits long.

1 dedicated program counter

1 dedicated current program status register

5 dedicated saved program status registers

30 general purpose registers

The current processor mode governs which of several banks is accessible. Each mode can access

a particular set of r0-r12 registers a particular r13 (the stack pointer, sp) and r14 (the link register, lr)

the program counter, r15 (pc)

the current program status register, cpsr Privileged modes (except System) can also access

a particular spsr (saved program status register)

Program to multiply two 16 bit numbers

AREA MULTIPLY , CODE, READONLY

ENTRY

START

MOV r1, #50 ;32(hex)

MOV r2, #25 ;19(hex)

MUL r3,r1,r2 ;1250 0x000004E2

stop B stop  

END

Area is Assembler directive ,and we gave a name Multiply which is user specified (you can give any name),similarly directive code is Readonly and Entry is the starting point of the program.Start is the label.The first instruction is MOV in which we directly giving the value 50 so it is preceded by # symbol.The number in the assembler is stored in hexadecimal notation so we specify 32 equivalent of 50 in decimal.Mul is a instruction which multiplies 50 and 25 and store the result in r3. B is a instruction which means branch to a line labelled with the word stop that means it has to branch back to the same line that is it goes in an infinite loop ,this way is a convenient way to end the program.

In order to execute the program on klein microvision 4 you need to make a project with a name mul and then you have to select lpc 2148 in the cpu of target 1 and then click ok. When the dialogue page pop up select no as we are doing Assembly programming. After this click on file select new .it opens text file here you need to type your program.Intend the first line by pressing a tab as area and end should not come in first column as it is stored for labels.Save the file give the name.s extension.Then go to project-- manage --component environment components--

select all source files and then click on add and then ok..To compile theprogram click on build option. And then debug the program and then run it.


Related Solutions

1. In a bomb calorimeter, reactions are carried out a. at 1 atm pressure and 25
1. In a bomb calorimeter, reactions are carried out a. at 1 atm pressure and 25
Predict the outcomes of the two sets of experiments to be carried out with the 11...
Predict the outcomes of the two sets of experiments to be carried out with the 11 halides used in this chapter. Group 1: 1-bromobutane, 2-bromobutane, 2-bromo-2-methylpropane, and bromobenzene Group 2: 1-chlorobutane, 2-chloro-2-methylpropane, 1-chloro-2-butene Will be experimented with sodium iodide in acetone and ethanolic silver nitrate solution.
Explain how each process of Central Dogma is carried out?
Explain how each process of Central Dogma is carried out?
.....7 1) Independent tests are carried out to determine how far a two-man boat will travel...
.....7 1) Independent tests are carried out to determine how far a two-man boat will travel on 4 liters of gas. A sample of 5 boats are tested and the 5 distances have a mean of 45.1 km and a standard deviation of 4.32 km. Construct a 99% confidence interval for the mean distances traveled for all two-man boats. 2) A survey is done and 512 homes are surveyed. 309 of them say they like cats. a) Find p and...
Design a regular expression to filter out those numbers that are stored in the standard format  “+00-0-0000-0000”....
Design a regular expression to filter out those numbers that are stored in the standard format  “+00-0-0000-0000”. Examples of valid results are: +61-3-9214-4980 and +61-3-9285-7706
Tracking: - identified how evaluations are to be carried out to measure and track the project...
Tracking: - identified how evaluations are to be carried out to measure and track the project progress over time Present project/teaching at community organization Submit MAP-IT PowerPoint due by the last day of the course.
Tracking: - identified how evaluations are to be carried out to measure and track the project...
Tracking: - identified how evaluations are to be carried out to measure and track the project progress over time Present project/teaching at community organization Submit MAP-IT PowerPoint due by the last day of the course.
Briefly explain how levelling is carried out and the formation of the collimation error. How can...
Briefly explain how levelling is carried out and the formation of the collimation error. How can the collimation error be eliminated? Also, describe other possible sources of error in levelling, and explain what precautions can be taken to avoid these errors.
identified how evaluations are to be carried out to measure and track the project progress over...
identified how evaluations are to be carried out to measure and track the project progress over time Present project/teaching at community organization Submit MAP-IT PowerPoint due by the last day of the course.
How was child labor reforms carried out in the late 1800s and early 1900s?
How was child labor reforms carried out in the late 1800s and early 1900s?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT