Virtual vs Physical Memory

In all PIC32 architectures, CPU access to memory and peripherals is accomplished through virtual address space. The virtual address space has been segmented to provide the core with flexibility in how it accesses physical memory.

When the CPU is in Kernel mode (default after reset and during exceptions) there are two segments used to access internal memory:

  • KSEG0: Internal memory access - cacheable
  • KSEG1: Internal memory access - not cacheable

KSEG0 and KSEG1 share the same physical addresses and use Fixed Mapping Translation (FMT) to translate virtual to physical addresses. Every virtual address has its own constant corresponding physical address.

Your application can choose to use cache or not based on the segment used to address physical memory.

KSEG1 is the only memory region that can be used at reset because the MMU and cache must be configured by the boot code before it can be used. Therefore your boot code must be placed in KSEG1.

There are two segments used to access external (SQI and EBI) memory:

  • KSEG2: External memory access - cacheable
  • KSEG3: External memory access - not cacheable

There is one segment used to access User (unprivileged) memory:

  • KUSEG: User (unprivileged) memory access - cacheable

KUSEG, KSEG2 and KSEG3 use a Memory Management Unit (MMU) with Translation Lookaside Buffer (TLB) to translate virtual to physical addresses. The MMU must be configured by your boot code before using these segments.


20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.