The information in this publication has been carefully
checked and is believed to be entirely accurate at the
time of publication. Samsung assumes no
responsibility, however, for possible errors or
omissions, or for any consequences resulting from
the use of the information contained herein.
Samsung reserves the right to make changes in its
products or product specifications with the intent to
improve function or design at any time and without
notice and is not required to update this
documentation to reflect such changes.
This publication does not convey to a purchaser of
semiconductor devices described herein any license
under the patent rights of Samsung or others.
Samsung makes no warranty, representation, or
guarantee regarding the suitability of its products for
any particular purpose, nor does Samsung assume
any liability arising out of the application or use of any
product or circuit and specifically disclaims any and
all liability, including without limitation any
consequential or incidental damages.
"Typical" parameters can and do vary in different
applications. All operating parameters, including
"Typicals" must be validated for each customer
application by the customer's technical experts.
Samsung products are not designed, intended, or
authorized for use as components in systems
intended for surgical implant into the body, for other
applications intended to support or sustain life, or for
any other application in which the failure of the
Samsung product could create a situation where
personal injury or death may occur.
Should the Buyer purchase or use a Samsung
product for any such unintended or unauthorized
application, the Buyer shall indemnify and hold
Samsung and its officers, employees, subsidiaries,
affiliates, and distributors harmless against all claims,
costs, damages, expenses, and reasonable attorney
fees arising out of, either directly or indirectly, any
claim of personal injury or death that may be
associated with such unintended or unauthorized use,
even if such claim alleges that Samsung was
negligent regarding the design or manufacture of said
product.
2004 Samsung Electronics
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any
form or by any means, electric or mechanical, by photocopying, recording, or otherwise, without the prior written
consent of Samsung Electronics.
Samsung Electronics' microcontroller business has been awarded full ISO-9001
certification (BSI Certificate No. FM24653). All semiconductor products are designed
and manufactured in accordance with the highest quality standards and objectives.
Samsung Electronics Co., Ltd.
San #24 Nongseo-Ri, Giheung- Eup
Yongin-City, Gyeonggi-Do, Korea
C.P.O. Box #37, Suwon 449-900
TEL:(82)-(031)-209-1934
FAX:(82)-(031)-209-1899
Home Page: http://www.samsung.com
Printed in the Republic of Korea
5-5Switching from FCLK to BCLK in Asynchronous Mode............................................5-3
S3C2410A MICROPROCESSORxxix
Page 31
S3C2410A PRODUCT OVERVIEW
1 PRODUCT OVERVIEW
INTRODUCTION
This manual describes SAMSUNG's S3C2410A 16/32-bit RISC microprocessor. This product is designed to provide
hand-held devices and general applications with cost-effective, low-power, and high-performance micro-controller
solution in small die size. To reduce total system cost, the S3C2410A includes the following components separate
16KB Instruction and 16KB Data Cache, MMU to handle virtual memory management, LCD Controller (STN & TFT),
NAND Flash Boot Loader, System Manager (chip select logic and SDRAM Controller), 3-ch UART, 4-ch DMA, 4-ch
Timers with PWM, I/O Ports, RTC, 8-ch 10-bit ADC and Touch Screen Interface, IIC-BUS Interface, IIS-BUS
Interface, USB Host, USB Device, SD Host & Multi-Media Card Interface, 2-ch SPI and PLL for clock generation.
The S3C2410A was developed using an ARM920T core, 0.18um CMOS standard cells and a memory complier. Its
low-power, simple, elegant and fully static design is particularly suitable for cost- and power-sensitive applications. It
adopts a new bus architecture called Advanced Microcontroller Bus Architecture (AMBA).
The S3C2410A offers outstanding features with its CPU core, a 16/32-bit ARM920T RISC processor designed by
Advanced RISC Machines, Ltd. The ARM920T implements MMU, AMBA BUS, and Harvard cache architecture with
separate 16KB instruction and 16KB data caches, each with an 8-word line length.
By providing a complete set of common system peripherals, the S3C2410A minimizes overall system costs and
eliminates the need to configure additional components. The integrated on-chip functions that are described in this
document include:
• Power control: Normal, Slow, Idle and Power-off mode
• 8-ch 10-bit ADC and Touch screen interface
• RTC with calendar function
• On-chip clock generator with PLL
1-1
Page 32
PRODUCT OVERVIEWS3C2410A
FEATURES
Architecture
• Integrated system for hand-held devices and
general embedded applications
• 16/32-Bit RISC architecture and powerful
instruction set with ARM920T CPU core
• Enhanced ARM architecture MMU to support
WinCE, EPOC 32 and Linux
• Instruction cache, data cache, write buffer and
Physical address TAG RAM to reduce the effect of
main memory bandwidth and latency on
performance
• ARM920T CPU core supports the ARM debug
architecture.
• Internal Advanced Microcontroller Bus Architecture
(AMBA) (AMBA2.0, AHB/APB)
System Manager
• Little/Big Endian support
• Address space: 128M bytes for each bank (total
1G bytes)
• Supports programmable 8/16/32-bit data bus width
for each bank
• Fixed bank start address from bank 0 to bank 6
• Programmable bank start address and bank size
for bank 7
• Eight memory banks:
– Six memory banks for ROM, SRAM, and others.
– Two memory banks for ROM/SRAM/
Synchronous DRAM
• Fully Programmable access cycles for all memory
banks
• Supports external wait signals to expend the bus
cycle
• Supports self-refresh mode in SDRAM for power-
down
NAND Flash Boot Loader
• Supports booting from NAND flash memory
• 4KB internal buffer for booting
• Supports storage memory for NAND flash memory
after booting
Cache Memory
• 64-way set-associative cache with I-Cache (16KB)
and D-Cache (16KB)
• 8words length per line with one valid bit and two
dirty bits per line
• Pseudo random or round robin replacement
algorithm
• Write-through or write-back cache operation to
update the main memory
• The write buffer can hold 16 words of data and four
addresses.
Clock & Power Manager
• On-chip MPLL and UPLL:
UPLL generates the clock to operate USB
Host/Device.
MPLL generates the clock to operate MCU at
maximum 266MHz @ 2.0V.
• Clock can be fed selectively to each function block
by software.
• Power mode: Normal, Slow, Idle, and Power-off
mode
Normal mode: Normal operating mode
Slow mode: Low frequency clock without PLL
Idle mode: The clock for only CPU is stopped.
Power-off mode: The Core power including all
peripherals is shut down.
1. The @BUS REQ. shows the pin states at the external bus, which is used by the other bus master.
2. ' – ‘ mark indicates the unchanged pin state at Bus Request mode.
3. Hi-z or Pre means Hi-z or Previous state and it is determined by the setting of MISCCR register.
4. AI/AO means analog input/analog output.
5. P, I, and O mean power, input and output respectively.
6. The I/O state @nRESET shows the pin status in the @nRESET duration below.
I/O Type
nRESET
FCLK
@nRESET4FCLK
1-18
Page 49
S3C2410A PRODUCT OVERVIEW
7. The table below shows I/O types and the descriptions.
I/O TypeDescriptions
d1i(vdd1ih), s3i(vss3i)1.8V / 2.0V VDD/VSS for internal logic
d1c(vdd1ih_core), s3i(vss3i)1.8V / 2.0V VDD/VSS for internal logic without input driver
d3o(vdd3op), s3o(vss3op)3.3V VDD/VSS for external logic
d3t(vdd3t_abb), s3t(vss3t_abb)3.3V VDD/VSS for analog circuitry
is(phis)Input pad, LVCMOS schmitt-trigger level
us(pbusb)USB pad
ot(phot8)Output pad, tri-state, Io = 8mA
b8(phob8)Output pad, Io = 8mA
t16(phot16sm)Output pad, tri-state, medium slew rate, Io = 16mA
r10(phiar10_abb)Analog input pad with 10Ω resistor
ia(phia_abb)Analog input pad
gp(phgpad_option)Pad for analog pin
m26(phsoscm26)Oscillator cell with enable and feedback resistor
t6(phtbsu100ct6sm)Bi-directional pad, 5V tolerant LVCMOS schmitt-trigger, 100Kohm pull-up
resistor with control, tri-state, Io = 6mA
t8(phbsu100ct8sm)Bi-directional pad, LVCMOS schmitt-trigger, 100Kohm pull-up resistor with
control, tri-state, Io = 8mA
t12(phbsu100ct12sm)Bi-directional pad, LVCMOS schmitt-trigger, 100Kohm pull-up resistor with
control, tri-state, Io = 12mA
d8(phbsu100cd8sm)Bi-directional pad, LVCMOS schmitt-trigger, 100Kohm pull-up resistor with
control, open-drain, Io = 8mA
1-19
Page 50
PRODUCT OVERVIEWS3C2410A
SIGNAL DESCRIPTIONS
Table 1-3. S3C2410A Signal Descriptions
SignalI/ODescriptions
Bus Controller
OM [1:0]IOM [1:0] sets S3C2410A in the TEST mode, which is used only at fabrication. Also, it
determines the bus width of nGCS0. The pull-up/down resistor determines the logic
level during the RESET cycle.
00:Nand-boot01:16-bit10:32-bit11:Test mode
ADDR [26:0]OADDR [26:0] (Address Bus) outputs the memory address of the corresponding bank.
DATA [31:0]IODATA [31:0] (Data Bus) inputs data during memory read and outputs data during
memory write. The bus width is programmable among 8/16/32-bit.
nGCS [7:0]OnGCS [7:0] (General Chip Select) are activated when the address of a memory is
within the address region of each bank. The number of access cycles and the bank
size can be programmed.
nWEOnWE (Write Enable) indicates that the current bus cycle is a write cycle.
nOEOnOE (Output Enable) indicates that the current bus cycle is a read cycle.
nXBREQInXBREQ (Bus Hold Request) allows another bus master to request control of the local
bus. BACK active indicates that bus control has been granted.
nXBACKOnXBACK (Bus Hold Acknowledge) indicates that the S3C2410A has surrendered
control of the local bus to another bus master.
nWAITInWAIT requests to prolong a current bus cycle. As long as nWAIT is L, the current
bus cycle cannot be completed.
If nWAIT signal isn't used in your system, nWAIT signal must be tied on pull-up
resistor.
SDRAM/SRAM
nSRASOSDRAM Row Address Strobe
nSCASOSDRAM Column Address Strobe
nSCS [1:0]OSDRAM Chip Select
DQM [3:0]OSDRAM Data Mask
SCLK [1:0]OSDRAM Clock
SCKEOSDRAM Clock Enable
nBE [3:0]OUpper Byte/Lower Byte Enable (In case of 16-bit SRAM)
nWBE [3:0]OWrite Byte Enable
1-20
Page 51
S3C2410A PRODUCT OVERVIEW
Table 1-3. S3C2410A Signal Descriptions (Continued)
If NAND Flash Controller isn't used, it has to be tied on pull-up resistor.
R/nBINAND Flash Ready/Busy.
If NAND Flash Controller isn't used, it has to be tied on pull-up resistor.
LCD Control Unit
VD [23:0]OSTN/TFT/SEC TFT: LCD Data Bus
LCD_PWRENOSTN/TFT/SEC TFT: LCD panel power enable control signal
VCLKOSTN/TFT: LCD clock signal
VFRAMEOSTN: LCD Frame signal
VLINEOSTN: LCD line signal
VMOSTN: VM alternates the polarity of the row and column voltage
VSYNCOTFT: Vertical synchronous signal
HSYNCOTFT: Horizontal synchronous signal
VDENOTFT: Data enable signal
LENDOTFT: Line End signal
STVOSEC TFT: SEC (Samsung Electronics Company) TFT LCD panel control signal
CPVOSEC TFT: SEC (Samsung Electronics Company) TFT LCD panel control signal
LCD_HCLKOSEC TFT: SEC (Samsung Electronics Company) TFT LCD panel control signal
TPOSEC TFT: SEC (Samsung Electronics Company) TFT LCD panel control signal
STHOSEC TFT: SEC (Samsung Electronics Company) TFT LCD panel control signal
LCDVF [2:0]OSEC TFT: Timing control signal for specific TFT LCD (OE/REV/REVB)
Table 1-3. S3C2410A Signal Descriptions (Continued)
SignalI/ODescriptions
UART
RxD [2:0]IUART receives data input
TxD [2:0]OUART transmits data output
nCTS [1:0]IUART clear to send input signal
nRTS [1:0]OUART request to send output signal
UEXTCLKIUART clock signal
ADC
AIN [7:0]AIADC input [7:0]. If it isn't used pin, it has to be in Ground.
VrefAIADC Vref
IIC-Bus
IICSDAIOIIC-bus data
IICSCLIOIIC-bus clock
IIS-Bus
I2SLRCKIOIIS-bus channel select clock
I2SSDOOIIS-bus serial data output
I2SSDIIIIS-bus serial data input
I2SSCLKIOIIS-bus serial clock
CDCLKOCODEC system clock
Touch Screen
nXPONOPlus X-axis on-off control signal
XMONOMinus X-axis on-off control signal
nYPONOPlus Y-axis on-off control signal
YMONOMinus Y-axis on-off control signal
USB Host
DN [1:0]IO
DP [1:0]IO
DATA (–) from USB host. (15Kohm pull-down)
DATA (+) from USB host. (15Kohm pull-down)
USB Device
PDN0IO
PDP0IO
DATA (–) for USB peripheral. (470Kohm pull-down)
DATA (+) for USB peripheral. (1.5Kohm pull-up)
SPI
SPIMISO [1:0]IOSPIMISO is the master data input line, when SPI is configured as a master.
When SPI is configured as a slave, these pins reverse its role.
SPIMOSI [1:0]IOSPIMOSI is the master data output line, when SPI is configured as a master.
When SPI is configured as a slave, these pins reverse its role.
SPICLK [1:0]IOSPI clock
nSS [1:0]ISPI chip select (only for slave mode)
1-22
Page 53
S3C2410A PRODUCT OVERVIEW
Table 1-3. S3C2410A Signal Descriptions (Continued)
GPn [116:0]IOGeneral input/output ports (some ports are output only)
TIMMER/PWM
TOUT [3:0]OTimer Output [3:0]
TCLK [1:0]IExternal timer clock input
JTAG TEST LOGIC
nTRSTInTRST (TAP Controller Reset) resets the TAP controller at start.
If debugger is used, A 10K pull-up resistor has to be connected.
If debugger (black ICE) is not used, nTRST pin must be issued by a low active pulse
(Typically connected to nRESET).
TMSITMS (TAP Controller Mode Select) controls the sequence of the TAP controller's
states. A 10K pull-up resistor has to be connected to TMS pin.
TCKITCK (TAP Controller Clock) provides the clock input for the JTAG logic.
A 10K pull-up resistor must be connected to TCK pin.
TDIITDI (TAP Controller Data Input) is the serial input for test instructions and data.
A 10K pull-up resistor must be connected to TDI pin.
TDOOTDO (TAP Controller Data Output) is the serial output for test instructions and data.
Reset, Clock & Power
nRESETSTnRESET suspends any operation in progress and places S3C2410A into a known
reset state. For a reset, nRESET must be held to L level for at least 4 FCLK after the
processor power has been stabilized.
nRSTOUTOFor external device reset control
(nRSTOUT = nRESET & nWDTRST & SW_RESET)
PWRENO2.0V core power on-off control signal
nBATT_FLTIProbe for battery state (Does not wake up at power-off mode in case of low battery
state). If it isn't used, it has to be High (3.3V).
OM [3:2]IOM [3:2] determines how the clock is made.
OM [3:2] = 00b, Crystal is used for MPLL CLK source and UPLL CLK source.
OM [3:2] = 01b, Crystal is used for MPLL CLK source
and EXTCLK is used for UPLL CLK source.
OM [3:2] = 10b, EXTCLK is used for MPLL CLK source
and Crystal is used for UPLL CLK source.
OM [3:2] = 11b, EXTCLK is used for MPLL CLK source and UPLL CLK source.
1-23
Page 54
PRODUCT OVERVIEWS3C2410A
Table 1-3. S3C2410A Signal Descriptions (Continued)
SignalI/ODescription
Reset, Clock & Power (Continued)
EXTCLKIExternal clock source.
When OM [3:2] = 11b, EXTCLK is used for MPLL CLK source and UPLL CLK source.
When OM [3:2] = 10b, EXTCLK is used for MPLL CLK source only.
When OM [3:2] = 01b, EXTCLK is used for UPLL CLK source only.
If it isn't used, it has to be High (3.3V).
XTIpllAICrystal Input for internal osc circuit.
When OM [3:2] = 00b, XTIpll is used for MPLL CLK source and UPLL CLK source.
When OM [3:2] = 01b, XTIpll is used for MPLL CLK source only.
When OM [3:2] = 10b, XTIpll is used for UPLL CLK source only.
If it isn't used, XTIpll has to be High (3.3V).
XTOpllAOCrystal Output for internal osc circuit.
When OM [3:2] = 00b, XTIpll is used for MPLL CLK source and UPLL CLK source.
When OM [3:2] = 01b, XTIpll is used for MPLL CLK source only.
When OM [3:2] = 10b, XTIpll is used for UPLL CLK source only.
If it isn't used, it has to be a floating pin.
MPLLCAPAILoop filter capacitor for main clock.
UPLLCAPAILoop filter capacitor for USB clock.
XTIrtcAI32.768 kHz crystal input for RTC. If it isn't used, it has to be in High (RTCVDD = 1.8V).
XTOrtcAO32.768 kHz crystal output for RTC. If it isn't used, it has to be Float.
CLKOUT [1:0]OClock output signal. The CLKSEL of MISCCR register configures the clock output
mode among the MPLL CLK, UPLL CLK, FCLK, HCLK and PCLK.
1-24
Page 55
S3C2410A PRODUCT OVERVIEW
Table 1-3. S3C2410A Signal Descriptions (Continued)
SignalI/ODescription
Power
VDDalivePS3C2410A reset block and port status register VDD (1.8V / 2.0V).
It should be always supplied whether in normal mode or in power-off mode.
VDDi/VDDiarmPS3C2410A core logic VDD (1.8V / 2.0V) for CPU.
VSSi/VSSiarmPS3C2410A core logic V
SS
VDDi_MPLLPS3C2410A MPLL analog and digital VDD (1.8V / 2.0V).
VSSi_MPLLPS3C2410A MPLL analog and digital VSS.
VDDOPPS3C2410A I/O port VDD (3.3V)
VDDMOPPS3C2410A Memory I/O V
DD
3.3V: SCLK up to 133MHz
VSSMOPPS3C2410A Memory I/O V
VSSOPPS3C2410A I/O port V
SS
SS
RTCVDDPRTC VDD (1.8 V, Not support 2.0 and 3.3V)
(This pin must be connected to power properly if RTC isn't used)
VDDi_UPLLPS3C2410A UPLL analog and digital VDD (1.8V / 2.0V)
VSSi_UPLLPS3C2410A UPLL analog and digital V
SS
VDDA_ADCPS3C2410A ADC VDD (3.3V)
VSSA_ADCPS3C2410A ADC V
NOTES:
1. I/O means input/output.
2. AI/AO means analog input/analog output.
3. ST means schmitt-trigger.
4. P means power.
SS
1-25
Page 56
PRODUCT OVERVIEWS3C2410A
S3C2410A SPECIAL REGISTERS
Table 1-4. S3C2410A Special Registers
Register
Name
Address
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
Memory Controller
BWSCON0x48000000←WR/WBus Width & Wait Status Control
BANKCON00x48000004Boot ROM Control
BANKCON10x48000008BANK1 Control
BANKCON20x4800000CBANK2 Control
BANKCON30x48000010BANK3 Control
BANKCON40x48000014BANK4 Control
BANKCON50x48000018BANK5 Control
BANKCON60x4800001CBANK6 Control
BANKCON70x48000020BANK7 Control
REFRESH0x48000024DRAM/SDRAM Refresh Control
BANKSIZE0x48000028Flexible Bank Size
MRSRB60x4800002CMode register set for SDRAM
MRSRB70x48000030Mode register set for SDRAM
1-26
Page 57
S3C2410A PRODUCT OVERVIEW
Table 1-4. S3C2410A Special Registers (Continued)
Register NameAddress
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
USB Host Controller
HcRevision0x49000000←WControl and Status Group
HcControl0x49000004
HcCommonStatus0x49000008
HcInterruptStatus0x4900000C
HcInterruptEnable0x49000010
HcInterruptDisable0x49000014
HcHCCA0x49000018Memory Pointer Group
HcPeriodCuttentED0x4900001C
HcControlHeadED0x49000020
HcControlCurrentED0x49000024
HcBulkHeadED0x49000028
HcBulkCurrentED0x4900002C
HcDoneHead0x49000030
HcRmInterval0x49000034Frame Counter Group
HcFmRemaining0x49000038
HcFmNumber0x4900003C
HcPeriodicStart0x49000040
HcLSThreshold0x49000044
HcRhDescriptorA0x49000048Root Hub Group
HcRhDescriptorB0x4900004C
HcRhStatus0x49000050
HcRhPortStatus10x49000054
HcRhPortStatus20x49000058
Interrupt Controller
SRCPND0X4A000000←WR/WInterrupt Request Status
INTMOD0X4A000004WInterrupt Mode Control
INTMSK0X4A000008R/WInterrupt Mask Control
PRIORITY0X4A00000CWIRQ Priority Control
INTPND0X4A000010R/WInterrupt Request Status
INTOFFSET0X4A000014RInterrupt request source offset
SUBSRCPND0X4A000018R/WSub source pending
INTSUBMSK0X4A00001CR/WInterrupt sub mask
1-27
Page 58
PRODUCT OVERVIEWS3C2410A
Table 1-4. S3C2410A Special Registers (Continued)
Register
Name
Address
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
DMA
DISRC00x4B000000←WR/WDMA 0 Initial Source
DISRCC00x4B000004DMA 0 Initial Source Control
DIDST00x4B000008DMA 0 Initial Destination
DIDSTC00x4B00000CDMA 0 Initial Destination Control
DCON00x4B000010DMA 0 Control
DSTAT00x4B000014RDMA 0 Count
DCSRC00x4B000018DMA 0 Current Source
DCDST00x4B00001CDMA 0 Current Destination
DMASKTRIG00x4B000020←WR/WDMA 0 Mask Trigger
DISRC10x4B000040DMA 1 Initial Source
DISRCC10x4B000044DMA 1 Initial Source Control
DIDST10x4B000048DMA 1 Initial Destination
DIDSTC10x4B00004CDMA 1 Initial Destination Control
DCON10x4B000050DMA 1 Control
DSTAT10x4B000054RDMA 1 Count
DCSRC10x4B000058DMA 1 Current Source
DCDST10x4B00005C←WDMA 1 Current Destination
DMASKTRIG10x4B000060R/WDMA 1 Mask Trigger
DISRC20x4B000080DMA 2 Initial Source
DISRCC20x4B000084DMA 2 Initial Source Control
DIDST20x4B000088DMA 2 Initial Destination
DIDSTC20x4B00008CDMA 2 Initial Destination Control
DCON20x4B000090DMA 2 Control
DSTAT20x4B000094RDMA 2 Count
DCSRC20x4B000098←WDMA 2 Current Source
DCDST20x4B00009CDMA 2 Current Destination
DMASKTRIG20x4B0000A0R/WDMA 2 Mask Trigger
DISRC30x4B0000C0←WR/WDMA 3 Initial Source
DISRCC30x4B0000C4DMA 3 Initial Source Control
DIDST30x4B0000C8DMA 3 Initial Destination
DIDSTC30x4B0000CCDMA 3 Initial Destination Control
DCON30x4B0000D0DMA 3 Control
DSTAT30x4B0000D4RDMA 3 Count
DCSRC30x4B0000D8DMA 3 Current Source
DCDST30x4B0000DCDMA 3 Current Destination
DMASKTRIG30x4B0000E0R/WDMA 3 Mask Trigger
1-28
Page 59
S3C2410A PRODUCT OVERVIEW
Table 1-4. S3C2410A Special Registers (Continued)
Register
Name
Address
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
Clock & Power Management
LOCKTIME0x4C000000←WR/WPLL Lock Time Counter
MPLLCON0x4C000004MPLL Control
UPLLCON0x4C000008UPLL Control
CLKCON0x4C00000CClock Generator Control
CLKSLOW0x4C000010Slow Clock Control
CLKDIVN0x4C000014Clock divider Control
LCD Controller
LCDCON10X4D000000←WR/WLCD Control 1
LCDCON20X4D000004LCD Control 2
LCDCON30X4D000008LCD Control 3
LCDCON40X4D00000CLCD Control 4
LCDCON50X4D000010LCD Control 5
LCDSADDR10X4D000014STN/TFT: Frame Buffer Start Address1
LCDSADDR20X4D000018STN/TFT: Frame Buffer Start Address2
LCDSADDR30X4D00001CSTN/TFT: Virtual Screen Address Set
REDLUT0X4D000020STN: Red Lookup Table
GREENLUT0X4D000024STN: Green Lookup Table
BLUELUT0X4D000028STN: Blue Lookup Table
DITHMODE0X4D00004CSTN: Dithering Mode
TPAL0X4D000050TFT: Temporary Palette
LCDINTPND0X4D000054LCD Interrupt Pending
LCDSRCPND0X4D000058LCD Interrupt Source
LCDINTMSK0X4D00005CLCD Interrupt Mask
LPCSEL0X4D000060LPC3600 Control
NAND Flash
NFCONF0x4E000000←WR/WNAND Flash Configuration
NFCMD0x4E000004NAND Flash Command
NFADDR0x4E000008NAND Flash Address
NFDATA0x4E00000CNAND Flash Data
NFSTAT0x4E000010RNAND Flash Operation Status
NFECC0x4E000014R/WNAND Flash ECC
1-29
Page 60
PRODUCT OVERVIEWS3C2410A
Table 1-4. S3C2410A Special Registers (Continued)
Register
Name
Address
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
UART
ULCON00x50000000←WR/WUART 0 Line Control
UCON00x50000004UART 0 Control
UFCON00x50000008UART 0 FIFO Control
UMCON00x5000000CUART 0 Modem Control
UTRSTAT00x50000010RUART 0 Tx/Rx Status
UERSTAT00x50000014UART 0 Rx Error Status
UFSTAT00x50000018UART 0 FIFO Status
UMSTAT00x5000001CUART 0 Modem Status
UTXH00x500000230x50000020BWUART 0 Transmission Hold
URXH00x500000270x50000024RUART 0 Receive Buffer
UBRDIV00x50000028←WR/WUART 0 Baud Rate Divisor
ULCON10x50004000←WR/WUART 1 Line Control
UCON10x50004004UART 1 Control
UFCON10x50004008UART 1 FIFO Control
UMCON10x5000400CUART 1 Modem Control
UTRSTAT10x50004010RUART 1 Tx/Rx Status
UERSTAT10x50004014UART 1 Rx Error Status
UFSTAT10x50004018UART 1 FIFO Status
UMSTAT10x5000401CUART 1 Modem Status
UTXH10x500040230x50004020BWUART 1 Transmission Hold
URXH10x500040270x50004024RUART 1 Receive Buffer
UBRDIV10x50004028←WR/WUART 1 Baud Rate Divisor
ULCON20x50008000←WR/WUART 2 Line Control
UCON20x50008004UART 2 Control
UFCON20x50008008UART 2 FIFO Control
UTRSTAT20x50008010RUART 2 Tx/Rx Status
UERSTAT20x50008014UART 2 Rx Error Status
UFSTAT20x50008018UART 2 FIFO Status
UTXH20x500080230x50008020BWUART 2 Transmission Hold
URXH20x500080270x50008024RUART 2 Receive Buffer
UBRDIV20x50008028←WR/WUART 2 Baud Rate Divisor
FUNC_ADDR_REG0x520001430x52000140BR/WFunction Address
PWR_REG0x520001470x52000144Power Management
EP_INT_REG0x5200014B0x52000148EP Interrupt Pending and Clear
USB_INT_REG0x5200015B0x52000158USB Interrupt Pending and Clear
EP_INT_EN_REG0x5200015F0x5200015CInterrupt Enable
USB_INT_EN_REG0x5200016F0x5200016CInterrupt Enable
FRAME_NUM1_REG0x520001730x52000170RFrame Number Lower Byte
INDEX_REG0x5200017B0x52000178R/WRegister Index
EP0_CSR0x520001870x52000184Endpoint 0 Status
IN_CSR1_REG0x520001870x52000184In Endpoint Control Status
IN_CSR2_REG0x5200018B0x52000188In Endpoint Control Status
MAXP_REG0x520001830x52000180Endpoint Max Packet
OUT_CSR1_REG0x520001930x52000190Out Endpoint Control Status
OUT_CSR2_REG0x520001970x52000194Out Endpoint Control Status
OUT_FIFO_CNT1_REG0x5200019B0x52000198REndpoint Out Write Count
OUT_FIFO_CNT2_REG0x5200019F0x5200019CEndpoint Out Write Count
EP0_FIFO0x520001C30x520001C0R/WEndpoint 0 FIFO
EP1_FIFO0x520001C70x520001C4Endpoint 1 FIFO
EP2_FIFO0x520001CB0x520001C8Endpoint 2 FIFO
EP3_FIFO0x520001CF0x520001CCEndpoint 3 FIFO
EP4_FIFO0x520001D30x520001D0Endpoint 4 FIFO
EP1_DMA_CON0x520002030x52000200EP1 DMA Interface Control
EP1_DMA_UNIT0x520002070x52000204EP1 DMA Tx Unit Counter
EP1_DMA_FIFO0x5200020B0x52000208EP1 DMA Tx FIFO Counter
EP1_DMA_TTC_L0x5200020F0x5200020CEP1 DMA Total Tx Counter
EP1_DMA_TTC_M0x520002130x52000210EP1 DMA Total Tx Counter
EP1_DMA_TTC_H0x520002170x52000214EP1 DMA Total Tx Counter
1-32
Page 63
S3C2410A PRODUCT OVERVIEW
Table 1-4. S3C2410A Special Registers (Continued)
Register NameAddress
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/W
rite
Function
USB Device (Continued)
EP2_DMA_CON0x5200021B0x52000218BR/WEP2 DMA Interface Control
EP2_DMA_UNIT0x5200021F0x5200021CEP2 DMA Tx Unit Counter
EP2_DMA_FIFO0x520002230x52000220EP2 DMA Tx FIFO Counter
EP2_DMA_TTC_L0x520002270x52000224EP2 DMA Total Tx Counter
EP2_DMA_TTC_M0x5200022B0x52000228EP2 DMA Total Tx Counter
EP2_DMA_TTC_H0x5200022F0x5200022CEP2 DMA Total Tx Counter
EP3_DMA_CON0x520002430x52000240EP3 DMA Interface Control
EP3_DMA_UNIT0x520002470x52000244EP3 DMA Tx Unit Counter
EP3_DMA_FIFO0x5200024B0x52000248EP3 DMA Tx FIFO Counter
EP3_DMA_TTC_L0x5200024F0x5200024CEP3 DMA Total Tx Counter
EP3_DMA_TTC_M0x520002530x52000250EP3 DMA Total Tx Counter
EP3_DMA_TTC_H0x520002570x52000254EP3 DMA Total Tx Counter
EP4_DMA_CON0x5200025B0x52000258EP4 DMA Interface Control
EP4_DMA_UNIT0x5200025F0x5200025CEP4 DMA Tx Unit Counter
EP4_DMA_FIFO0x520002630x52000260EP4 DMA Tx FIFO Counter
EP4_DMA_TTC_L0x520002670x52000264EP4 DMA Total Tx Counter
EP4_DMA_TTC_M0x5200026B0x52000268EP4 DMA Total Tx Counter
EP4_DMA_TTC_H0x5200026F0x5200026CEP4 DMA Total Tx Counter
Watchdog Timer
WTCON0x53000000←WR/WWatchdog Timer Mode
WTDAT0x53000004Watchdog Timer Data
WTCNT0x53000008Watchdog Timer Count
IIC
IICCON0x54000000←WR/WIIC Control
IICSTAT0x54000004IIC Status
IICADD0x54000008IIC Address
IICDS0x5400000CIIC Data Shift
IIS
IISCON0x55000000,020x55000000HW,WR/WIIS Control
IISMOD0x55000004,060x55000004HW,WIIS Mode
IISPSR0x55000008,0A0x55000008HW,WIIS Prescaler
IISFCON0x5500000C,0E0x5500000CHW,WIIS FIFO Control
IISFIFO0x550000120x55000010HWIIS FIFO Entry
1-33
Page 64
PRODUCT OVERVIEWS3C2410A
Table 1-4. S3C2410A Special Registers (Continued)
Register
Name
Address
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
I/O port
GPACON0x56000000←WR/WPort A Control
GPADAT0x56000004Port A Data
GPBCON0x56000010Port B Control
GPBDAT0x56000014Port B Data
GPBUP0x56000018Pull-up Control B
GPCCON0x56000020Port C Control
GPCDAT0x56000024Port C Data
GPCUP0x56000028Pull-up Control C
GPDCON0x56000030Port D Control
GPDDA1T0x56000034Port D Data
GPDUP0x56000038Pull-up Control D
GPECON0x56000040Port E Control
GPEDAT0x56000044Port E Data
GPEUP0x56000048Pull-up Control E
GPFCON0x56000050Port F Control
GPFDAT0x56000054Port F Data
GPFUP0x56000058Pull-up Control F
GPGCON0x56000060Port G Control
GPGDAT0x56000064Port G Data
GPGUP0x56000068Pull-up Control G
GPHCON0x56000070Port H Control
GPHDAT0x56000074Port H Data
GPHUP0x56000078Pull-up Control H
MISCCR0x56000080←WR/WMiscellaneous Control
DCLKCON0x56000084DCLK0/1 Control
EXTINT00x56000088External Interrupt Control Register 0
EXTINT10x5600008CExternal Interrupt Control Register 1
EXTINT20x56000090External Interrupt Control Register 2
EINTFLT00x56000094Reserved
EINTFLT10x56000098Reserved
EINTFLT20x5600009CExternal Interrupt Filter Control Register 2
EINTFLT30x560000A0External Interrupt Filter Control Register 3
EINTMASK0x560000A4External Interrupt Mask
EINTPEND0x560000A8External Interrupt Pending
GSTATUS00x560000ACExternal Pin Status
GSTATUS10x560000B0External Pin Status
1-34
Page 65
S3C2410A PRODUCT OVERVIEW
Table 1-4. S3C2410A Special Registers (Continued)
Register
Name
Address
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
RTC
RTCCON0x570000430x57000040BR/WRTC Control
TICNT0x570000470x57000044Tick time count
RTCALM0x570000530x57000050RTC Alarm Control
ALMSEC0x570000570x57000054Alarm Second
ALMMIN0x5700005B0x57000058Alarm Minute
ALMHOUR0x5700005F0x5700005CAlarm Hour
ALMDATE0x570000630x57000060Alarm Day
ALMMON0x570000670x57000064Alarm Month
ALMYEAR0x5700006B0x57000068Alarm Year
RTCRST0x5700006F0x5700006CRTC Round Reset
BCDSEC0x570000730x57000070BCD Second
BCDMIN0x570000770x57000074BCD Minute
BCDHOUR0x5700007B0x57000078BCD Hour
BCDDATE0x5700007F0x5700007CBCD Day
BCDDAY0x570000830x57000080BCD Date
BCDMON0x570000870x57000084BCD Month
BCDYEAR0x5700008B0x57000088BCD Year
A/D converter
ADCCON0x58000000←WR/WADC Control
ADCTSC0x58000004ADC Touch Screen Control
ADCDLY0x58000008ADC Start or Interval Delay
ADCDAT00x5800000CRADC Conversion Data
ADCDAT10x58000010ADC Conversion Data
SPI
SPCON0,10x59000000,20←WR/WSPI Control
SPSTA0,10x59000004,24RSPI Status
SPPIN0,10x59000008,28R/WSPI Pin Control
SPPRE0,10x5900000C,2CSPI Baud Rate Prescaler
SPTDAT0,10x59000010,30SPI Tx Data
SPRDAT0,10x59000014,34RSPI Rx Data
1-35
Page 66
PRODUCT OVERVIEWS3C2410A
Table 1-4. S3C2410A Special Registers (Continued)
Register NameAddress
(B. Endian)
Address
(L. Endian)
Acc.
Unit
Read/
Write
Function
SD interface
SDICON0x5A000000←WR/WSDI Control
SDIPRE0x5A000004SDI Baud Rate Prescaler
SDICmdArg0x5A000008SDI Command Argument
SDICmdCon0x5A00000CSDI Command Control
SDICmdSta0x5A000010R/(C)SDI Command Status
SDIRSP00x5A000014RSDI Response
SDIRSP10x5A000018SDI Response
SDIRSP20x5A00001CSDI Response
SDIRSP30x5A000020SDI Response
SDIDTimer0x5A000024R/WSDI Data / Busy Timer
SDIBSize0x5A000028SDI Block Size
SDIDatCon0x5A00002CSDI Data control
SDIDatCnt0x5A000030RSDI Data Remain Counter
SDIDatSta0x5A000034R/(C)SDI Data Status
SDIFSTA0x5A000038RSDI FIFO Status
SDIDAT 0x5A00003F0x5A00003CBR/WSDI Data
SDIIntMsk0x5A000040←WSDI Interrupt Mask
Cautions on S3C2410A Special Registers
1.In the little endian mode, L. endian address must be used. In the big endian mode, B. endian address must be
used.
2.The special registers have to be accessed for each recommended access unit.
3.All registers except ADC registers, RTC registers and UART registers must be read/written in word unit (32-bit)
at little/big endian.
4.Make sure that the ADC registers, RTC registers and UART registers be read/written by the specified access
unit and the specified address. Moreover, one must carefully consider which endian mode is used.
5. W : 32-bit register, which must be accessed by LDR/STR or int type pointer(int *).
HW : 16-bit register, which must be accessed by LDRH/STRH or short int type pointer(short int *).
B : 8-bit register, which must be accessed by LDRB/STRB or char type pointer(char int *).
1-36
Page 67
S3C2410APROGRAMMER'S MODEL
2PROGRAMMER'S MODEL
OVERVIEW
S3C2410A has been developed using the advanced ARM920T core, which has been designed by Advanced RISC
Machines, Ltd.
PROCESSOR OPERATING STATES
From the programmer's point of view, the ARM920T can be in one of two states:
•ARM state which executes 32-bit, word-aligned ARM instructions.
•THUMB state which can execute 16-bit, halfword-aligned THUMB instructions. In this state, the PC uses bit 1 to
select between alternate halfwords.
NOTE
Transition between these two states does not affect the processor mode or the contents of the registers.
SWITCHING STATE
Entering THUMB State
Entry into THUMB state can be achieved by executing a BX instruction with the state bit (bit 0) set in the operand
register.
Transition to THUMB state will also occur automatically on return from an exception (IRQ, FIQ, UNDEF, ABORT,
SWI etc.), if the exception was entered with the processor in THUMB state.
Entering ARM State
Entry into ARM state happens:
• On execution of the BX instruction with the state bit clear in the operand register.
• On the processor taking an exception (IRQ, FIQ, RESET, UNDEF, ABORT, SWI etc.). In this case, the PC is
placed in the exception mode's link register, and execution commences at the exception's vector address.
MEMORY FORMATS
ARM920T views memory as a linear collection of bytes numbered upwards from zero. Bytes 0 to 3 hold the first
stored word, bytes 4 to 7 the second and so on. ARM920T can treat words in memory as being stored either in BigEndian or Little-Endian format.
2-1
Page 68
PROGRAMMER'S MODELS3C2410A
BIG-ENDIAN FORMAT
In Big-Endian format, the most significant byte of a word is stored at the lowest numbered byte and the least
significant byte at the highest numbered byte. Byte 0 of the memory system is therefore connected to data lines 31
through 24.
Higher Address
Lower Address
31
8
4
0
Most significant byte is at lowest address.
Word is addressed by byte address of most significant byte.
23
241516
9
5
1
10
6
2
8 70
11
7
3
Word Address
8
4
0
Figure 2-1. Big-Endian Addresses of Bytes within Words
LITTLE-ENDIAN FORMAT
In Little-Endian format, the lowest numbered byte in a word is considered the word's least significant byte, and the
highest numbered byte the most significant. Byte 0 of the memory system is therefore connected to data lines 7
through 0.
Higher Address
31238 70
241516
Word Address
8
4
0
Lower Address
11
7
3
Least significant byte is at lowest address.
Word is addressed by byte address of least significant byte.
10
6
2
9
5
1
8
4
0
Figure 2-2. Little-Endian Addresses of Bytes within Words
INSTRUCTION LENGTH
Instructions are either 32 bits long (in ARM state) or 16 bits long (in THUMB state).
Data Types
ARM920T supports byte (8-bit), halfword (16-bit) and word (32-bit) data types. Words must be aligned to four-byte
boundaries and half words to two-byte boundaries.
2-2
Page 69
S3C2410APROGRAMMER'S MODEL
OPERATING MODES
ARM920T supports seven modes of operation:
•User (usr): The normal ARM program execution state
•FIQ (fiq): Designed to support a data transfer or channel process
•IRQ (irq): Used for general-purpose interrupt handling
•Supervisor (svc): Protected mode for the operating system
•Abort mode (abt): Entered after a data or instruction prefetch abort
•System (sys): A privileged user mode for the operating system
•Undefined (und): Entered when an undefined instruction is executed
Mode changes may be made under software control, or may be brought about by external interrupts or exception
processing. Most application programs will execute in User mode. The non-user modes' known as privileged modesare entered in order to service interrupts or exceptions, or to access protected resources.
REGISTERS
ARM920T has a total of 37 registers - 31 general-purpose 32-bit registers and six status registers - but these cannot
all be seen at once. The processor state and operating mode dictate which registers are available to the programmer.
The ARM State Register Set
In ARM state, 16 general registers and one or two status registers are visible at any one time. In privileged (nonUser) modes, mode-specific banked registers are switched in. Figure 2-3 shows which registers are available in each
mode: the banked registers are marked with a shaded triangle.
The ARM state register set contains 16 directly accessible registers: R0 to R15. All of these except R15 are generalpurpose, and may be used to hold either data or address values. In addition to these, there is a seventeenth register
used to store status information.
Register 14is used as the subroutine link register. This receives a copy of R15 when a Branch and
Link (BL) instruction is executed. At all other times it may be treated as a generalpurpose register. The corresponding banked registers R14_svc, R14_irq, R14_fiq,
R14_abt and R14_und are similarly used to hold the return values of R15 when
interrupts and exceptions arise, or when Branch and Link instructions are executed
within interrupt or exception routines.
Register 15holds the Program Counter (PC). In ARM state, bits [1:0] of R15 are zero and bits
[31:2] contain the PC. In THUMB state, bit [0] is zero and bits [31:1] contain the PC.
Register 16is the CPSR (Current Program Status Register). This contains condition code flags
and the current mode bits.
FIQ mode has seven banked registers mapped to R8-14 (R8_fiq-R14_fiq). In ARM state, many FIQ handlers do not
need to save any registers. User, IRQ, Supervisor, Abort and Undefined each have two banked registers mapped to
R13 and R14, allowing each of these modes to have a private stack pointer and link registers.
The THUMB state register set is a subset of the ARM state set. The programmer has direct access to eight general
registers, R0-R7, as well as the Program Counter (PC), a stack pointer register (SP), a link register (LR), and the
CPSR. There are banked Stack Pointers, Link Registers and Saved Process Status Registers (SPSRs) for each
privileged mode. This is shown in Figure 2-4.
THUMB State General Registers and Program Counter
System & User
R0
R1
R2
R3
R4
R5
R6
R7
SP
LR
PC
CPSRCPSR
= banked register
FIQ
R0
R1
R2
R3
R4
R5
R6
R7
SP_
LR_
PC
fiq
fiq
SupervisorIRQAbortUndefined
R0
R1
R2
R3
R4
R5
R6
R7
SP_
LR_
PC
svc
svc
R0
R1
R2
R3
R4
R5
R6
R7
SP_
LR_
PC
abt
abt
THUMB State Program Status Registers
SPSR_
fiq
CPSR
SPSR_
svc
CPSR
SPSR_
abt
R0
R1
R2
R3
R4
R5
R6
R7
SP_
LR_
und
PC
CPSR
SPSR_
und
irq
R0
R1
R2
R3
R4
R5
R6
R7
SP_
LR_
fiq
PC
CPSR
SPSR_
fiq
und
Figure 2-4. Register Organization in THUMB state
2-5
Page 72
PROGRAMMER'S MODELS3C2410A
The relationship between ARM and THUMB state registers
The THUMB state registers relate to the ARM state registers in the following way:
• THUMB state R0-R7 and ARM state R0-R7 are identical
• THUMB state CPSR and SPSRs and ARM state CPSR and SPSRs are identical
• THUMB state SP maps onto ARM state R13
• THUMB state LR maps onto ARM state R14
• The THUMB state Program Counter maps onto the ARM state Program Counter (R15)
This relationship is shown in Figure 2-5.
THUMB stateARM state
R0
R1
R2
R3
R4
R5
R6
R7
Stack Pointer (SP)
Link register (LR)
Program Counter (PC)
CPSR
SPSR
Stack Pointer (R13)
Link register (R14)
Program Counter (R15)
R0
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
CPSR
SPSR
Lo-registersHi-registers
Figure 2-5. Mapping of THUMB State Registers onto ARM State Registers
2-6
Page 73
S3C2410APROGRAMMER'S MODEL
Accessing Hi-Registers in THUMB State
In THUMB state, registers R8-R15 (the Hi registers) are not part of the standard register set. However, the assembly
language programmer has limited access to them, and can use them for fast temporary storage.
A value may be transferred from a register in the range R0-R7 (a Lo register) to a Hi register, and from a Hi register to
a Lo register, using special variants of the MOV instruction. Hi register values can also be compared against or
added to Lo register values with the CMP and ADD instructions. For more information, refer to Figure 3-34.
THE PROGRAM STATUS REGISTERS
The ARM920T contains a Current Program Status Register (CPSR), plus five Saved Program Status Registers
(SPSRs) for use by exception handlers. These register's functions are:
•Hold information about the most recently performed ALU operation
•Control the enabling and disabling of interrupts
•Set the processor operating mode
The arrangement of bits is shown in Figure 2-6.
Condition Code Flags
31
3029272826252423876543210
NZCVIFTM4M3M2M1M0
Overflow
Carry/Borrow/Extend
Zero
Negative/Less Than
(Reserved)Control Bits
~
~
~
~
Mode bits
State bit
FIQ disable
IRQ disable
Figure 2-6. Program Status Register Formats
2-7
Page 74
PROGRAMMER'S MODELS3C2410A
The Condition Code Flags
The N, Z, C and V bits are the condition code flags. These may be changed as a result of arithmetic and logical
operations, and may be tested to determine whether an instruction should be executed.
In ARM state, all instructions may be executed conditionally: see Table 3-2 for details.
In THUMB state, only the Branch instruction is capable of conditional execution: see Figure 3-46 for details.
The Control Bits
The bottom 8 bits of a PSR (incorporating I, F, T and M[4:0]) are known collectively as the control bits. These will be
changed when an exception arises. If the processor is operating in a privileged mode, they can also be manipulated
by software.
The T bitThis reflects the operating state. When this bit is set, the processor is executing in THUMB
state, otherwise it is executing in ARM state. This is reflected on the TBIT external signal.
Note that the software must never change the state of the TBIT in the CPSR. If this
happens, the processor will enter an unpredictable state.
Interrupt disable
bits
The I and F bits are the interrupt disable bits. When set, these disable the IRQ and FIQ
interrupts respectively.
The mode bitsThe M4, M3, M2, M1 and M0 bits (M[4:0]) are the mode bits. These determine the
processor's operating mode, as shown in Table 2-1. Not all combinations of the mode bits
define a valid processor mode. Only those explicitly described shall be used. The user
should be aware that if any illegal value is programmed into the mode bits, M[4:0], then the
processor will enter an unrecoverable state. If this occurs, reset should be applied.
Reserved bits
The remaining bits in the PSRs are reserved. When changing a PSR's flag or control bits,
you must ensure that these unused bits are not altered. Also, your program should not rely
on them containing specific values, since in future processors they may read as one or zero.
2-8
Page 75
S3C2410APROGRAMMER'S MODEL
Table 2-1. PSR Mode Bit Values
M[4:0] Mode Visible THUMB state registers Visible ARM state registers
10000 User R7..R0,
LR, SP
PC, CPSR
10001 FIQ R7..R0,
LR_fiq, SP_fiq
PC, CPSR, SPSR_fiq
10010 IRQ R7..R0,
LR_irq, SP_irq
PC, CPSR, SPSR_irq
10011 Supervisor R7..R0,
LR_svc, SP_svc,
PC, CPSR, SPSR_svc
10111 Abort R7..R0,
LR_abt, SP_abt,
PC, CPSR, SPSR_abt
11011 Undefined R7..R0
LR_und, SP_und,
PC, CPSR, SPSR_und
11111 System R7..R0,
LR, SP
PC, CPSR
R14..R0,
PC, CPSR
R7..R0,
R14_fiq..R8_fiq,
PC, CPSR, SPSR_fiq
R12..R0,
R14_irq, R13_irq,
PC, CPSR, SPSR_irq
R12..R0,
R14_svc, R13_svc,
PC, CPSR, SPSR_svc
R12..R0,
R14_abt, R13_abt,
PC, CPSR, SPSR_abt
R12..R0,
R14_und, R13_und,
PC, CPSR
R14..R0,
PC, CPSR
Reserved bits The remaining bits in the PSR's are reserved. When changing a PSR's flag or control bits,
you must ensure that these unused bits are not altered. Also, your program should not rely
on them containing specific values, since in future processors they may read as one or
zero.
2-9
Page 76
PROGRAMMER'S MODELS3C2410A
EXCEPTIONS
Exceptions arise whenever the normal flow of a program has to be halted temporarily, for example to service an
interrupt from a peripheral. Before an exception can be handled, the current processor state must be preserved so
that the original program can resume when the handler routine has finished.
It is possible for several exceptions to arise at the same time. If this happens, they are dealt with in a fixed order.
See Exception Priorities on page 2-14.
Action on Entering an Exception
When handling an exception, the ARM920T:
1.Preserves the address of the next instruction in the appropriate Link Register. If the exception has been entered
from ARM state, then the address of the next instruction is copied into the Link Register (that is, current PC + 4
or PC + 8 depending on the exception. See Table 2-2 on for details). If the exception has been entered from
THUMB state, then the value written into the Link Register is the current PC offset by a value such that the
program resumes from the correct place on return from the exception. This means that the exception handler
need not determine which state the exception was entered from. For example, in the case of SWI, MOVS PC,
R14_svc will always return to the next instruction regardless of whether the SWI was executed in ARM or
THUMB state.
2.Copies the CPSR into the appropriate SPSR
3.Forces the CPSR mode bits to a value which depends on the exception
4.Forces the PC to fetch the next instruction from the relevant exception vector
It may also set the interrupt disable flags to prevent otherwise unmanageable nestings of exceptions.
If the processor is in THUMB state when an exception occurs, it will automatically switch into ARM state when the
PC is loaded with the exception vector address.
Action on Leaving an Exception
On completion, the exception handler:
1.Moves the Link Register, minus an offset where appropriate, to the PC. (The offset will vary depending on the
type of exception.)
2.Copies the SPSR back to the CPSR
3.Clears the interrupt disable flags, if they were set on entry
NOTE
An explicit switch back to THUMB state is never needed, since restoring the CPSR from the SPSR
automatically sets the T bit to the value it held immediately prior to the exception.
2-10
Page 77
S3C2410APROGRAMMER'S MODEL
Exception Entry/Exit Summary
Table 2-2 summarizes the PC value preserved in the relevant R14 on exception entry, and the recommended
instruction for exiting the exception handler.
Table 2-2. Exception Entry/Exit
Return Instruction Previous State Notes
ARM R14_x THUMB R14_x
BL MOV PC, R14 PC + 4 PC + 2 1
SWI MOVS PC, R14_svc PC + 4 PC + 2 1
UDEF MOVS PC, R14_und PC + 4 PC + 2 1
FIQ SUBS PC, R14_fiq, #4 PC + 4 PC + 4 2
IRQ SUBS PC, R14_irq, #4 PC + 4 PC + 4 2
PABT SUBS PC, R14_abt, #4 PC + 4 PC + 4 1
DABT SUBS PC, R14_abt, #8 PC + 8 PC + 8 3
RESET NA – – 4
NOTES:
1. Where PC is the address of the BL/SWI/Undefined Instruction fetch which had the prefetch abort.
2. Where PC is the address of the instruction which did not get executed since the FIQ or IRQ took priority.
3. Where PC is the address of the Load or Store instruction which generated the data abort.
4. The value saved in R14_svc upon reset is unpredictable.
FIQ
The FIQ (Fast Interrupt Request) exception is designed to support a data transfer or channel process, and in ARM
state has sufficient private registers to remove the need for register saving (thus minimizing the overhead of context
switching).
FIQ is externally generated by taking the nFIQ input LOW. This input can except either synchronous or
asynchronous transitions, depending on the state of the ISYNC input signal. When ISYNC is LOW, nFIQ and nIRQ
are considered asynchronous, and a cycle delay for synchronization is incurred before the interrupt can affect the
processor flow.
Irrespective of whether the exception was entered from ARM or Thumb state, a FIQ handler should leave the interrupt
by executing
SUBS PC,R14_fiq,#4
FIQ may be disabled by setting the CPSR's F flag (but note that this is not possible from User mode). If the F flag is
clear, ARM920T checks for a LOW level on the output of the FIQ synchronizer at the end of each instruction.
2-11
Page 78
PROGRAMMER'S MODELS3C2410A
IRQ
The IRQ (Interrupt Request) exception is a normal interrupt caused by a LOW level on the nIRQ input. IRQ has a
lower priority than FIQ and is masked out when a FIQ sequence is entered. It may be disabled at any time by setting
the I bit in the CPSR, though this can only be done from a privileged (non-User) mode.
Irrespective of whether the exception was entered from ARM or Thumb state, an IRQ handler should return from the
interrupt by executing
SUBSPC,R14_irq,#4
Abort
An abort indicates that the current memory access cannot be completed. It can be signaled by the external ABORT
input. ARM920T checks for the abort exception during memory access cycles.
There are two types of abort:
• Prefetch abort: occurs during an instruction prefetch.
• Data abort: occurs during a data access.
If a prefetch abort occurs, the prefetched instruction is marked as invalid, but the exception will not be taken until the
instruction reaches the head of the pipeline. If the instruction is not executed - for example because a branch occurs
while it is in the pipeline - the abort does not take place.
If a data abort occurs, the action taken depends on the instruction type:
• Single data transfer instructions (LDR, STR) write back modified base registers: the Abort handler must be aware
of this.
• The swap instruction (SWP) is aborted as though it had not been executed.
• Block data transfer instructions (LDM, STM) complete. If write-back is set, the base is updated. If the instruction
would have overwritten the base with data (ie it has the base in the transfer list), the overwriting is prevented. All
register overwriting is prevented after an abort is indicated, which means in particular that R15 (always the last
register to be transferred) is preserved in an aborted LDM instruction.
The abort mechanism allows the implementation of a demand paged virtual memory system. In such a system the
processor is allowed to generate arbitrary addresses. When the data at an address is unavailable, the Memory
Management Unit (MMU) signals an abort. The abort handler must then work out the cause of the abort, make the
requested data available, and retry the aborted instruction. The application program needs no knowledge of the
amount of memory available to it, nor is its state in any way affected by the abort.
After fixing the reason for the abort, the handler should execute the following irrespective of the state (ARM or
Thumb):
SUBS PC,R14_abt,#4; for a prefetch abort, or
SUBS PC,R14_abt,#8; for a data abort
This restores both the PC and the CPSR, and retries the aborted instruction.
2-12
Page 79
S3C2410APROGRAMMER'S MODEL
Software Interrupt
The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular
supervisor function. A SWI handler should return by executing the following irrespective of the state (ARM or Thumb):
MOV PC,R14_svc
This restores the PC and CPSR, and returns to the instruction following the SWI.
NOTE
nFIQ, nIRQ, ISYNC, LOCK, BIGEND, and ABORT pins exist only in the ARM920T CPU core.
Undefined Instruction
When ARM920T comes across an instruction which it cannot handle, it takes the undefined instruction trap. This
mechanism may be used to extend either the THUMB or ARM instruction set by software emulation.
After emulating the failed instruction, the trap handler should execute the following irrespective of the state (ARM or
Thumb):
MOVS PC,R14_und
This restores the CPSR and returns to the instruction following the undefined instruction.
Exception Vectors
The following table shows the exception vector addresses.
When multiple exceptions arise at the same time, a fixed priority system determines the order in which they are
handled:
Highest priority:
1.Reset
2.Data abort
3.FIQ
4.IRQ
5.Prefetch abort
Lowest priority:
6.Undefined Instruction, Software interrupt.
Not All Exceptions Can Occur at Once:
Undefined Instruction and Software Interrupt are mutually exclusive, since they each correspond to particular (nonoverlapping) decodings of the current instruction.
If a data abort occurs at the same time as a FIQ, and FIQs are enabled (ie the CPSR's F flag is clear), ARM920T
enters the data abort handler and then immediately proceeds to the FIQ vector. A normal return from FIQ will cause
the data abort handler to resume execution. Placing data abort at a higher priority than FIQ is necessary to ensure
that the transfer error does not escape detection. The time for this exception entry should be added to worst-case
FIQ latency calculations.
2-14
Page 81
S3C2410APROGRAMMER'S MODEL
INTERRUPT LATENCIES
The worst case latency for FIQ, assuming that it is enabled, consists of the longest time the request can take to
pass through the synchronizer (Tsyncmax if asynchronous), plus the time for the longest instruction to complete
(Tldm, the longest instruction is an LDM which loads all the registers including the PC), plus the time for the data
abort entry (Texc), plus the time for FIQ entry (Tfiq). At the end of this time ARM920T will be executing the
instruction at 0x1C.
Tsyncmax is 3 processor cycles, Tldm is 20 cycles, Texc is 3 cycles, and Tfiq is 2 cycles. The total time is
therefore 28 processor cycles. This is just over 1.4 microseconds in a system which uses a continuous 20 MHz
processor clock. The maximum IRQ latency calculation is similar, but must allow for the fact that FIQ has higher
priority and could delay entry into the IRQ handling routine for an arbitrary length of time. The minimum latency for
FIQ or IRQ consists of the shortest time the request can take through the synchronizer (Tsyncmin) plus Tfiq. This is
4 processor cycles.
RESET
When the nRESET signal goes LOW, ARM920T abandons the executing instruction and then continues to fetch
instructions from incrementing word addresses.
When nRESET goes HIGH again, ARM920T:
1.Overwrites R14_svc and SPSR_svc by copying the current values of the PC and CPSR into them. The value of
the saved PC and SPSR is not defined.
2.Forces M[4:0] to 10011 (Supervisor mode), sets the I and F bits in the CPSR, and clears the CPSR's T bit.
3.Forces the PC to fetch the next instruction from address 0x00.
4.Execution resumes in ARM state.
2-15
Page 82
PROGRAMMER'S MODELS3C2410A
NOTES
2-16
Page 83
S3C2410AARM INSTRUCTION SET
Coprocessor Register Transfer
3ARM INSTRUCTION SET
INSTRUCTION SET SUMMAY
This chapter describes the ARM instruction set in the ARM920T core.
Some instruction codes are not defined but do not cause the Undefined instruction trap to be taken, for
instance a Multiply instruction with bit 6 changed to a 1. These instructions should not be used, as their
action may change in future ARM implementations.
INSTRUCTION SUMMARY
Table 3-1. The ARM Instruction Set
MnemonicInstructionAction
ADCAdd with carryRd: = Rn + Op2 + Carry
ADDAddRd: = Rn + Op2
ANDANDRd: = Rn AND Op2
BBranchR15: = address
BICBit ClearRd: = Rn AND NOT Op2
BLBranch with LinkR14: = R15, R15: = address
BXBranch and ExchangeR15: = Rn, T bit: = Rn[0]
CDPCoprocessor Data Processing(Coprocessor-specific)
CMNCompare NegativeCPSR flags: = Rn + Op2
CMPCompareCPSR flags: = Rn - Op2
EORExclusive ORRd: = (Rn AND NOT Op2)
OR (Op2 AND NOT Rn)
LDCLoad coprocessor from memoryCoprocessor load
LDMLoad multiple registersStack manipulation (Pop)
LDRLoad register from memoryRd: = (address)
MCRMove CPU register to coprocessor
CPU register
MRSMove PSR status/flags to registerRn: = PSR
MSRMove register to PSR status/flagsPSR: = Rm
MULMultiplyRd: = Rm × Rs
MVNMove negative registerRd: = 0 × FFFFFFFF EOR Op2
ORRORRd: = Rn OR Op2
RSBReverse SubtractRd: = Op2 - Rn
RSCReverse Subtract with CarryRd: = Op2 - Rn - 1 + Carry
SBCSubtract with CarryRd: = Rn - Op2 - 1 + Carry
STCStore coprocessor register to memoryaddress: = CRn
STMStore MultipleStack manipulation (Push)
STRStore register to memory<address>: = Rd
SUBSubtractRd: = Rn - Op2
SWISoftware InterruptOS call
SWPSwap register with memoryRd: = [Rn], [Rn] := Rm
TEQTest bitwise equalityCPSR flags: = Rn EOR Op2
TSTTest bitsCPSR flags: = Rn AND Op2
3-3
Page 86
ARM INSTRUCTION SET S3C2410A
THE CONDITION FIELD
In ARM state, all instructions are conditionally executed according to the state of the CPSR condition codes and the
instruction's condition field. This field (bits 31:28) determines the circumstances under which an instruction is to be
executed. If the state of the C, N, Z and V flags fulfils the conditions encoded by the field, the instruction is
executed, otherwise it is ignored.
There are sixteen possible conditions, each represented by a two-character suffix that can be appended to the
instruction's mnemonic. For example, a Branch (B in assembly language) becomes BEQ for "Branch if Equal", which
means the Branch will only be taken if the Z flag is set.
In practice, fifteen different conditions may be used: these are listed in Table 3-2. The sixteenth (1111) is reserved,
and must not be used.
In the absence of a suffix, the condition field of most instructions is set to "Always" (suffix AL). This means the
instruction will always be executed regardless of the CPSR condition codes.
Table 3-2. Condition Code Summary
CodeSuffixFlagsMeaning
0000EQZ setequal
0001NEZ clearnot equal
0010CSC setunsigned higher or same
0011CCC clearunsigned lower
0100MIN setnegative
0101PLN clearpositive or zero
0110VSV setoverflow
0111VCV clearno overflow
1000HIC set and Z clearunsigned higher
1001LSC clear or Z setunsigned lower or same
1010GEN equals Vgreater or equal
1011LTN not equal to Vless than
1100GTZ clear AND (N equals V)greater than
1101LEZ set OR (N not equal to V)less than or equal
1110AL(ignored)always
3-4
Page 87
S3C2410AARM INSTRUCTION SET
BRANCH AND EXCHANGE (BX)
This instruction is only executed if the condition is true. The various conditions are defined in Table 3-2.
This instruction performs a branch by copying the contents of a general register, Rn, into the program counter, PC.
The branch causes a pipeline flush and refill from the address specified by Rn. This instruction also permits the
instruction set to be exchanged. When the instruction is executed, the value of Rn[0] determines whether the
instruction stream will be decoded as ARM or THUMB instructions.
31242719158 70
2816111223204 3
00 0110 0011 1111 1111 1100 01CondRn
[3:0] Operand Register
If bit0 of Rn = 1, subsequent instructions decoded as THUMB instructions
If bit0 of Rn =0, subsequent instructions decoded as ARM instructions
[31:28] Condition Field
Figure 3-2. Branch and Exchange Instructions
INSTRUCTION CYCLE TIMES
The BX instruction takes 2S + 1N cycles to execute, where S and N are defined as sequential (S-cycle) and nonsequential (N-cycle), respectively.
ASSEMBLER SYNTAX
BX - branch and exchange.
BX {cond} Rn
{cond}Two character condition mnemonic. See Table 3-2.
Rnis an expression evaluating to a valid register number.
USING R15 AS AN OPERAND
If R15 is used as an operand, the behavior is undefined.
; and set bit 0 high - hence
; arrive in THUMB state.
BXR0; Branch and change to THUMB
; state.
CODE16; Assemble subsequent code as
Into_THUMB; THUMB instructions
•
•
•
ADR R5, Back_to_ARM; Generate branch target to word aligned address
; - hence bit 0 is low and so change back to ARM state.
BX R5; Branch and change back to ARM state.
•
•
•
ALIGN; Word align
CODE32; Assemble subsequent code as ARM instructions
Back_to_ARM
3-6
Page 89
S3C2410AARM INSTRUCTION SET
BRANCH AND BRANCH WITH LINK (B, BL)
The instruction is only executed if the condition is true. The various conditions are defined Table 3-2. The instruction
encoding is shown in Figure 3-3, below.
312427
2823
CondOffset
25
101L
0
[24] Link bit
0 = Branch1 = Branch with link
[31:28] Condition Field
Figure 3-3. Branch Instructions
Branch instructions contain a signed 2's complement 24-bit offset. This is shifted left two bits, sign extended to 32
bits, and added to the PC. The instruction can therefore specify a branch of +/- 32Mbytes. The branch offset must
take account of the prefetch operation, which causes the PC to be 2 words (8 bytes) ahead of the current instruction.
Branches beyond +/- 32Mbytes must use an offset or absolute destination which has been previously loaded into a
register. In this case the PC should be manually saved in R14 if a Branch with Link type operation is required.
THE LINK BIT
Branch with Link (BL) writes the old PC into the link register (R14) of the current bank. The PC value written into R14
is adjusted to allow for the prefetch, and contains the address of the instruction following the branch and link
instruction. Note that the CPSR is not saved with the PC and R14[1:0] are always cleared.
To return from a routine called by Branch with Link use MOV PC,R14 if the link register is still valid or LDM
Rn!,{..PC} if the link register has been saved onto a stack pointed to by Rn.
INSTRUCTION CYCLE TIMES
Branch and Branch with Link instructions take 2S + 1N incremental cycles, where S and N are defined as sequential
(S-cycle) and internal (I-cycle).
3-7
Page 90
ARM INSTRUCTION SET S3C2410A
ASSEMBLER SYNTAX
Items in {} are optional. Items in <> must be present.
B{L}{cond} <expression>
{L} Used to request the Branch with Link form of the instruction. If absent, R14 will not be
affected by the instruction.
{cond} A two-character mnemonic as shown in Table 3-2. If absent then AL (ALways) will be
used.
<expression> The destination. The assembler calculates the offset.
Examples
hereBALhere; Assembles to 0xEAFFFFFE (note effect of PC offset).
Bthere; Always condition used as default.
CMP R1,#0 ; Compare R1 with zero and branch to fred
; if R1 was zero, otherwise continue.
BEQ fred; Continue to next instruction.
BL sub+ROM; Call subroutine at computed address.
ADDS R1,#1; Add 1 to register 1, setting CPSR flags
; on the result then call subroutine if
BLCC sub; the C flag is clear, which will be the
; case unless R1 held 0xFFFFFFFF.
3-8
Page 91
S3C2410AARM INSTRUCTION SET
DATA PROCESSING
The data processing instruction is only executed if the condition is true. The conditions are defined in Table 3-2. The
instruction encoding is shown in Figure 3-4.
3124271915
2816111221
26 25
CondOperand2
00L20OpCodeSRnRd
[15:12] Destination register
0 = Branch1 = Branch with link
[19:16] 1st operand register
0 = Branch1 = Branch with link
[20] Set condition codes
0 = Do not after condition codes1 = Set condition codes
0 = Operand 2 is a register1 = Operand 2 is an immediate value
[11:0] Operand 2 type selection
31104
Shift
[3:0] 2nd operand register[11:4] Shift applied to Rm
81107
Rotate
[7:0] Unsigned 8 bit immediate value[11:8] Shift applied to Imm
Imm
Rm
[31:28] Condition field
Figure 3-4. Data Processing Instructions
3-9
Page 92
ARM INSTRUCTION SET S3C2410A
The instruction produces a result by performing a specified arithmetic or logical operation on one or two operands.
The first operand is always a register (Rn).
The second operand may be a shifted register (Rm) or a rotated 8 bit immediate value (Imm) according to the value of
the I bit in the instruction. The condition codes in the CPSR may be preserved or updated as a result of this
instruction, according to the value of the S bit in the instruction.
Certain operations (TST, TEQ, CMP, CMN) do not write the result to Rd. They are used only to perform tests and to
set the condition codes on the result and always have the S bit set. The instructions and their effects are listed in
Table 3-3.
3-10
Page 93
S3C2410AARM INSTRUCTION SET
CPSR FLAGS
The data processing operations may be classified as logical or arithmetic. The logical operations (AND, EOR, TST,
TEQ, ORR, MOV, BIC, MVN) perform the logical action on all corresponding bits of the operand or operands to
produce the result. If the S bit is set (and Rd is not R15, see below) the V flag in the CPSR will be unaffected, the C
flag will be set to the carry out from the barrel shifter (or preserved when the shift operation is LSL #0), the Z flag will
be set if and only if the result is all zeros, and the N flag will be set to the logical value of bit 31 of the result.
TEQ1001As EOR, but result is not written
CMP1010As SUB, but result is not written
CMN1011As ADD, but result is not written
ORR1100Operand1 OR operand2
MOV1101Operand2 (operand1 is ignored)
BIC1110Operand1 AND NOT operand2 (Bit clear)
MVN1111NOT operand2 (operand1 is ignored)
The arithmetic operations (SUB, RSB, ADD, ADC, SBC, RSC, CMP, CMN) treat each operand as a 32 bit integer
(either unsigned or 2's complement signed, the two are equivalent). If the S bit is set (and Rd is not R15) the V flag in
the CPSR will be set if an overflow occurs into bit 31 of the result; this may be ignored if the operands were
considered unsigned, but warns of a possible error if the operands were 2's complement signed. The C flag will be
set to the carry out of bit 31 of the ALU, the Z flag will be set if and only if the result was zero, and the N flag will be
set to the value of bit 31 of the result (indicating a negative result if the operands are considered to be 2's
complement signed).
3-11
Page 94
ARM INSTRUCTION SET S3C2410A
SHIFTS
When the second operand is specified to be a shifted register, the operation of the barrel shifter is controlled by the
Shift field in the instruction. This field indicates the type of shift to be performed (logical left or right, arithmetic right or
rotate right). The amount by which the register should be shifted may be contained in an immediate field in the
instruction, or in the bottom byte of another register (other than R15). The encoding for the different shift types is
shown in Figure 3-5.
456711
0
[6:5] Shift type
00 = logical left 01 = logical right
10 = arithmetic right 11 = rotate right
[11:7] Shift amount
5 bit unsigned integer
0RS
[6:5] Shift type
00 = logical left 01 = logical right
10 = arithmetic right 11 = rotate right
[11:8] Shift register
Shift amount specified in bottom-byte of Rs
4567118
1
Figure 3-5. ARM Shift Operations
Instruction specified shift amount
When the shift amount is specified in the instruction, it is contained in a 5-bit field which may take any value from 0
to 31. A logical shift left (LSL) takes the contents of Rm and moves each bit by the specified amount to a more
significant position. The least significant bits of the result are filled with zeros, and the high bits of Rm which do not
map into the result are discarded, except that the least significant discarded bit becomes the shifter carry output
which may be latched into the C bit of the CPSR when the ALU operation is in the logical class (see above). For
example, the effect of LSL #5 is shown in Figure 3-6.
3127 26
Contents of Rm
carry out
Value of Operand 2
Figure 3-6. Logical Shift Left
NOTE
LSL #0 is a special case, where the shifter carry out is the old value of the CPSR C flag. The contents of Rm
are used directly as the second operand. A logical shift right (LSR) is similar, but the contents of Rm are
moved to less significant positions in the result. LSR #5 has the effect shown in Figure 3-7.
3-12
000000
Page 95
S3C2410AARM INSTRUCTION SET
31
45
Contents of Rm
00000
Value of Operand 2
0
carry out
Figure 3-7. Logical Shift Right
The form of the shift field which might be expected to correspond to LSR #0 is used to encode LSR #32, which has a
zero result with bit 31 of Rm as the carry output. Logical shift right zero is redundant as it is the same as logical shift
left zero, so the assembler will convert LSR #0 (and ASR #0 and ROR #0) into LSL #0, and allow LSR #32 to be
specified.
An arithmetic shift right (ASR) is similar to logical shift right, except that the high bits are filled with bit 31 of Rm
instead of zeros. This preserves the sign in 2's complement notation. For example, ASR #5 is shown in Figure
3-8.
31
4530
Contents of Rm
Value of Operand 2
0
carry out
Figure 3-8. Arithmetic Shift Right
The form of the shift field which might be expected to give ASR #0 is used to encode ASR #32. Bit 31 of Rm is again
used as the carry output, and each bit of operand 2 is also equal to bit 31 of Rm. The result is therefore all ones or
all zeros, according to the value of bit 31 of Rm.
3-13
Page 96
ARM INSTRUCTION SET S3C2410A
Rotate right (ROR) operations reuse the bits which "overshoot" in a logical shift right operation by reintroducing them
at the high end of the result, in place of the zeros used to fill the high end in logical right operations. For example,
ROR #5 is shown in Figure 3-9.
31
45
Contents of Rm
Value of Operand 2
0
carry out
Figure 3-9. Rotate Right
The form of the shift field which might be expected to give ROR #0 is used to encode a special function of the barrel
shifter, rotate right extended (RRX). This is a rotate right by one bit position of the 33 bit quantity formed by
appending the CPSR C flag to the most significant end of the contents of Rm as shown in Figure 3-10.
31
Contents of Rm
C
in
01
carry out
3-14
Value of Operand 2
Figure 3-10. Rotate Right Extended
Page 97
S3C2410AARM INSTRUCTION SET
Register Specified Shift Amount
Only the least significant byte of the contents of Rs is used to determine the shift amount. Rs can be any general
register other than R15.
If this byte is zero, the unchanged contents of Rm will be used as the second operand, and the old value of the
CPSR C flag will be passed on as the shifter carry output.
If the byte has a value between 1 and 31, the shifted result will exactly match that of an instruction specified shift
with the same value and shift operation.
If the value in the byte is 32 or more, the result will be a logical extension of the shift described above:
1.LSL by 32 has result zero, carry out equal to bit 0 of Rm.
2.LSL by more than 32 has result zero, carry out zero.
3.LSR by 32 has result zero, carry out equal to bit 31 of Rm.
4.LSR by more than 32 has result zero, carry out zero.
5.ASR by 32 or more has result filled with and carry out equal to bit 31 of Rm.
6.ROR by 32 has result equal to Rm, carry out equal to bit 31 of Rm.
7.ROR by n where n is greater than 32 will give the same result and carry out as ROR by n-32; therefore
repeatedly subtract 32 from n until the amount is in the range 1 to 32 and see above.
NOTE
The zero in bit 7 of an instruction with a register controlled shift is compulsory; a one in this bit will cause
the instruction to be a multiply or undefined instruction.
3-15
Page 98
ARM INSTRUCTION SET S3C2410A
IMMEDIATE OPERAND ROTATES
The immediate operand rotate field is a 4-bit unsigned integer which specifies a shift operation on the 8-bit immediate
value. This value is zero extended to 32 bits, and then subject to a rotate right by twice the value in the rotate field.
This enables many common constants to be generated, for example all powers of 2.
WRITING TO R15
When Rd is a register other than R15, the condition code flags in the CPSR may be updated from the ALU flags as
described above.
When Rd is R15 and the S flag in the instruction is not set the result of the operation is placed in R15 and the CPSR
is unaffected.
When Rd is R15 and the S flag is set the result of the operation is placed in R15 and the SPSR corresponding to the
current mode is moved to the CPSR. This allows state changes which atomically restore both PC and CPSR. This
form of instruction should not be used in User mode.
USING R15 AS AN OPERANDY
If R15 (the PC) is used as an operand in a data processing instruction the register is used directly.
The PC value will be the address of the instruction, plus 8 or 12 bytes due to instruction prefetching. If the shift
amount is specified in the instruction, the PC will be 8 bytes ahead. If a register is used to specify the shift amount
the PC will be 12 bytes ahead.
TEQ, TST, CMP AND CMN OPCODES
NOTE
TEQ, TST, CMP and CMN do not write the result of their operation but do set flags in the CPSR. An
assembler should always set the S flag for these instructions even if this is not specified in the mnemonic.
The TEQP form of the TEQ instruction used in earlier ARM processors must not be used: the PSR transfer
operations should be used instead.
The action of TEQP in the ARM920T is to move SPSR_<mode> to the CPSR if the processor is in a privileged mode
and to do nothing if in User mode.
INSTRUCTION CYCLE TIMES
Data Processing instructions vary in the number of incremental cycles taken as follows:
Table 3-4. Incremental Cycle Times
Processing TypeCycles
Normal data processing1S
Data processing with register specified shift1S + 1I
Data processing with PC written2S + 1N
Data processing with register specified shift and PC written2S + 1N +1I
NOTE:S, N and I are as defined sequential (S-cycle), non-sequential (N-cycle), and internal (I-cycle) respectively.
3-16
Page 99
S3C2410AARM INSTRUCTION SET
ASSEMBLER SYNTAX
•MOV,MVN (single operand instructions).
<opcode>{cond}{S} Rd,<Op2>
•CMP,CMN,TEQ,TST (instructions which do not produce a result).
<opcode>{cond} Rn,<Op2>
•AND,EOR,SUB,RSB,ADD,ADC,SBC,RSC,ORR,BIC
<opcode>{cond}{S} Rd,Rn,<Op2>
where:
<Op2>Rm{,<shift>} or,<#expression>
{cond}A two-character condition mnemonic. See Table 3-2.
{S}Set condition codes if S present (implied for CMP, CMN, TEQ, TST).
Rd, Rn and Rm Expressions evaluating to a register number.
<#expression>If this is used, the assembler will attempt to generate a shifted immediate 8-bit field to
match the expression. If this is impossible, it will give an error.
<shift><Shiftname> <register> or <shiftname> #expression, or RRX (rotate right one bit with
extend).
<shiftname>sASL, LSL, LSR, ASR, ROR. (ASL is a synonym for LSL, they assemble to the same
code.)
EXAMPLES
ADDEQR2,R4,R5; If the Z flag is set make R2:=R4+R5
TEQSR4,#3; Test R4 for equality with 3.
; (The S is in fact redundant as the
; assembler inserts it automatically.)
SUBR4,R5,R7,LSR R2; Logical right shift R7 by the number in
; the bottom byte of R2, subtract result
; from R5, and put the answer into R4.
MOVPC,R14; Return from subroutine.
MOVSPC,R14; Return from exception and restore CPSR
; from SPSR_mode.
3-17
Page 100
ARM INSTRUCTION SET S3C2410A
PSR TRANSFER (MRS, MSR)
The instruction is only executed if the condition is true. The various conditions are defined in Table 3-2.
The MRS and MSR instructions are formed from a subset of the Data Processing operations and are implemented
using the TEQ, TST, CMN and CMP instructions without the S flag set. The encoding is shown in Figure 3-11.
These instructions allow access to the CPSR and SPSR registers. The MRS instruction allows the contents of the
CPSR or SPSR_<mode> to be moved to a general register. The MSR instruction allows the contents of a general
register to be moved to the CPSR or SPSR_<mode> register.
The MSR instruction also allows an immediate value or register contents to be transferred to the condition code flags
(N,Z,C and V) of CPSR or SPSR_<mode> without affecting the control bits. In this case, the top four bits of the
specified register contents or 32 bit immediate value are written to the top four bits of the relevant PSR.
OPERAND RESTRICTIONS
•In user mode, the control bits of the CPSR are protected from change, so only the condition code flags of the
CPSR can be changed. In other (privileged) modes the entire CPSR can be changed.
•Note that the software must never change the state of the T bit in the CPSR. If this happens, the processor will
enter an unpredictable state.
•The SPSR register which is accessed depends on the mode at the time of execution. For example, only
SPSR_fiq is accessible when the processor is in FIQ mode.
•You must not specify R15 as the source or destination register.
•Also, do not attempt to access an SPSR in User mode, since no such register exists.
3-18
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.