0% found this document useful (0 votes)
134 views2 pages

Cortex M4: Set de Instrucciones Básico

This document provides a summary of basic instruction sets for the Cortex M4 processor. It includes instructions for memory access, arithmetic and logical operations, special instructions, and control flow. Memory access instructions allow loading and storing data from registers and memory. Arithmetic instructions include addition, subtraction, multiplication, and division. Logical instructions perform AND, OR, XOR operations. Special instructions control processor state and interrupts. Control flow instructions enable branching conditionally or unconditionally.

Uploaded by

Quique Morales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views2 pages

Cortex M4: Set de Instrucciones Básico

This document provides a summary of basic instruction sets for the Cortex M4 processor. It includes instructions for memory access, arithmetic and logical operations, special instructions, and control flow. Memory access instructions allow loading and storing data from registers and memory. Arithmetic instructions include addition, subtraction, multiplication, and division. Logical instructions perform AND, OR, XOR operations. Special instructions control processor state and interrupts. Control flow instructions enable branching conditionally or unconditionally.

Uploaded by

Quique Morales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CORTEX M4

SET DE INSTRUCCIONES BÁSICO


ACCESO DE MEMORIA
Mnemonic Operands Description Flags
LDR {H,SH,B,SB} Rd, [Rn] Load Register with data Rd = [Rn] -
LDR {H,SH,B,SB} Rd, [Rn,#offset] Load Register with data Rd = [Rn+off] -
Rd = [Rn]
LDR {H,SH,B,SB} Rd, [Rn],#offset Load Register with data and increment Rn = Rn + off -
Rn = Rn + off | ( Rd = [Rn + off] )
LDR {H,SH,B,SB} Rd, [Rn,#offset]! Load Register with data and increment Rd = [Rn] | ( Rn = Rn + off ) -
LDR {H,SH,B,SB} Rd, [Rn,<Op2>] Load Register with data Rd = [Rn+<Op2>] -
STR {H,B} Rt, [Rn] Store Register data [Rn] = Rt -
STR {H,B} Rt, [Rn,#offset] Store Register data [Rn+off] = Rt -
STR {H,B} Rt, [Rn,<Op2>] Store Register data [Rn+<Op2>] = Rt -
PUSH {Rt1,Rt2,….} reglist Push registers onto stack -
POP {Rt1,Rt2,….} reglist Pop registers from stack -
ADR Rd, label Set Rd equal to the address at label Rd = <label> (Rd no SP ni PC) -
MOV, MOVS Rd, <Op2> Set Rd equal to Op2 Rd = Operand2 N,Z,C
Rd[15:0] = imm16, Rd[31:16] = 0,
MOV {W,T} Rd, #imm16 Set Rd equal to imm16 imm16 range 0-65535
MVN, MVNS Rd, <Op2> Set Rd equal to -Op2 Rd = 0xFFFFFFFF EOR Operand2 N,Z,C

ARITMÉTICAS Y LÓGICAS
Mnemonic Operands Description Flags
ADD, ADDS {Rd,} Rn,<Op2> Add Rd = Rn + Operand2 N,Z,C,V
ADD, ADDS {Rd,} Rn,#imm12 Add Rd = Rn + imm12, imm12 range 0-4095
SUB, SUBS {Rd,} Rn,<Op2> Subtract Rd = Rn – Operand2 N,Z,C,V
SUB, SUBS {Rd,} Rn,#imm12 Subtract Rd = Rn - imm12, imm12 range 0-4095 N,Z,C,V
RSB, RSBS {Rd,} Rn,<Op2> Reverse Subtract Rd = Operand2 – Rn N,Z,C,V
RSB, RSBS {Rd,} Rn,#imm12 Reverse Subtract Rd = imm12 – Rn N,Z,C,V
CMP Rn, <Op2> Compare Update PSR flags on Rn – Operand2 N,Z,C,V
CMN Rn, <Op2> Compare Negative Update PSR flags on Rn + Operand2 N,Z,C,V
MUL, MULS {Rd,} Rn,Rm Multiply, 32-bit result Rd = Rn * Rm N,Z
MLA Rd, Rn,Rm, Ra Multiply with Accumulate, 32-bit result Rd = Ra + (Rn * Rm) N,Z
MLS Rd, Rn,Rm, Ra Multiply and Subtract, 32-bit result Rd = Ra – (Rn * Rm) -
UDIV {Rd,} Rn,Rm Unsigned Divide Rd = Rn / Rm -
SDIV {Rd,} Rn,Rm Signed Divide Rd = Rn / Rm -

AND, ANDS {Rd,} Rn,<Op2> Logical AND Rd = Rn & Operand2 N,Z,C


ORR, ORRS {Rd,} Rn,<Op2> Logical OR Rd = Rn | Operand2 N,Z,C
ORN, ORNS {Rd,} Rn,<Op2> Logical OR NOT Rd = Rn | (~ Operand2) N,Z,C
EOR, EORS {Rd,} Rn,<Op2> Exclusive OR Rd = Rn ^ Operand2 N,Z,C
BIC, BICS {Rd,} Rn,<Op2> Bit Clear Rd = Rn & (~ Operand2) N,Z,C
Rd = Rm << Rs
LSL, LSLS Rd, Rm,Rs Logical Shift Left (unsigned) (Same as MOV{S} Rd, Rm, LSL Rs) N,Z,C
Rd = Rm << n
LSL, LSLS Rd, Rm,#n Logical Shift Left (unsigned) (Same as MOV{S} Rd, Rm, LSL n) N,Z,C
Rd = Rm >> Rs
LSR, LSRS Rd, Rm,Rs Logical Shift Right (unsigned) (Same as MOV{S} Rd, Rm, LSR Rs) N,Z,C
Rd = Rm >> n
LSR, LSRS Rd, Rm,#n Logical Shift Right (unsigned) (Same as MOV{S} Rd, Rm, LSR n) N,Z,C
Rd = Rm >> Rs
ASR, ASRS Rd, Rm,Rs Arithmetic Shift Right (signed) (Same as MOV{S} Rd, Rm, ASR Rs) N,Z,C
Rd = Rm >> n
ASR, ASRS Rd, Rm,#n Arithmetic Shift Right (signed) (Same as MOV{S} Rd, Rm, ASR n) N,Z,C
Rd = Rm >> Rs
ROR, RORS Rd, Rm,Rs Rotate Right (Same as MOV{S} Rd, Rm, ROR Rs) N,Z,C
Rd = Rm >> #n
ROR, RORS Rd, Rm,#n Rotate Right (Same as MOV{S} Rd, Rm, ROR n) N,Z,C
Rd = RRX(Rm)
RRX, RRXS Rd, Rm Rotate Right with Extend (only 1 bit) (Same as MOV{S} Rd, Rm, RRX) N,Z,C

ZAS2018-1
INSTRUCCIONES ESPECIALES
Mnemonic Operands Description Flags
CPSID i Change Processor State, Disable Interrupts -
CPSIE i Change Processor State, Enable Interrupts -

CONTROL DE FLUJO
Mnemonic Operands Description Flags

B label Branch to label PC = label. label is this instruction ±32MB -


BX Rm Branch indirect to location specified by Rm PC = Rm -
LR = address of next instruction, PC = label.
BL label Branch to subroutine at label label is this instruction ±32MB. -
LR = address of next instruction,
BLX label o Rm Branch to subroutine indirect specified by Rm o label PC = Rm[31:1]. O PC = label -

Mnemonic Operands Meaning Condition Flags


BEQ label o Rm Equal Z=1
BNE label o Rm Not equal Z=0
BCS label o Rm Higher or same, unsigned C=1
BHS label o Rm Higher or same, unsigned C=1
BCC label o Rm Lower, unsigned C=0
BLO label o Rm Lower, unsigned C=0
BMI label o Rm Negative N=1
BPL label o Rm Positive or zero N=0
BVS label o Rm Overflow V=1
BVC label o Rm No overflow V=0
BHI label o Rm Higher, unsigned C = 1 and Z = 0
BLS label o Rm Lower or same, unsigned C = 0 or Z = 1
BGE label o Rm Greater than or equal, signed N=V
BLT label o Rm Less than, signed N != V
BGT label o Rm Greater than, signed Z = 0 and N = V
BLE label o Rm Less than or equal, signed Z = 1 and N != V

{} Encierra operandos opcionales


Rd Especifica el registro de destino . Si se omite Rd, el registro de destino es Rn
Rn Especifica el registro que contiene el primer operando
Rm Especifica el registro que contiene el segundo operando
Rt Especifica cualquier registro
#n Puede ser cualquier valor de 0 a 31, o de 1 a 32
#offset Cualquier valor de -255 a 4095
label Cualquier dirección dentro de la memoria ROM
#imm12 Cualquier valor de 0 a 4095
#imm16 Cualquier valor de 0 a 65535
H Dato de 16 bits sin signo
SH Dato de 16 bits con signo
B Dato de 8 bits sin signo
SB Dato de 8 bits con signo
W Parte baja [15:0]
T parte alta [31:16]

< Op2 > Es un segundo operando flexibles


#imm8
Rm
Rm, LSL Rs
Rm, LSL #n 1<=n<=31
Rm, LSR Rs
Rm, LSR #n 1<=n<=32
Rm, ASR Rs
Rm, ASR #n 1<=n<=32
Rm, ROR Rs
Rm, ROR #n 1<=n<=31

ZAS2018-1

You might also like