ColdFire Core
Hardware Multiply/Accumulate (MAC) Unit
Local Memory
Debug Support
System Integration Module (SIM)
Interrupt Controller
Chip-Select Module
SDRAM Controller
DMA Controller Module
Ethernet Module
Universal Serial Bus (USB)
Physical Layer Interface Controller (PLIC)
14
15
16
17
18
19
20
21
22
23
A
B
Queued Serial Peripheral Interface (QSPI) Module
Timer Module
UART Modules
General-Purpose I/O Module
Pulse-Width Modulation (PWM) Module
Signal Descriptions
Bus Operation
IEEE 1149.1 Test Access Port (JTAG)
Mechanical Data
Electrical Characteristics
Appendix A: List of Memory Maps
Appendix B: Buffering and Impedence Matching
19.1MCF5272 Block Diagram with Signal Interfaces ..................................................................... 19-1
19.2Signal List .................................................................................................................................. 19-3
19.3Address Bus (A[22:0]/SDA[13:0]) .......................................................................................... 19-19
19.4Data Bus (D[31:0]) .................................................................................................................. 19-19
19.4.1Dynamic Data Bus Sizing ............................................................................................ 19-19
To provide the most up-to-date information, the revision of our documents on the World Wide Web will
be the most current. Y our printed copy may be an earlier revision. T o ve rify you have the latest information
available, refer to:
http://www.freescale.com/
The following revision history table summarizes changes contained in this document. For your
convenience, the page number designators have been linked to the appropriate location.
Document Revision History
Rev. No.Substantive Change(s)
2.1Updated to meet Freescale identity guidelines.
3 • Formatting, layout, spelling, and grammar corrections.
• Corrected the TxFIFO bit description In Table 16-9 (was “Once set, this bit is cleared by reading
UTBn”, is “After being set, this bit is cleared by writing UTBn”).
• Corrected Figure 20-12 (OE
second SDCLK clock cycle).
• Corrected Figure 20-13 (R/W
asserting on the second SDCLK clock cycle).
• Corrected Figure 20-16 (OE
second SDCLK clock cycle).
• Corrected Figure 20-17 (R/W
asserting on the second SDCLK clock cycle).
signal was asserting on the third SDCLK clock cycle, is asserting on the
and BS signals were asserting on the third SDCLK clock cycle, are
signal was asserting on the third SDCLK clock cycle, is asserting on the
and BS signals were asserting on the third SDCLK clock cycle, are
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
The primary objective of this user’s manual is to define the functionality of the MCF5272 processors for
use by software and hardware developers.
The information in this book is subject to change without notice, as described in the disclaimers on the title
page of this book. As with any technical documentation, it is the readers’ responsibility to be sure he is
using the most recent version of the documentation.
To locate any published errata or updates for this document, refer to the world-wide web at
http://www.freescale.com.
Audience
This manual is intended for system software and hardware developers and applications programmers who
want to develop products with the MCF5272. It is assumed that the reader understands operating systems,
microprocessor system design, basic principles of software and hardware, and basic details of the
ColdFire® architecture.
Organization
Following is a summary and brief description of the major sections of this manual:
•Chapter 1, “Overview,” includes general descriptions of the modules and features incorporated in
the MCF5272, focussing in particular on new features.
•Chapter 2, “ColdFire Core,” provides an overview of the microprocessor core of the MCF5272.
The chapter describes the organization of the Version 2 (V2) ColdFire 5200 processor core and an
overview of the program-visible registers (the programming model) as they are implemented on
the MCF5272. It also includes a full description of exception handling and a table of instruction
timings.
•Chapter 3, “Hardware Multiply/Accumulate (MAC) Unit,” describes the MCF5272
multiply/accumulate unit, which executes integer multiply, multiply-accumulate, and
miscellaneous register instructions. The MAC is integrated into the operand execution pipeline
(OEP).
•Chapter 4, “Local Memory.” This chapter describes the MCF5272 implementation of the ColdFire
V2 local memory specification. It consists of three major sections, as follows.
implementation. It covers general operations, configuration, and initialization. It also provides
information and examples of how to minimize power consumption when using the SRAM.
— Section 4.4, “ROM Overview,” describes the MCF5272 on-chip static ROM. The ROM
module contains tabular data that the ColdFire core can access in a single cycle.
•Chapter 5, “Debug Support,” describes the Revision A hardware debug support in the MCF5272.
•Chapter 6, “System Integration Module (SIM),” describes the SIM programming model, bus
arbitration, power management, and system-protection functions for the MCF5272.
•Chapter 7, “Interrupt Controller,” describes operation of the interrupt controller portion of the SIM.
Includes descriptions of the registers in the interrupt controller memory map and the interrupt
priority scheme.
•Chapter 8, “Chip Select Module,” describes the MCF5272 chip-select implementation, including
the operation and programming model, which includes the chip-select address, mask, and control
registers.
•Chapter 9, “SDRAM Controller,” describes configuration and operation of the synchronous
DRAM controller component of the SIM, including a general description of signals involved in
SDRAM operations. It provides interface information for memory configurations using most
common SDRAM devices for both 16- and 32-bit-wide data buses. The chapter concludes with
signal timing diagrams.
•Chapter 10, “DMA Controller,” provides an overview of the MCF5272’s one-channel DMA
controller intended for memory-to-memory block data transfers. This chapter describes in detail its
signals, registers, and operating modes.
•Chapter 11, “Ethernet Module,” describes the MCF5272 fast Ethernet media access controller
(MAC). This chapter begins with a feature-set overview, a functional block diagram, and
transceiver connection information for both MII and seven-wire serial interfaces. The chapter
concludes with detailed descriptions of operation and the programming model.
•Chapter 12, “Universal Serial Bus (USB),” provides an overview of the USB module of the
MCF5272, including detailed operation information and the USB programming model.
Connection examples and circuit board layout considerations are also provided.
•The USB Specification, Revision 1.1 is a recommended supplement to this chapter. It can be
downloaded from http://www.usb.org. Chapter 2 of this specification, Terms and Abbreviations,
provides definitions of many of the words found here.
•Chapter 13, “Physical Layer Interface Controller (PLIC),” provides detailed information about the
MCF5272’s physical layer interface controller, a module intended to support ISDN applications.
The chapter begins with a description of operation and a series of related block diagrams starting
with a high-level overview. Each successive diagram depicts progressively more internal detail.
The chapter then describes timing generation and the programming model and concludes with
three application examples.
•Chapter 14, “Queued Serial Peripheral Interface (QSPI) Module,” provides a feature-set overview
and description of operation, including details of the QSPI’s internal RAM organization. The
chapter concludes with the programming model and a timing diagram.
•Chapter 15, “Timer Module,” describes configuration and operation of the four general-purpose
timer modules, timer 0, 1, 2 and 3.
•Chapter 16, “UART Modules,” describes the use of the universal asynchronous/synchronous
receiver/transmitters (UARTs) implemented on the MCF5272, including example register values
for typical configurations.
•Chapter 17, “General Purpose I/O Module,” describes the operation and programming model of
the three general purpose I/O (GPIO) ports on the MCF5272. The chapter details pin assignment,
direction-control, and data registers.
•Chapter 18, “Pulse-Width Modulation (PWM) Module,” describes the configuration and operation
of the pulse-width modulation (PWM) module. It includes a block diagram, programming model,
and timing diagram.
•Chapter 19, “Signal Descriptions,” provides a listing and brief description of all the MCF5272
signals. Specifically , it shows which are inputs or outputs, how they are multiplexed, and the state
of each signal at reset. The first listing is organized by function, with signals appearing
alphabetically within each functional group. This is followed by a second listing sorted by pin
number.
•Chapter 20, “Bus Operation,” describes the functioning of the bus for data-transfer operations,
error conditions, bus arbitration, and reset operations. It includes detailed timing diagrams showing
signal interaction. Operation of the bus is defined for transfers initiated by the MCF5272 as a bus
master. The MCF5272 does not support external bus masters. Note that Chapter 9, “SDRAM
Controller,” describes DRAM cycles.
•Chapter 21, “IEEE 1149.1 T est Access Port (JTAG),” describes configuration and operation of the
MCF5272 Joint Test Action Group (JTAG) implementation. It describes those items required by
the IEEE 1149.1 standard and provides additional information specific to the MCF5272. For
internal details and sample applications, see the IEEE 1149.1 document.
•Chapter 22, “Mechanical Data,” provides a functional pin listing and package diagram for the
MCF5272.
•Chapter 23, “Electrical Characteristics,” describes AC and DC electrical specifications and
thermal characteristics for the MCF5272. Because additional speeds may have become available
since the publication of this book, consult Freescale’s ColdFire web page,
http://www.freescale.com, to confirm that this is the latest information.
This manual includes the following two appendixes:
•Appendix A, “List of Memory Maps,” provides the entire address-map for MCF5272
memory-mapped registers.
•Appendix B, “Buffering and Impedance Matching,” provides some suggestions regarding
interface circuitry between the MCF5272 and SDRAMs.
This section lists additional reading that provides background for the information in this manual as well as
general information about the ColdFire architecture.
General Information
The following documentation provides useful information about the Cold
This document uses the following notational conventions:
MNEMONICSIn text, instruction mnemonics are shown in uppercase.
mnemonicsIn code and tables, instruction mnemonics are shown in lowercase.
italicsItalics indicate variable command parameters.
Book titles in text are set in italics.
0x0Prefix to denote hexadecimal number
0b0Prefix to denote binary number
REG[FIELD]Abbreviations for registers are shown in uppercase. Specific bits, fields, or ranges
appear in brackets. For example, RAMBAR[BA] identifies the base address field
in the RAM base address register.
nibble A 4-bit data unit
byte An 8-bit data unit
word A 16-bit data unit
longword A 32-bit data unit
xIn some contexts, such as signal encodings, x indicates a don’t care.
nUsed to express an undefined numerical value
<ea>y,<ea>xSource and destination effective addresses, respectively
<label>Assembly language program label
<list>List of registers for MOVEM instruction (example: D3–D0)
<shift>Shift operation: shift left (<<), shift right (>>)
<size>Operand data size: byte (B), word (W), longword (L)
bcBoth instruction and data caches
dcData cache
icInstruction cache
# <vector>Identifies the 4-bit vector number for trap instructions
<>identifies an indirect data address referencing memory
<xxx>identifies an absolute address referencing memory
dnSignal displacement value, n bits wide (example: d16 is a 16-bit displacement)
SFScale factor (x1, x2, x4 for indexed addressing mode, <<1n>> for MAC operations)
Operations
+Arithmetic addition or postincrement indicator
–Arithmetic subtraction or predecrement indicator
xArithmetic multiplication
/Arithmetic division
~Invert; operand is logically complemented
&Logical AND
|Logical OR
^Logical exclusive OR
<<Shift left (example: D0 << 3 is shift D0 left 3 bits)
>>Shift right (example: D0 >> 3 is shift D0 right 3 bits)
→Source operand is moved to destination operand
←→Two operands are exchanged
sign-extendedAll bits of the upper portion are made equal to the high-order bit of the lower portion
If <condition>
then <operations>
else <operations>
Test the condition. If true, the operations after ‘then’ are performed. If the condition is false and the optional
‘else’ clause is present, the operations after ‘else’ are performed. If the condition is false and else is
omitted, the instruction performs no operation. Refer to the Bcc instruction description as an example.
Register identifiers in this user’s manual were changed from names used in early versions of the manual
released under non-disclosure agreement (NDA). Because a significant amount of collateral
documentation, such as source code, was developed using the old register names, Table iii through
Table xvi list the new register names and mnemonics as they should appear in the data book, along with
the old ones. Identifiers that have changed are displayed in boldface type. Those that have not changed are
marked “no change” in the ‘New Mnemonic’ column.
Table iii. On-Chip Peripherals and Configuration Registers Memory Map
MBAR
Offset
0x0000Module Base Address Register, Read Only MBARNo change
0x10CEUSB Endpoint 0 Data Present Register USBEPDP0EP0DPR
0x10D2USB Endpoint 1 Data Present Register USBEPDP1EP1DPR
0x10D6USB Endpoint 2 Data Present Register USBEPDP2EP2DPR
0x10DAUSB Endpoint 3 Data Present RegisterUSBEPDP3EP3DPR
0x10DEUSB Endpoint 4 Data Present Register USBEPDP4EP4DPR
0x10E2USB Endpoint 5 Data Present Register USBEPDP5EP5DPR
0x10E6USB Endpoint 6 Data Present Register USBEPDP6EP6DPR
0x10EAUSB Endpoint 7 Data Present Register USBEPDP7EP7DPR
0x1400–
0x17FF
USB Configuration RAM, 1 K Bytes USB_CFG_RAMNo change
NOTE
The MBAR Offset column corresponds to the tables found in Appendix A,
“List of Memory Maps.” 16- and/or 8-bit wide registers may be offset by 0,
1, 2, or 3 bytes from the offset address shown above. Refer to the
appropriate discussions in this document for actual positioning of 16- or
8-bit registers in a 32-bit long word.
This chapter provides an overview of the MCF5272 microprocessor features, including the major
functional components.
1.1MCF5272 Key Features
A block diagram of the MCF5272 is shown in Figure 1-1. The main features are as follows:
•Static Version 2 ColdFire variable-length RISC processor
— 32-bit address and data path on-chip
— 66-MHz processor core and bus frequency
— Sixteen general-purpose 32-bit data and address registers
— Multiply-accumulate unit (MAC) for DSP and fast multiply operations
•On-chip memories
— 4-Kbyte SRAM on CPU internal bus
— 16-Kbyte ROM on CPU internal bus
— 1-Kbyte instruction cache
•Power management
— Fully-static operation with processor sleep and whole-chip stop modes
— Very rapid response to interrupts from the low-power sleep mode (wake-up feature)
— Clock enable/disable for each peripheral when not used
— Software-controlled disable of external clock input for virtually zero power consumption
(low-power stop mode)
•Two universal asynchronous/synchronous receiver transmitters (UARTs)
— Full-duplex operation
— Based on MC68681 dual-UART (DUART) programming model
— Flexible baud rate generator
— Modem control signals available (CTS
— Processor interrupt and wakeup capability
— Enhanced Tx, Rx FIFOs, 24 bytes each
•Ethernet Module
— 10 baseT capability, half or full duplex
— 100 baseT capability, half duplex and limited throughput full duplex (MCF5272)
— On-chip transmit and receive FIFOs
— Off-chip flexible buffer descriptor rings
— Media-independent interface (MII)
•Universal serial bus (USB) module
— 12 Mbps (full speed)
— Fully compatible with USB 1.1 specifications
— Eight endpoints (control, bulk, interrupt Rx, isochronous)
— Endpoint FIFOs
— Selectable on-chip analog interface
•External memory interface
— External glueless 8, 16, and 32-bit SRAM and ROM interface bus
— SDRAM controller supports 16–256 Mbit devices
— External bus configurable for 16 or 32 bits width for SDRAM
Overview
— Glueless interface to SRAM devices with or without byte strobe inputs
— Programmable wait state generator
•Queued serial peripheral interface (QSPI)
— Full-duplex, three-wire synchronous transfer
— Up to four chip selects available
— Master operation
— Programmable master bit rates
— Up to 16 preprogrammed transfers
– Input capture and output compare pins for timers 1 and 2
– Programmable prescaler
— 15-nS resolution at 66-MHz clock frequency
— Software watchdog timer
— Software watchdog can generate interrupt before reset
— Processor interrupt for each timer
•Pulse-width modulation (PWM) unit
— Three identical channels
— Independent prescaler TAP point
— Period/duty range variable
•System integration module (SIM)
— System configuration including internal and external address mapping
— System protection by hardware watchdog
— Versatile programmable chip-select signals with wait-state generation logic
— Up to three 16-bit parallel input/output ports
— Latchable interrupt inputs with programmable priority and edge triggering
— Programmable interrupt vectors for on-chip peripherals
•Physical layer interface controller (PLIC)
— Allows connection using general circuit interface (GCI) or interchip digital link (IDL) physical
layer protocols for 2B + D data
— Three physical interfaces
— Four time-division multiplex (TDM) ports
•IEEE 1149.1 boundary-scan test access port (JTAG) for board-level testing
•Operating voltage: 3.3 V ±0.3 V
•Operating temperature: 0 –70°C
•Operating frequency: DC to 66 MHz, from external CMOS oscillator
This section briefly describes the MCF5272 core, SIM, UART, and timer modules, and test access port.
1.2.1Version 2 ColdFire Core
Based on the concept of variable-length RISC technology, ColdFire combines the simplicity of
conventional 32-bit RISC architectures with a memory-saving, variable-length instruction set. The main
features of the MCF5272 core are as follows:
•32-bit address bus directly addresses up to 4 Gbytes of address space
•32-bit data bus
•Variable-length RISC
•Optimized instruction set for high-level language constructs
•Sixteen general-purpose 32-bit data and address registers
•MAC unit for DSP applications
•Supervisor/user modes for system protection
•Vector base register to relocate exception-vector table
•Special core interfacing signals for integrated memories
The Version 2 ColdFire core has a 32-bit address bus and a 32-bit data bus. The address bus allows direct
addressing of up to 4 Gbytes. It supports misaligned data accesses and a bus arbitration unit for multiple
bus masters.
The Version 2 ColdFire supports an enhanced subset of the 68000 instruction set. The MAC provides new
instructions for DSP applications; otherwise, Version 2 ColdFire user code runs unchanged on 68020,
68030, 68040, and 68060 processors. The removed instructions include BCD, bit field, logical rotate,
decrement and branch, integer division, and integer multiply with a 64-bit result. Also, four indirect
addressing modes have been eliminated.
The ColdFire 2 core incorporates a complete debug module that provides real-time trace, background
debug mode, and real-time debug support.
1.2.2System Integration Module (SIM)
The MCF5272 SIM provides the external bus interface for the ColdFire 2 architecture. It also eliminates
most or all of the glue logic that typically supports the microprocessor and its interface with the peripheral
and memory system. The SIM provides programmable circuits to perform address-decoding and chip
selects, wait-state insertion, interrupt handling, clock generation, discrete I/O, and power management
features.
1.2.2.1External Bus Interface
The external bus interface (EBI) handles the transfer of information between the internal core and memory ,
peripherals, or other processing elements in the external address space.
1.2.2.2Chip Select and Wait State Generation
Programmable chip select outputs provide signals to enable external memory and peripheral circuits,
providing all handshaking and timing signals for automatic wait-state insertion and data bus sizing.
Base memory address and block size are programmable, with some restrictions. For example, the starting
address must be on a boundary that is a multiple of the block size. Each chip select is general purpose;
however, any one of the chip selects can be programmed to provide read and write enable signals suitable
for use with most popular static RAMs and peripherals. Data bus width (8-bit, 16-bit, or 32-bit) is
programmable on all chip selects, and further decoding is available for protection from user mode access
or read-only access.
1.2.2.3System Configuration and Protection
The SIM provides configuration registers that allow general system functions to be controlled and
monitored. For example, all on-chip registers can be relocated as a block by programming a module base
address, power management modes can be selected, and the source of the most recent RESET or BERR
can be checked. The hardware watchdog features can be enabled or disabled, and the bus time-out period
can be programmed.
A software watchdog timer is also provided for system protection. If programmed, the timer causes a reset
to the MCF5272 if it is not refreshed periodically by software.
The sleep and stop power management modes reduce power consumption by allowing software to shut
down the core, peripherals, or the whole device during inactive periods. To reduce power consumption
further, software can individually disable internal clocks to the on-chip peripheral modules. The
power-saving modes are described as follows:
•Sleep mode uses interrupt control logic to allow any interrupt condition to wake the processor. As
the MCF5272 is fully static, sleep mode is simply the disabling of the core’ s clock after the current
instruction completes. An interrupt from any internal or external source causes on-chip power
management logic to reenable the core’s clock; execution resumes with the next instruction. This
allows rapid return from power-down state as compared to a dynamic implementation that must
perform power-on reset processing before software can handle the interrupt request. If interrupts
are enabled at the appropriate priority level, program control passes to the relevant interrupt service
routine.
•Stop mode is entered by the disabling of the external clock input and is achieved by software setting
a bit in a control register. Program execution stops after the current instruction. In stop mode,
neither the core nor peripherals are active. The MCF5272 consumes very little power in this mode.
To resume normal operation, the external interrupts cause the power management logic to
re-enable the external clock input. The MCF5272 resumes program execution from where it
entered stop mode (if no interrupt are pending), or starts interrupt exception processing if interrupts
are pending.
1.2.2.5Parallel Input/Output Ports
The MCF5272 has up to three 16-bit general-purpose parallel ports, each line of which can be programmed
as either an input or output. Some port lines have dedicated pins and others are shared with other MCF5272
functions. Some outputs have high drive current capability.
1.2.2.6Interrupt Inputs
The MCF5272 has flexible latched interrupt inputs each of which can generate a separate, maskable
interrupt with programmable interrupt priority level and triggering edge (falling or rising). Each interrupt
has its own interrupt vector.
1.2.3UART Module
The MCF5272 has two full-duplex UART modules with an on-chip baud rate generator providing both
standard and non-standard baud rates up to 5 Mbps. The module is functionally equivalent to the MC68681
DUAR T with enhanced features including 24-byte Tx and Rx FIFOs. Data formats can be 5, 6, 7, or 8 bits
with even, odd, or no parity and up to 2 stop bits in 1/16-bit increments. Receive and transmit FIFOs
minimize CPU service calls. A wide variety of error detection and maskable interrupt capability is
provided.
Using a programmable prescaler or an external source, the MCF5272 system clock supports various baud
rates. Modem support is provided with request-to-send (RTS) and clear-to-send (CTS) lines available
externally. Full-duplex autoecho loopback, local loopback, and remote loopback modes can be selected.
The UART can be programmed to interrupt or wake up the CPU on various normal or abnormal events.
To reduce power consumption, the UART can be disabled by software if not in use.
1.2.4Timer Module
The timer module contains five timers arranged in two submodules. One submodule contains a
programmable software watchdog timer. The other contains four independent, identical general-purpose
timer units, each containing a free-running 16-bit timer for use in various modes, including capturing the
timer value with an external event, counting external events, or triggering an external signal or interrupting
the CPU when the timer reaches a set value. Each unit has an 8-bit prescaler for deriving the clock input
frequency from the system clock or external clock input. The output pin associated with each timer has
programmable modes.
To reduce power consumption, the timer module can be disabled by software.
1.2.5Test Access Port
For system diagnostics and manufacturing testing, the MCF5272 includes user-accessible test logic that
complies with the IEEE 1149.1 standard for boundary scan testing, often referred to as JTAG (Joint Test
Action Group). The IEEE 1149.1 Standard provides more information.
1.3 System Design
This section presents issues to consider when designing with the MCF5272. It describes differences
between the MCF5272 (core and peripherals) and various other standard components that are replaced by
moving to an integrated device like the MCF5272.
1.3.1System Bus Configuration
The MCF5272 has flexibility in its system bus interfacing due to the dynamic bus sizing feature in which
32-,16-, and 8-bit data bus sizes are programmable on a per-chip select basis. The programmable nature of
the strobe signals (including OE
minimal or nonexistent. Configuration software is required upon power-on reset before chip-selected
devices can be used, except for chip select 0 (CS0
otherwise. BUSW1 and BUSW0 select the initial data bus width for CS0
or a restart from stop mode does not require reconfiguration of the chip select registers or other system
configuration registers.
/RD, R/W, BS[3:0], and CSn) should ensure that external decode logic is
), which is active after power-on reset until programmed
only . A wake-up from sleep mode
1.4MCF5272-Specific Features
This section describes features peculiar to the MCF5272.
1.4.1Physical Layer Interface Controller (PLIC)
The physical layer interface controller (PLIC) allows the MCF5272 to connect at a physical level with
external CODECs and other peripheral devices that use either the general circuit interface (GCI), or
interchip digital link (IDL), physical layer protocols. This module is primarily intended to facilitate
designs that include ISDN interfaces.
1.4.2Pulse-Width Modulation (PWM) Unit
The PWM unit is intended for use in control applications. With a suitable low-pass filter, it can be used as
a digital-to-analog converter . This module generates a synchronous series of pulses. The duty cycle of the
pulses is under software control.
Its main features include the following:
•Double-buffered width register
•Variable-divide prescale
•Three identical, independent PWM modules
•Byte-wide width register provides programmable control of duty cycle.
The PWM implements a simple free-running counter with a width register and comparator such that the
output is cleared when the counter exceeds the value of the width register . When the counter wraps around,
its value is not greater than the width register value, and the output is set high. With a suitable low-pass
filter, the PWM can be used as a digital-to-analog converter.
1.4.3Queued Serial Peripheral Interface (QSPI)
The QSPI module provides a serial peripheral interface with queued transfer capability. It supports up to
16 stacked transfers at a time, making CPU intervention between transfers unnecessary. Transfer RAMs
in the QSPI are indirectly accessible using address and data registers. Functionality is similar to the QSPI
portion of the QSM (queued serial module) implemented in the MC68332.
The QSPI has the following features:
•Programmable queue to support up to 16 transfers without user intervention
•Supports transfer sizes of 8 to 16 bits in 1-bit increments
•Four peripheral chip-select lines for control of up to 15 devices
•Baud rates from 129.4 Kbps to 33 Mbps at 66 MHz.
•Programmable delays before and after transfers
•Programmable clock phase and polarity
•Supports wrap-around mode for continuous transfers
1.4.4Universal Serial Bus (USB) Module
The USB controller on the MCF5272 supports device mode data communications with a USB host
(typically a PC). One host and up to 127 attached peripherals share USB bandwidth through a
host-scheduled, token-based protocol. The USB uses a tiered star topology with a hub at the center of each
star. Each wire segment is a point-to-point connection between the host connector and a peripheral
connector.
This chapter provides an overview of the microprocessor core of the MCF5272. The chapter describes the
V2 programming model as it is implemented on the MCF5272. It also includes a full description of
exception handling, data formats, an instruction set summary, and a table of instruction timings.
2.1Features and Enhancements
The MCF5272 is the most highly-integrated V2 standard product, containing a variety of communications
and general-purpose peripherals. The V2 core was designed to maximize code density and performance
while minimizing die area.
The following list summarizes MCF5272 features:
•Variable-length RISC Version 2 microprocessor core
•Vector base register to relocate exception-vector table
•Optimized for high-level language constructs
2.1.1Decoupled Pipelines
The IFP prefetches instructions. The OEP decodes instructions, fetches required operands, then executes
the specified function. The two independent, decoupled pipeline structures maximize performance while
minimizing core size. Pipeline stages are shown in Figure 2-1 and are summarized as follows:
•Two-stage IFP (plus optional instruction buffer stage)
— Instruction address generation (IAG) calculates the next prefetch address.
— Instruction fetch cycle (IC) initiates prefetch on the processor’s local instruction bus.
— Instruction buffer (IB) optional stage uses FIFO queue to minimize effects of fetch latency.
•Two-stage OEP
— Decode, select/operand fetch (DSOC) decodes the instruction and selects the required
components for the effective address calculation, or the operand fetch cycle.
— Address generation/execute (AGEX) calculates the operand address, or performs the execution
The IFP generates instruction addresses and fetches. Because the fetch and execution pipelines are
decoupled by a three longword FIFO buffer, the IFP ca n prefetch instructions before the OEP needs them,
minimizing stalls.
2.1.1.2Operand Execution Pipeline (OEP)
The OEP is a two-stage pipeline featuring a traditional RISC datapath with a register file feeding an
arithmetic/logic unit (ALU). For simple register-to-register instructions, the first stage of the OEP
performs the instruction decode and fetching of the required register operands (OC), while the actual
instruction execution is performed in the second stage (EX).
For memory-to-register instructions, the instruction is effectively staged through the OEP twice in the
following way:
•The instruction is decoded and the components of the operand address are selected (DS).
•The operand address is generated using the execute engine (AG).
•The memory operand is fetched while any register operand is simultaneously fetched (OC).
For register-to-memory operations, the stage functions (DS/OC, AG/EX) are effectively performed
simultaneously allowing single-cycle execution. For read-modify-write instructions, the pipeline
effectively combines a memory-to-register operation with a store operation.
2.1.1.2.1Illegal Opcode Handling
On Version 2 ColdFire implementations, only some illegal opcodes (0x0000 and 0x4AFC) are decoded
and generate an illegal instruction exception. Additionally , attempting to execute an illegal line A or line F
opcode generates unique exception types. If any other unsupported opcode is executed, the resulting
operation is undefined.
2.1.1.2.2Hardware Multiply/Accumulate (MAC) Unit
The MAC is an optional unit in Version 2 that provides hardware support for a limited set of digital signal
processing (DSP) operations used in embedded code, while supporting the integer multiply instructions in
the ColdFire microprocessor family . The MAC features a three-stage execution pipeline, optimized for 16
x 16 multiplies. It is tightly coupled to the OEP, which can issue a 16 x 16 multiply with a 32-bit
accumulation plus fetch a 32-bit operand in a single cycle. A 32 x 32 multiply with a 32-bit accumulation
requires three cycles before the next instruction can be issued.
Figure 2-2 shows basic functionality of the MAC. A full set of instructions are provided for signed and
unsigned integers plus signed, fixed-point fractional input operands.
The hardware divide unit performs the following integer division operations:
•32-bit operand/16-bit operand producing a 16-bit quotient and a 16-bit remainder
•32-bit operand/32-bit operand producing a 32-bit quotient
•32-bit operand/32-bit operand producing a 32-bit remainder
2.1.2Debug Module Enhancements
The ColdFire processor core debug interface supports system integration in conjunction with low-cost
development tools. Real-time trace and debug information can be accessed through a standard interface,
which allows the processor and system to be debugged at full speed without costly in-circuit emulators.
On-chip breakpoint resources include the following:
•Configuration/status register (CSR)
•Bus attributes and mask register (AATR)
•Breakpoint registers. These can be used to define triggers combining address, data, and PC
conditions in single- or dual-level definitions. They include the following:
— PC breakpoint register (PBR)
— PC breakpoint mask register (PBMR)
— Data operand address breakpoint registers (ABHR/ABLR)
— Data breakpoint register (DBR)
•Data breakpoint mask register (DBMR)
•Trigger definition register (TDR) can be programmed to generate a processor halt or initiate a
debug interrupt exception
These registers can be accessed through the dedicated debug serial communication channel, or from the
processor’s supervisor programming model, using the WDEBUG instruction.
2.2Programming Model
The MCF5272 programming model consists of three instruction and register groups—user, MAC (also
user-mode), and supervisor, shown in Figure 2-2. User mode programs are restricted to user and MAC
instructions and programming models. Supervisor-mode system software can reference all user-mode and
MAC instructions and registers and additional supervisor instructions and control registers. The user or
supervisor programming model is selected based on SR[S]. The following sections describe the registers
in the user, MAC, and supervisor programming models.
2.2.1User Programming Model
As Figure 2-3 shows, the user programming model consists of the following registers:
•16 general-purpose 32-bit registers, D0–D7 and A0–A7
MACSRMAC status register
ACCMAC accumulator
MASKMAC mask register
CACRCache control register
ACR0Access control register 0
ACR1Access control register 1
ROMBARROM base address register
RAMBARRAM base address register
MBARModule base address register
Figure 2-3. ColdFire Programming Model
2.2.1.1Data Registers (D0–D7)
Registers D0–D7 are used as data registers for bit, byte (8-bit), word (16-bit), and longword (32-bit)
operations. They may also be used as index registers.
2.2.1.2Address Registers (A0–A6)
The address registers (A0–A6) can be used as software stack pointers, index registers, or base address
registers and may be used for word and longword operations.
2.2.1.3Stack Pointer (A7, SP)
The processor core supports a single hardware stack pointer (A7) used during stacking for subroutine calls,
returns, and exception handling. The stack pointer is implicitly referenced by certain operations and can
be explicitly referenced by any instruction specifying an address register . The initial value of A7 is loaded
from the reset exception vector, address 0x0000. The same register is used for user and supervisor modes,
and may be used for word and longword operations.
A subroutine call saves the program counter (PC) on the stack and the return restores the PC from the stack.
The PC and the status register (SR) are saved on the stack during exception and interrupt processing. The
return from exception instruction restores SR and PC values from the stack.
2.2.1.4Program Counter (PC)
The PC holds the address of the executing instruction. For sequential instructions, the processor
automatically increments the PC. When program flow changes, the PC is updated with the target
instruction. For some instructions, the PC specifies the base address for PC-relative operand addressing
modes.
2.2.1.5Condition Code Register (CCR)
The CCR, Figure 2-4, occupies SR[7–0], as shown in Figure 2-3. CCR[4–0] are indicator flags based on
results generated by arithmetic operations.
76543210
Field—XNZVC
Reset000Undefined
R/WRR/WR/WR/WR/WR/W
Figure 2-4. Condition Code Register (CCR)
CCR fields are described in Table 2-1.
Table 2-1. CCR Field Descriptions
Bits NameDescription
7–5—Reserved, should be cleared.
4XExtend condition code bit. Assigned the value of the carry bit for arithmetic operations; otherwise not
affected or set to a specified result. Also used as an input operand for multiple-precision arithmetic.
3NNegative condition code bit. Set if the msb of the result is set; otherwise cleared.
2ZZero condition code bit. Set if the result equals zero; otherwise cleared.
1VOverflow condition code bit. Set if an arithmetic overflow occurs, implying that the result cannot be
represented in the operand size; otherwise cleared.
0CCarry condition code bit. Set if a carry-out of the data operand msb occurs for an addition or if a borrow
Figure 2-3 shows the registers in the MAC portion of the user programming model. These registers are
described as follows:
•Accumulator (ACC)—This 32-bit, read/write, general-purpose register is used to accumulate the
results of MAC operations.
•Mask register (MASK)—This 16-bit general-purpose register provides an optional address mask
for MAC instructions that fetch operands from memory. It is useful in the implementation of
circular queues in operand memory.
•MAC status register (MACSR)—This 8-bit register defines configuration of the MAC unit and
contains indicator flags affected by MAC instructions. Unless noted otherwise, MACSR indicator
flag settings are based on the final result, that is, the result of the final operation involving the
product and accumulator.
2.2.2Supervisor Programming Model
The MCF5272 supervisor programming model is shown in Figure 2-3. Typically , system programmers use
the supervisor programming model to implement operating system functions and provide memory and I/O
control. The supervisor programming model provides access to the user registers and additional supervisor
registers, which include the upper byte of the status register (SR), the vector base register (VBR), and
registers for configuring attributes of the address space connected to the Version 2 processor core. Most
supervisor-mode registers are accessed by using the MOVEC instruction with the control register
definitions in Table 2-2.
Table 2-2. MOVEC Register Map
Rc[11–0]Register Definition
0x002Cache control register (CACR)
0x004Access control register 0 (ACR0)
0x005Access control register 1 (ACR1)
0x801Vector base register (VBR)
0xC00ROM base address register
0xC04RAM base address register (RAMBAR)
0xC0FModule base address register (MBAR)
The SR stores the processor status, the interrupt priority mask, and other control bits. Supervisor software
can read or write the entire SR; user software can read or write only SR[7–0], described in Section 2.2.1.5,
“Condition Code Register (CCR).” The control bits indicate processor states—trace mode (T), supervisor
or user mode (S), and master or interrupt state (M). SR is set to 0x27xx after reset.
15870
System ByteCondition Code Register (CCR)
FieldT—SM—I—XNZVC
Reset00100111000—————
R/W R/WRR/WR/WRR/WRR/WR/W R/WR/W R/W
Figure 2-5. Status Register (SR)
Table 2-3 describes SR fields.
Table 2-3. Status Field Descriptions
BitsNameDescription
15TTrace enable. When T is set, the processor performs a trace exception after every instruction.
13SSupervisor/user state. Indicates whether the processor is in supervisor or user mode
0 User mode
1 Supervisor mode
12MMaster/interrupt state. Cleared by an interrupt exception. It can be set by software during execution
of the RTE or move to SR instructions so the OS can emulate an interrupt stack pointer.
10–8IInterrupt priority mask. Defines the current interrupt priority. Interrupt requests are inhibited for all
priority levels less than or equal to the current priority, except the edge-sensitive level-7 request,
which cannot be masked.
7–0CCR Condition code register. See Figure 2-4.
2.2.2.2Vector Base Register (VBR)
The VBR holds the base address of the exception vector table in memory. The displacement of an
exception vector is added to the value in this register to access the vector table. VBR[19–0] are not
implemented and are assumed to be zero, forcing the vector table to be aligned on a 0-modulo-1-Mbyte
boundary.
3120 190
FieldException vector table base address—
Reset0000_0000_0000_0000_0000_0000_0000_0000
R/W Written from a BDM serial command or from the CPU using the MOVEC instruction. VBR can be read from
the debug module only. The upper 12 bits are returned, the low-order 20 bits are undefined.
The CACR controls operation of the instruction and data cache memory. It includes bits for enabling,
freezing, and invalidating cache contents. It also includes bits for defining the default cache mode and
write-protect fields. See Section 4.5.3.1, “Cache Control Register (CACR).”
2.2.2.4Access Control Registers (ACR0–ACR1)
The access control registers (ACR0–ACR1) define attributes for two user-defined memory regions.
Attributes include definition of cache mode, write protect, and buffer write enables. See Section 4.5.3.2,
“Access Control Registers (ACR0 and ACR1).”
2.2.2.5ROM Base Address Register (ROMBAR)
The ROMBAR base address register determines the base address of the internal ROM module and
indicates the types of references mapped to it. The ROMBAR includes a base address, write-protect bit,
address space mask bits, and an enable. Note that the MCF5272 ROM contains data for the HDLC module
and is not user programmable. See Section 4.4.2.1, “ROM Base Address Register (ROMBAR).”
2.2.2.6RAM Base Address Register (RAMBAR)
The RAMBAR register determines the base address location of the internal SRAM module and indicates
the types of references mapped to it. The RAMBAR includes a base address, write-protect bit, address
space mask bits, and an enable. The RAM base address must be aligned on a 0-modulo-4-Kbyte boundary .
See Section 4.3.2.1, “SRAM Base Address Register (RAMBAR).”
2.2.2.7Module Base Address Register (MBAR)
The module base address register (MBAR) defines the logical base address for the memory-mapped space
containing the control registers for the on-chip peripherals. See Section 6.2.2, “Module Base Address
Register (MBAR).”
2.3Integer Data Formats
Table 2-4 lists the integer operand data formats. Integer operands can reside in registers, memory, or
instructions. The operand size for each instruction is either explicitly encoded in the instruction or
implicitly defined by the instruction operation.
Table 2-4. Integer Data Formats
Operand Data FormatSize
Bit1 bit
Byte integer8 bits
Word integer16 bits
Longword integer32 bits
The following sections describe data organization within the data, address, and control registers.
2.4.1Organization of Integer Data Formats in Registers
Figure 2-7 shows the integer format for data registers. Each integer data register is 32 bits wide. Byte and
word operands occupy the lower 8- and 16-bit portions of integer data registers, respectively. Longword
operands occupy the entire 32 bits of integer data registers. A data register that is either a source or
destination operand only uses or changes the appropriate lower 8 or 16 bits in byte or word operations,
respectively . The remaining high-order portion does not change. The least significant bit (lsb) of all integer
sizes is zero, the most-significant bit (msb) of a longword integer is 31, the msb of a word integer is 15,
and the msb of a byte integer is 7.
313010
msblsbBit (0 ð bit number ð 31)
3187610
Not usedmsb Low order bytelsbByte (8 bits)
3116151410
Not usedmsbLower order wordlsbWord (16 bits)
313010
msbLongwordlsbLongword (32 bits)
Figure 2-7. Organization of Integer Data Formats in Data Registers
The instruction set encodings do not allow the use of address registers for byte-sized operands. When an
address register is a source operand, either the low-order word or the entire longword operand is used,
depending on the operation size. Word-length source operands are sign-extended to 32 bits and then used
in the operation with an address register destination. When an address register is a destination, the entire
register is affected, regardless of the operation size. Figure 2-8 shows integer formats for address registers.
3116150
Sign-Extended16-Bit Address Operand
310
Full 32-Bit Address Operand
Figure 2-8. Organization of Integer Data Formats in Address Registers
The size of control registers varies according to function. Some have undefined bits reserved for future
definition by Freescale. Those particular bits read as zeros and must be written as zeros for future
compatibility.
All operations to the SR and CCR are word-size operations. For all CCR operations, the upper byte is read
as all zeros and is ignored when written, regardless of privilege mode.
2.4.2Organization of Integer Data Formats in Memory
All ColdFire processors use a big-endian addressing scheme. The byte-addressable organization of
memory allows lower addresses to correspond to higher order bytes. The address N of a longword data
item corresponds to the address of the high-order word. The lower order word is located at address N + 2.
The address N of a word data item corresponds to the address of the high-order byte. The lower order byte
is located at address N + 1. This organization is shown in Figure 2-9.
Addressing modes are categorized by how they are used. Data addressing modes refer to data operands.
Memory addressing modes refer to memory operands. Alterable addressing modes refer to alterable
(writable) data operands. Control addressing modes refer to memory operands without an associated size.
These categories sometimes combine to form more restrictive categories. Two combined classifications
are alterable memory (both alterable and memory) and data alterable (both alterable and data). Twelve of
the most commonly used effective addressing modes from the M68000 family are available on ColdFire
microprocessors. Table 2-5 summarizes these modes and their categories.
Table 2-5. ColdFire Effective Addressing Modes
—
—
X
X
X
X
X
X
Category
—
—
—
—
X
X
X
X
—
—
Addressing ModesSyntax
Register direct
Data
Address
Register indirect
Address
Address with Postincrement
Address with Predecrement
Address with Displacement
The ColdFire instruction set is a simplified version of the M68000 instruction set. The removed
instructions include BCD, bit field, logical rotate, decrement and branch, and integer multiply with a 64-bit
result. Nine new MAC instructions have been added.
Table 2-6 lists notational conventions used throughout this manual.
Table 2-6. Notational Conventions
InstructionOperand Syntax
Opcode Wildcard
ccLogical condition (example: NE for not equal)
Register Specifications
AnAny address register n (example: A3 is address register 3)
Ay,AxSource and destination address registers, respectively
DnAny data register n (example: D5 is data register 5)
Dy,DxSource and destination data registers, respectively
RcAny control register (example VBR is the vector base register)
RmMAC registers (ACC, MAC, MASK)
RnAny address or data register
RwDestination register w (used for MAC instructions only)
Ry,RxAny source and destination registers, respectively
Xiindex register i (can be an address or data register: Ai, Di)
Register Names
ACCMAC accumulator register
CCRCondition code register (lower byte of SR)
MACSRMAC status register
MASKMAC mask register
PCProgram counter
SRStatus register
Port Names
DDATADebug data port
PSTProcessor status port
Miscellaneous Operands
#<data>Immediate data following the 16-bit operation word of the instruction
<ea>y,<ea>xSource and destination effective addresses, respectively
<label>Assembly language program label
<list>List of registers for MOVEM instruction (example: D3–D0)
<shift>Shift operation: shift left (<<), shift right (>>)
<size>Operand data size: byte (B), word (W), longword (L)
bcInstruction cache
# <vector>Identifies the 4-bit vector number for trap instructions
<>identifies an indirect data address referencing memory
<xxx>identifies an absolute address referencing memory
dnSignal displacement value, n bits wide (example: d16 is a 16-bit displacement)
SFScale factor (x1, x2, x4 for indexed addressing mode, <<1n>> for MAC operations)
Operations
+Arithmetic addition or postincrement indicator
–Arithmetic subtraction or predecrement indicator
xArithmetic multiplication
/Arithmetic division
~Invert; operand is logically complemented
&Logical AND
|Logical OR
^Logical exclusive OR
<<Shift left (example: D0 << 3 is shift D0 left 3 bits)
>>Shift right (example: D0 >> 3 is shift D0 right 3 bits)
→Source operand is moved to destination operand
←→Two operands are exchanged
sign-extendedAll bits of the upper portion are made equal to the high-order bit of the lower portion
If <condition>
then <operations>
else <operations>
Test the condition. If the condition is true, the operations in the then clause are performed. If the condition
is false and the optional else clause is present, the operations in the else clause are performed. If the
condition is false and the else clause is omitted, the instruction performs no operation. Refer to the Bcc
instruction description as an example.
Table 2-7. User-Mode Instruction Set Summary (continued)
InstructionOperand SyntaxOperand SizeOperation
SUB<ea>y,Dx
Dy,<ea>x
.L
Destination – source → destination
.L
SUBA<ea>y,Ax.LDestination – source → destination
SUBI#<data>,Dx.LDestination – immediate data → destination
SUBQ#<data>,<ea>x.LDestination – immediate data → destination
SUBXDy,Dx.LDestination – source – X → destination
SWAPDx.WMSW of Dx ←→ LSW of Dx
TRAP#<vector>UnsizedSP – 4 → SP;PC → (SP);
SP – 2 → SP;SR → (SP);
SP – 2 → SP; format → (SP);
Vector address → PC
TRAPFNone
#<data>
Unsized
.W
.L
PC + 2 → PC
PC + 4 → PC
PC + 6 → PC
TST<ea>y.B,.W,.LSet condition codes
UNLKAxUnsizedAx →SP; (SP) → Ax; SP + 4 → SP
WDDATA<ea>y.B,.W,.L<ea>y →DDATA port
1
By default the HALT instruction is a supervisor-mode instruction; however, it can be configured to allow user-mode execution
by setting CSR[UHE].
Table 2-8 describes supervisor-mode instructions.
Table 2-8. Supervisor-Mode Instruction Set Summary
InstructionOperand SyntaxOperand SizeOperation
CPUSHL(bc),(Ax)UnsizedInvalidate instruction cache line
1
HALT
MOVE from SRSR, Dx.WSR → Dx
MOVE to SRDy,SR
MOVECRy,Rc.LRy → Rc
RTENoneUnsized(SP+2) → SR; SP+4 → SP; (SP) → PC; SP + formatfield ⎯ SP
STOP#<data>.WImmediate data → SR; enter stopped state
WDEBUG<ea-2>y.L<ea-2>y → debug module
1
The HALT instruction can be configured to allow user-mode execution by setting CSR[UHE].
noneUnsizedEnter halted state
.WSource → SR
#<data>,SR
RcRegister Definition
0x002Cache control register (CACR)
0x004Access control register 0 (ACR0)
0x005Access control register 1 (ACR1)
0x801Vector base register (VBR)
0xC00 ROM base address register (ROMBAR)
0xC04 RAM base address register (RAMBAR)
0xC0F Module base address register (MBAR)
The timing data presented in this section assumes the following:
•The OEP is loaded with the opword and all required extension words at the beginning of each
instruction execution. This implies that the OEP spends no time waiting for the IFP to supply
opwords and/or extension words.
•The OEP experiences no sequence-related pipeline stalls. For the MCF5272,the most common
example of this type of stall involves consecutive store operations, excluding the MOVEM
instruction. For all store operations (except MOVEM), certain hardware resources within the
processor are marked as busy for two clock cycles after the final DSOC cycle of the store
instruction. If a subsequent store instruction is encountered within this two-cycle window, it is
stalled until the resource again becomes available. Thus, the maximum pipeline stall involving
consecutive store operations is two cycles.
•The OEP can complete all memory accesses without memory causing any stall conditions. Thus,
timing details in this section assume an infinite zero-wait state memory attached to the core.
•All operand data accesses are assumed to be aligned on the same byte boundary as the operand size:
— 16-bit operands aligned on 0-modulo-2 addresses
— 32-bit operands aligned on 0-modulo-4 addresses
Operands that do not meet these guidelines are misaligned. Table 2-9 shows how the core
decomposes a misaligned operand reference into a series of aligned accesses.
Table 2-9. Misaligned Operand References
A[1:0]SizeBus OperationsAdditional C(R/W)
x1WordByte, Byte2(1/0) if read
1(0/1) if write
x1LongByte, Word, Byte3(2/0) if read
2(0/2) if write
10LongWord, Word2(1/0) if read
1(0/1) if write
1
Each timing entry is presented as C(r/w), described as follows:
C is the number of processor clock cycles, including all applicable operand fetches and writes, as
well as all internal core cycles required to complete the instruction execution.
r/w is the number of operand reads (r) and writes (w) required by the instruction. An operation
performing a read-modify write function is denoted as (1/1).
The execution times for the MOVE.{B,W,L} instructions are shown in the next tables. Table 2-12 shows
the timing for the other generic move operations.
NOTE
For all tables in this section, the execution time of any instruction using the
PC-relative effective addressing modes is equivalent to the time using
comparable An-relative mode.
ET with {<ea> = (d16,PC)} equals ET with {<ea> = (d16,An)}
ET with {<ea> = (d8,PC,Xi*SF)} equals ET with {<ea> = (d8,An,Xi*SF)}
The nomenclature “(xxx).wl” refers to both forms of absolute addressing,
(xxx).w and (xxx).l.
Table 2-10 lists execution times for MOVE.{B,W} instructions.
Table 2-12 gives execution times for MOVE.L instructions accessing program-visible registers of the
MAC unit, along with other MOVE.L timings. Execution times for moving contents of the ACC or
MACSR into a destination location represent the best-case scenario when the store instruction is executed
and no load, MAC, or MSAC instructions are in the MAC execution pipeline. In general, these store
operations require only one cycle for execution, but if they are preceded immediately by a load, MAC, or
MSAC instruction, the MAC pipeline depth is exposed and execution time is three cycles.
Exception processing for ColdFire processors is streamlined for performance. Differences from previous
M68000 family processors include the following:
•A simplified exception vector table
•Reduced relocation capabilities using the vector base register
•A single exception stack frame format
•Use of a single, self-aligning system stack pointer
ColdFire processors use an instruction restart exception model but require more software support to
recover from certain access errors. See Table 2-18 for details.
Exception processing can be defined as the time from the detection of the fault condition until the fetch of
the first handler instruction has been initiated. It is comprised of the following four major steps:
1. The processor makes an internal copy of the SR and then enters supervisor mode by setting SR[S]
and disabling trace mode by clearing SR[T]. The occurrence of an interrupt exception also forces
SR[M] to be cleared and the interrupt priority mask to be set to the level of the current interrupt
request.
2. The processor determines the exception vector number. For all faults except interrupts, the
processor performs this calculation based on the exception type. For interrupts, the processor
performs an interrupt-acknowledge (IACK) bus cycle to obtain the vector number from a
peripheral device. The IACK cycle is mapped to a special acknowledge address space with the
interrupt level encoded in the address.
3. The processor saves the current context by creating an exception stack frame on the system stack.
ColdFire processors support a single stack pointer in the A7 address register; therefore, there is no
notion of separate supervisor and user stack pointers. As a result, the exception stack frame is
created at a 0-modulo-4 address on the top of the current system stack. Additionally , the processor
uses a simplified fixed-length stack frame for all exceptions. The exception type determines
whether the program counter in the exception stack frame defines the address of the faulting
instruction (fault) or of the next instruction to be executed (next).
4. The processor acquires the address of the first instruction of the exception handler. The exception
vector table is aligned on a 1-Mbyte boundary. This instruction address is obtained by fetching a
value from the table at the address defined in the vector base register . The index into the exception
table is calculated as 4 x vector_number. When the index value is generated, the vector table
contents determine the address of the first instruction of the desired handler . After the fetch of the
first opcode of the handler is initiated, exception processing terminates and normal instruction
processing continues in the handler.
ColdFire processors support a 1024-byte vector table aligned on any 1-Mbyte address boundary; see
Table 2-18. The table contains 256 exception vectors where the first 64 are defined by Freescale; the
remaining 192 are user-defined interrupt vectors.
Table 2-18. Exception Vector Assignments
Vector
Numbers
0000—Initial stack pointer
1004—Initial program counter
2008Fault Access error
300CFaultAddress error
4010FaultIllegal instruction
5014FaultDivide by zero
The term ‘fault’ refers to the PC of the instruction that caused the exception. The term ‘next’ refers to the PC
of the instruction that immediately follows the instruction that caused the fault.
Vector Offset
(Hex)
Stacked
Program Counter
1
Assignment
ColdFire processors inhibit sampling for interrupts during the first instruction of all exception handlers.
This allows any handler to effectively disable interrupts, if necessary, by raising the interrupt mask level
contained in the status register.
2.8.1Exception Stack Frame Definition
The exception stack frame is shown in Figure 2-10. The first longword of the exception stack frame
contains the 16-bit format/vector word (F/V) and the 16-bit status register . The second longword contains
the 32-bit program counter address.
3128 272625181716150
A7→FormatFS[3–2]Vector[7–0]FS[1–0] Status Register
+ 0x04Program Counter [31–0]
Figure 2-10. Exception Stack Frame Form
The 16-bit format/vector word contains three unique fields:
•Format field—This 4-bit field at the top of the system stack is always written with a value of
{4,5,6,7} by the processor indicating a 2-longword frame format. See Table 2-19. This field
records any longword misalignment of the stack pointer that may have existed when the exception
occurred.
•Fault status field—The 4-bit field, FS[3–0], at the top of the system stack is defined for access and
address errors along with interrupted debug service routines. See Table 2-20.
1000Error on operand write
1001Attempted write to write-protected space
101xReserved
1100Error on operand read
1101–111xReserved
•Vector number—This 8-bit field, vector[7–0], defines the exception type. It is calculated by the
processor for internal faults and is supplied by the peripheral for interrupts. See Table 2-18.
2.8.2Processor Exceptions
Table 2-21 describes MCF5272 exceptions.
Table 2-21. MCF5272 Exceptions
ExceptionDescription
Access Error Caused by an error when accessing memory. For an access error on an instruction fetch, the processor
postpones the error reporting until the instruction at the faulted reference is executed. Thus, faults that occur
during instruction prefetches that are followed by a change of instruction flow do not generate an exception.
When the processor attempts to execute an instruction with a faulted opword or extension word, the access
error is signaled, and the instruction is aborted. For this type of exception, the programming model is not
altered by the faulted instruction.
If an access error occurs on an operand read, the processor immediately aborts the current instruction
execution and initiates exception processing. In this case, any address register changes caused by the
auto-addressing modes, (An)+ and -(An), have already occurred. In addition, if an access error occurs during
the execution of a MOVEM instruction loading from memory, registers updated before the fault occurs contain
the memory operand.
Due to the processor pipeline implementation, a write cycle may be decoupled from the execution of the
instruction causing the write. Thus, if an access error occurs on an operand write, the signaling of the error is
imprecise. Accordingly, the PC contained in the exception stack frame represents the location in the program
when the access error is signaled, not necessarily the instruction causing the fault. All programming model
updates associated with the write instruction are complete. The NOP instruction can be used to help identify
write access errors. A NOP is not executed until all previous operations, including any pending writes are
complete. Thus if any previous write terminates with an access error, it is guaranteed to be reported on the
NOP.
Address Error Caused by an attempted execution transferring control to an odd instruction address (that is, if bit 0 of the target
address is set), an attempted use of a word-sized index register (Xi.w) or a scale factor of 8 on an indexed
effective addressing mode, or attempted execution of an instruction with a full-format indexed addressing
mode.
On Version 2 ColdFire implementations, only some illegal opcodes (0x0000 and 0x4AFC) are decoded and
generate an illegal instruction exception. Additionally, attempting to execute an illegal line A or line F opcode
generates unique exception types: vectors 10 and 11, respectively. If any other nonsupported opcode is
executed, the resulting operation is undefined.
ColdFire processors do not provide illegal instruction detection on extension words of any instruction, including
MOVEC. Attempting to execute an instruction with an illegal extension word causes undefined results.
Divide by Zero Attempted division by zero causes an exception (vector 5, offset = 0x014) except when the PC points to the
faulting instruction (DIVU, DIVS, REMU, REMS).
Privilege
Violation
Tr ac e
Exception
Caused by attempted execution of a supervisor mode instruction while in user mode. The ColdFire Programmer’s Reference Manual lists supervisor- and user-mode instructions.
ColdFire processors provide instruction-by-instruction tracing. While the processor is in trace mode
(SR[T] = 1), instruction completion signals a trace exception. This allows a debugger to monitor program
execution.
The only exception to this definition is the STOP instruction. If the processor is in trace mode, the instruction
before the STOP executes and then generates a trace exception. In the exception stack frame, the PC points
to the STOP opcode. When the trace handler is exited, the STOP instruction is executed, loading the SR with
the immediate operand from the instruction. The processor then generates a trace exception. The PC in the
exception stack frame points to the instruction after STOP, and the SR reflects the just-loaded value.
If the processor is not in trace mode and executes a STOP instruction where the immediate operand sets the
trace bit in the SR, hardware loads the SR and generates a trace exception. The PC in the exception stack
frame points to the instruction after STOP, and the SR reflects the just-loaded value. Because ColdFire
processors do not support hardware stacking of multiple exceptions, it is the responsibility of the operating
system to check for trace mode after processing other exception types. As an example, consider a TRAP
instruction executing in trace mode. The processor initiates the TRAP exception and passes control to the
corresponding handler. If the system requires that a trace exception be processed, the TRAP exception
handler must check for this condition (SR[15] in the exception stack frame asserted) and pass control to the
trace handler before returning from the original exception.
Debug
Interrupt
Caused by a hardware breakpoint register trigger. Rather than generating an IACK cycle, the processor
internally calculates the vector number (12). Additionally, the M bit and the interrupt priority mask fields of the
SR are unaffected by the interrupt. See Section 2.2.2.1, “Status Register (SR).”
RTE and
Format Error
Exceptions
When an RTE instruction executes, the processor first examines the 4-bit format field to validate the frame type.
For a ColdFire processor, any attempted execution of an RTE where the format is not equal to {4,5,6,7}
generates a format error. The exception stack frame for the format error is created without disturbing the
original exception frame and the stacked PC points to RTE.The selection of the format value provides limited
debug support for porting code from M68000 applications. On M68000 Family processors, the SR was at the
top of the stack. Bit 30 of the longword addressed by the system stack pointer is typically zero; so, attempting
an RTE using this old format generates a format error on a ColdFire processor.
If the format field defines a valid type, the processor does the following:
1 Reloads the SR operand.
2 Fetches the second longword operand.
3 Adjusts the stack pointer by adding the format value to the auto-incremented address after the first longword
fetch.
4 Transfers control to the instruction address defined by the second longword operand in the stack frame.
TRAPExecuting TRAP always forces an exception and is useful for implementing system calls. The trap instruction
may be used to change from user to supervisor mode.
This chapter describes the MCF5272 multiply/accumulate (MAC) unit, which executes integer multiply,
multiply-accumulate, and miscellaneous register instructions. The MAC is integrated into the operand
execution pipeline (OEP).
3.1Overview
The MAC unit provides hardware support for a limited set of digital signal processing (DSP) operations
used in embedded code, while supporting the integer multiply instructions in the ColdFire microprocessor
family.
The MAC unit provides signal processing capabilities for the MCF5272 in a variety of applications
including digital audio and servo control. Integrated as an execution unit in the processor’s OEP, the MAC
unit implements a three-stage arithmetic pipeline optimized for 16 x 16 multiplies. Both 16- and 32-bit
input operands are supported by this design in addition to a full set of extensions for signed and unsigned
integers plus signed, fixed-point fractional input operands.
The MAC unit provides functionality in three related areas:
•Signed and unsigned integer multiplies
•Multiply-accumulate operations supporting signed, unsigned, and signed fractional operands
•Miscellaneous register operations
Each of the three areas of support is addressed in detail in the succeeding sections. Logic that supports this
functionality is contained in a MAC module, as shown in Figure 3-1.
Operand YOperand X
X
Shift 0,1,-1
+/-
Accumulator
Figure 3-1. ColdFire MAC Multiplication and Accumulation
The MAC unit is tightly coupled to the OEP and features a three-stage execution pipeline. To minimize
silicon costs, the ColdFire MAC is optimized for 16 x 16 multiply instructions. The OEP can issue a
16 x 16 multiply with a 32-bit accumulation and fetch a 32-bit operand in the same cycle. A 32 x 32
multiply with a 32-bit accumulation takes three cycles before the next instruction can be issued. Figure 3-1
shows the basic functionality of the ColdFire MAC. A full set of instructions is provided for signed and
unsigned integers plus signed, fixed-point, fractional input operands.
The MAC unit is an extension of the basic multiplier found on most microprocessors. It can perform
operations native to signal processing algorithms in an acceptable number of cycles, given the application
constraints. For example, small digital filters can tolerate some variance in the execution time of the
algorithm; larger , more complicated algorithms such as orthogonal transforms may have more demanding
speed requirements exceeding the scope of any processor architecture and requiring a fully developed DSP
implementation.
The M68000 architecture was not designed for high-speed signal processing, and a large DSP engine
would be excessive in an embedded environment. In striking a middle ground between speed, size, and
functionality , the ColdFire MAC unit is optimized for a small set of operations that involve multiplication
and cumulative additions. Specifically, the multiplier array is optimized for single-cycle, 16 x 16
multiplies producing a 32-bit result, with a possible accumulation cycle following. This is common in a
large portion of signal processing applications. In addition, the ColdFire core architecture has been
modified to allow for an operand fetch in parallel with a multiply, increasing overall performance for
certain DSP operations.
3.1.1MAC Programming Model
Figure 3-2 shows the registers in the MAC portion of the user programming model.
310
MACSRMAC status register
ACCMAC accumulator
MASKMAC mask register
Figure 3-2. MAC Programming Model
These registers are described as follows:
•Accumulator (ACC)—This 32-bit, read/write, general-purpose register is used to accumulate the
results of MAC operations.
•Mask register (MASK)—This 16-bit general-purpose register provides an optional address mask
for MAC instructions that fetch operands from memory. It is useful in the implementation of
circular queues in operand memory.
•MAC status register (MACSR)—This 8-bit register defines configuration of the MAC unit and
contains indicator flags affected by MAC instructions. Unless noted otherwise, the setting of
MACSR indicator flags is based on the final result, that is, the result of the final operation involving
the product and accumulator.