-The EXG instruction exchanges the contents of a pair of registers. For example,
exg A, B
exg D,X
exg A,X ; A ¬ X[7:0], X ¬ $00:[A]
exg X,B ; X ¬ $00:[B], B ¬ X[7:0]
-The SEX instruction sign-extend an 8-bit two’s complement number into a 16-bit
number so that it can be used in 16-bit signed operations. For example,
SEX A,X
Move Instructions
Move Instructions
- These instructions move data bytes or words from a source to a destination
in memory.
- Six addressing modes are allowed . For example,
movb $100,$800
CBA compare A to B
CMPA compare A to a memory location or value
CMPB compare B to a memory location or value
CPD compare D to a memory location or value
CPS compare S to a memory location or value
CPX compare X to a memory location or value
CPY compare Y to a memory location or value
TST test a memory location for negative or zero
TSTA test A for negative or zero
TSTB test B for negative or zero
BITA logic AND A with memory
BITB logic AND B with memory
Branch Instructions
JMP– ext or indx Use bits in ccr-HNZVC
BCC BCS
All branch use relative BEQ BNE
(Lxxx for long rel) BGE BGT
BHS BHI
BRA-br always BLE BLT
LBRA-long branch BLS BLO
BRN-never (debug) BMI BPL
BRSET-BRCLR BVS BVC
TBEQ - TBNE IBEQ IBNE
Function Call Instructions
• JSR
• CALL
• RTI, RTC,RTS
• WAI
• Stack operations
• PSHA,PSHB,PSHC,PSHD,PSHX,PSHY
• PULA,PULB,PULC,PULD,PULX,PULY
• SWI
• NOP
Fuzzy Logic Instructions
4 fuzzy logic Other Useful Inst
ETBL TBL
MEM EDIV EDIVS
REV EMACS
REVW EMAX EMAXM
WAV EMIND EMINM
EMUL EMULS
Addressing Modes
1. Inherent
2. Immediate
3. Direct
4. Extended
5. Indexed
6. Relative
Programmer’s model &
Architecture of KL25Z
ARM Core
Freescale Chip
KL25Z128VLK4
• Core:
48 MHz ARM Cortex-M0+ core
• Peripherals:
All Freescale modules
ARM Cortex-M0+ Core up to 48 MHz
• Single-cycle access to I/O: Up to 50 percent faster
than standard I/O, improves reaction time to
external events allowing bit banging and software
protocol emulation
• Two-stage pipeline: Reduced number of cycles per
instruction (CPI), enabling faster branch instruction
and ISR entry, and reducing power consumption
• Excellent code density vs. 8-bit and 16-bit MCUs -
reduces flash size, system cost and power
consumption
• Optimized access to program memory: Accesses
on alternate cycles reduces power consumption
Continued ARM Core
• 100 percent compatible with ARM Cortex-M0 and a
subset ARM Cortex- M3/M4: Reuse existing
compilers and debug tools
• Simplified architecture: 56 instructions and 17
registers enables easy programming and efficient
packaging of 8/16/32-bit data in memory
• Linear 4 GB address space removes the need for
paging/banking, reducing software complexity
• ARM third-party ecosystem support: Software and
tools to help minimize development time/cost
Continue ARM Features
• Micro Trace Buffer: Lightweight trace solution allows
fast bug identification and correction
• BME: Bit manipulation engine reduces code size and
cycles for bit oriented operations to peripheral
registers eliminating traditional methods where the
core would need to perform read-modify-write
operations.
• Up to 4-channel DMA for peripheral and memory
servicing with minimal CPU intervention
• Ultra low-power: Extreme dynamic efficiency: 32-bit
ARM Cortex-M0+ core combined with Freescale 90
nm thin film storage flash
Peripheral Features
• Memories
• 128 KB Flash
• 6 KB SRAM
• System integration
• Power management and mode controllers
• Low-leakage wakeup unit
• Bit manipulation engine for read-modify-write peripherals
• DMA controller
• COP timer
• Clocks
• Clock generation module with FLL and PLL for system and
CPU clock generation
• 4MHz and 32 kHz internal reference clock
• Low-power 1khz RC oscillator for RTC and COP watchdog
Continued
• Analog peripherals
• 16 bit SAR ADC w/ DMA support
• 12 bit DAC w/ DMA support
• High speed comparator
• Comm
• 2 SPI
• USB dual-role controller with built in FS/LS transceiver
• USB voltage regulator
• 2 I2C modules
• 1 low-power Timer
• System tick timer
• Human-Machine Interfaces
• GPIO controller
• Cap touch sense input interface module
General Features
• Timing and Control:
• Powerful timer modules which support general purpose,
PWM, and motor control functions
• Periodic Interrupt Timer for RTOS task scheduler time
base or trigger source for ADC conversion and timer
modules
• System:
• GPIO with pin interrupt functionality
• Wide operating voltage range from 1.71 V to 3.6 V with
flash programmable down to 1.71 V with fully functional
flash and analog peripherals
• Ambient operating temperature ranges from -40 °C to
105 °C
M0+ Functional Blocks
MSP (R13) The Stack Pointer (SP) is register R13. In Thread mode, the CONTROL
register indicates the stack pointer to use, Main Stack Pointer (MSP) or
Process Stack Pointer (PSP).
PSP (R13)
LR (R14) The Link Register (LR) is register R14. It stores the return information for
subroutines, function calls, and exceptions.
PC (R15) The Program Counter (PC) is register R15. It contains the current program address.
PRIMASK The PRIMASK register prevents activation of all exceptions with configurable
priority.
CONTROL The CONTROL register controls the stack used, and optionally the code privilege level,
when
the processor is in Thread mode.
Processor Core Registers