memory - CS1372 CS1372: HELPING TO PUT THE COMPUTING IN ECE...

Info iconThis preview shows pages 1–16. Sign up to view the full content.

View Full Document Right Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372 Memory
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Memory Representation We typically draw diagrams representing the memory of the computer, the memory of our particular program or both as rectangles. Our convention will be that "high-memory" will be on the bottom and "low- memory" on top. Typically these drawings are not to scale Low Memory High Memory x0000 xFFFF
Background image of page 2
Typical Arrangement Normally the actual program code (executable instructions) is placed in low memory Code x0000 xFFFF
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Typical Arrangement Next we have an area for storage of constant data Code Constant Data x0000 xFFFF
Background image of page 4
Typical Arrangement Data that may be changed follows Code Constant Data Alterable Data x0000 xFFFF
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Typical Arrangement These three items comprise what is considered the static area of memory. The static area details (size, what is where, etc.) are known at translation or compile time. Code Constant Data Alterable Data Static x0000 xFFFF
Background image of page 6
CS1372: HELPING TO PUT THE COMPUTING IN ECE Static Variables (I) Local variable outside a function (value persists throughout the life of the program) static keyword declared inside a function Located in static area Storage Class: STATIC
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// File Demo.c int main() { } int buttonState(int which) { static int state; }
Background image of page 8
CS1372: HELPING TO PUT THE COMPUTING IN ECE Static Variables (II) Global variable visible to all functions within a file static keyword declared outside of any function Located in static area Storage Class: STATIC
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// File Demo.c static int pressure; int main() { pressure = 7; } int buttonState(int which) { static int state; x = pressure + 3; }
Background image of page 10
CS1372: HELPING TO PUT THE COMPUTING IN ECE Static Variables (III) Global variable visible in more than one file Declared outside of any function in one file Declared extern in other files (or functions/blocks) Located in static area Storage Class: STATIC
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// File Demo.c static int pressure; int cycles = 60; int main() { } int buttonState(int which) { static int state; } // File Auxilary.c extern int cycles; int foo() { } int bar() { }
Background image of page 12
Typical Arrangement Immediately below the static area the heap is located. The heap can expand downward as the program dynamically requests additional storage space In most cases, the runtime environment manages the heap for the user We will return to this later Code Constant Data Alterable Data Static Heap x0000 xFFFF
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Typical Arrangement Finally, the activation stack starts in high memory and can grow up as space is needed. Items maintained in the stack include auto variables Function parameters Return values Stack Code Constant Data Alterable Data Static Heap x0000 xFFFF
Background image of page 14
Typical Arrangement These items in the lower portion of the diagram change* during execution of the program.
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 84

memory - CS1372 CS1372: HELPING TO PUT THE COMPUTING IN ECE...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online