PIC32 memory sizes are specified in bytes, but it stores 32bit words. Addressing is byte based, incrementing by 4 for each 32bit instruction.

PIC32’s implement two address schemes: virtual and physical.

All hardware resources (program memory, data memory and peripherals) are located at their respective physical addresses.

Virtual addresses are exclusively used by the CPU to fetch and execute instructions as well as access peripherals.

Physical addresses are used by bus master peripherals, such as DMA and the Flash controller, that access memory independently of the CPU.

KSEG0 and KSEG1 both translate to the same physical memory. They are created as separate memory segments because KSEG0 can be cached by the application whilst KSEG1 cannot:

KSEG0 is cacheable

KSEG1 is not cacheable. On chip peripherals are only accessible through this segment (SFR not present in the KSEG0 memory range)

Example – PIC32MX534F064H

Program memory:
0x1D000000 – 0x1D00FFFF
0x9D000000 – 0x9D00FFFF (virtual memory mapped)
0xBD000000 – 0xBD00FFFF (virtual memory mapped)

0x1D000000 – 0x1D00FFFF = 65536 addresses = 64KB program memory as specified in datasheet.

PIC32 memory is 32bit words, addressing is byte based and increments by 4 for each instruction, so:
64KB of program memory = 16K x 32bit instructions

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.