190 likes | 326 Views
Computer Organization 101. Computer Organization 101. 001. ECE 341 Lab Platform. Computer Organization. PIC32. Building the Program. Compiling and Linking. Compiler may skip generation of the assembly language output. PC accesses program instructions. SP accesses stack (typically, data).
E N D
Compiling and Linking Compiler may skip generation of the assembly language output
PC accesses program instructions SP accesses stack (typically, data)
C Program Execution • C variables are maintained in memory • ALU operates on register data • Typically must load data from memory, perform operation, and save result • Optimizing compiler attempts to minimize memory transfers by utilizing registers
Program Data • Stack is a special, “temporary”, section of memory • Local (auto) variables and • Data for function calls (arguments, return address) • Data section uses “permanent” addresses (constant during program execution) • global variables • static local variables
Generic Memory Layout (locals , arguments, return address) No dynamic data in our system (global and static variables)
PIC Memory • PIC32 uses “virtual” memory, to allow a “supervisory” program (e.g., O/S) to share physical memory user program • Separate sections for program and data • Also device configuration and accessing peripherals (Special Function Registers – SFRs) • No support for dynamic memory in our system • Physical separation of instructions (flash), data (SRAM), and SRFs hidden from programmer
Virtual to Physical Memory Mapping User Segment
PIC32 Memory Map (kseg0) Virtual Memory Physical Memory
Stack Frame Frame pointer ($fp) is similar to the stack pointer ($sp) – but different!
More Questions? See Dr. J’s FAQ under the ECE 340 web page!!!