ARM conditional execution instructions

Publisher:九九归一74Latest update time:2016-04-19 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1.         Draw the flowchart of the following program. And use conditional execution instructions to simplify the program: 
 
 

       
    CMP  R0, #10
           BEQ  ROUTINE
           ADD  R1,R1,R0
           SUB  R1,R1,R2
ROUTINE    
           ...
 
2.         Use ARM assembly to implement statements in C language
(1)
If ((R0= =R1) && (R2= =R3))
R4++;
(2)
int gcd(int a, int b)
{
while(a!=b)
{
if(a>b)
a=ab;
else
b=ba;
}
return a;
(3) Calculate n using the idea of ​​conditional execution! (exp7.4.s)
               AREA factorial, CODE, READONLY
               ENTRY
START 
               MOV R2, #0xA
               MOV R1, R2
LOOP   
               ; Decrement R2 and update the status flag
                ; Multiply, note that the result register should be different from the source register
               ; Save the product and prepare for the next calculation
               BNE   LOOP
STOP
                 STOP
               END
 
 
1.         CMP R0, #10
ADDNE  R1, R1, R0
SUBNE  R1, R1, R2

Y
 
ARM conditional execution instructions

 
2.         CMP R0,R1
CMPEQ R2,R3
ADDEQ R4,R4,#1
 
 
3.           
Answer 1
GDC
        CMP R0,R1
       BEQ END
       BLT LESS
       SUB R0,R0,R1
       B GDC
LESS   
       SUB R1,R1,R0
       B GDC
END    . . .

Answer 2
GDC
        CMP R0,R1
       BEQ END
       SUBLT R1,R1,R0
SUBGE R0,R0,R1
       B GDC
END    。 。
 
4.           
Answer 1 SUBS R2,R2,#0x1 MULNE R0,R1,R2 MOVNE R1,R0 Answer 2 SUBS R2
,R2,# 0x1 MUL R0,R1,R2 MOV R1,R0 CMP R2,#1 BNE LOOP










Keywords:ARM Reference address:ARM conditional execution instructions

Previous article:ARM control transfer instructions
Next article:ARM subroutine design

Recommended ReadingLatest update time:2024-11-23 08:07

Learn peripherals one by one for ARM_first
LED lights are used in almost every board, not to mention their importance:   According to the schematic diagram provided by s5pc100, we can see The control register used is GPG3 Check the relevant chip manual: GPG0,1,2,3: 25 in/out pin –3xMMC channel (Channel 0 supports 4-bit and 8-bit mode, but channel 1,
[Microcontroller]
Linux Embedded ARM-Linux Basics
ARM Architecture 1. Please briefly describe the characteristics of ARM processors, and state at least 5 characteristics. (5 points) : low power consumption; low cost, high performance, RISC structure; fixed instruction length; support Thumb (16-bit)/ARM (32-bit) dual instruction sets; small size; 2. Please write the s
[Microcontroller]
How powerful is Arm Immortalis based on the new fifth-generation GPU architecture?
GPU now seems to have surpassed CPU, whether on the desktop, server or mobile phone, it can significantly improve the user experience in image processing or ML processing. Arm recently launched the Immortalis-G720, which uses the fifth-generation GPU architecture, which will bring new experiences to various devices. A
[Mobile phone portable]
How powerful is Arm Immortalis based on the new fifth-generation GPU architecture?
ARM stack study notes
The following is what I learned about the stack when studying ARM instructions: 1. Register R13 is often used as a stack pointer in ARM instructions 2. For the R13 register, it corresponds to 6 different physical registers, one of which is shared by user mode and system mode, and the other 5 physical registers corre
[Microcontroller]
Design of 3G video helmet based on ARM11 and DSP collaborative video stream processing technology
  1. Introduction   In order to improve the controllability of on-site operations in high-risk workplaces, this paper adopts bionic principles and high-integration design to realize a 3G video helmet with the same viewing angle as the human eye. This design consists of a video helmet and a waist-span data processing
[Microcontroller]
Design of 3G video helmet based on ARM11 and DSP collaborative video stream processing technology
Design of fingerprint recognition access control system based on ARM
  1 Overview   With the continuous advancement of science and technology, people have put forward higher-level security management requirements for modern office and living places. Ordinary door lock systems and manual access management no longer meet the actual needs of modern people. Due to the intelligence and netw
[Microcontroller]
The easiest way to install the GCC toolchain for ARM architecture in Ubuntu
1. Install the ARM-Linux-GCC toolchain   Just one command:   sudo apt-get install gcc-arm-linux-gnueabi   The premise is that your Ubuntu system version is the latest version supported by the official website. If not, please upgrade. Execute the above command. 2. Using the Toolchain   Note! You cannot use the gc
[Microcontroller]
AT91 Series ARM Hardware Design Notes
Power Issues 1.VDDCORE and VDDIO pin power supply A) The VDDCORE and VDDIO pin supplies must be connected to a clean DC power supply using decoupling capacitors; the decoupling capacitors should be as close as possible to the VDD and GND pins of the microcontroller; the typical value of the decoupling capa
[Industrial Control]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号