DOC PREVIEW
Berkeley ELENG C149 - Memory Architectures

This preview shows page 1-2-22-23 out of 23 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

l 1 Introduction to Embedded Systems Chapter 9: Memory Architectures Edward A. Lee Alberto Sangiovanni-Vincentelli UC Berkeley EECS 149/249A Fall 2014 EECS 149/249A, UC Berkeley: 2 Memory Architecture: Issues ¢ Types of memory ¢ volatile vs. non-volatile, SRAM vs. DRAM ¢ Memory maps ¢ Harvard architecture ¢ Memory-mapped I/O ¢ Memory organization l statically allocated l stacks l heaps (allocation, fragmentation, garbage collection) ¢ The memory model of C ¢ Memory hierarchies ¢ scratchpads, caches, virtual memory) ¢ Memory protection ¢ segmented spaces These issues loom larger in embedded systems than in general-purpose computing.l 2 EECS 149/249A, UC Berkeley: 3 Non-Volatile Memory Preserves contents when power is off • EPROM: erasable programmable read only memory • Invented by Dov Frohman of Intel in 1971 • Erase by exposing the chip to strong UV light • EEPROM: electrically erasable programmable read-only memory • Invented by George Perlegos at Intel in 1978 • Flash memory • Invented by Dr. Fujio Masuoka at Toshiba around 1980 • Erased a “block” at a time • Limited number of program/erase cycles (~ 100,000) • Controllers can get quite complex • Disk drives • Not as well suited for embedded systems USB Drive Images from the Wikimedia Commons EECS 149/249A, UC Berkeley: 4 Volatile Memory Loses contents when power is off. • SRAM: static random-access memory • Fast, deterministic access time • But more power hungry and less dense than DRAM • Used for caches, scratchpads, and small embedded memories • DRAM: dynamic random-access memory • Slower than SRAM • Access time depends on the sequence of addresses • Denser than SRAM (higher capacity) • Requires periodic refresh (typically every 64msec) • Typically used for main memory • Boot loader • On power up, transfers data from non-volatile to volatile memory.l 3 EECS 149/249A, UC Berkeley: 5 Example: Die of a STM32F103VGT6 ARM Cortex-M3 microcontroller with 1 megabyte flash memory by STMicroelectronics. Image from Wikimedia Commons EECS 149/249A, UC Berkeley: 6 Memory Map of an ARM CortexTM - M3 architecture Defines the mapping of addresses to physical memory. Note that this does not define how much physical memory there is!l 4 EECS 149/249A, UC Berkeley: 7 Another Example: Atmel AVR The AVR is an 8-bit single chip microcontroller first developed by Atmel in 1996. The AVR was one of the first microcontroller families to use on-chip flash memory for program storage. It has a modified Harvard architecture.1 AVR was conceived by two students at the Norwegian Institute of Technology (NTH) Alf-Egil Bogen and Vegard Wollan. 1 A Harvard architecture uses separate memory spaces for program and data. It originated with the Harvard Mark I relay-based computer (used during World War II), which stored the program on punched tape (24 bits wide) and the data in electro-mechanical counters. EECS 149/249A, UC Berkeley: 8 A Use of AVR: Arduino Arduino is a family of open-source hardware boards built around either 8-bit AVR processors or 32-bit ARM processors. Example: Atmel AVR Atmega328 28-pin DIP on an Arduino Duemilanove board Image from Wikimedia Commonsl 5 EECS 149/249A, UC Berkeley: 9 Atmel ATMega 168 Microcontroller Another example use of an AVR processor The iRobot Create Command Module EECS 149/249A, UC Berkeley: 10 ATMega168 Memory Architecture An 8-bit microcontroller with 16-bit addresses AVR microcontroller architecture used in iRobot command module. iRobot command module has 16K bytes flash memory (14,336 available for the user program. Includes interrupt vectors and boot loader.) 1 k bytes RAM Additional I/O on the command module: • Two 8-bit timer/counters • One 16-bit timer/counter • 6 PWM channels • 8-channel, 10-bit ADC • One serial UART • 2-wire serial interface Source: ATmega168 Reference Manuall 6 EECS 149/249A, UC Berkeley: 11 An 8-Bit Microcontroller Note 16-bit addresses and 8-bit data. The “8-bit data” is why this is called an “8-bit microcontroller.” EECS 149/249A, UC Berkeley: 12 Pause - 1. What is the difference between an 8-bit microcontroller and a 32-bit microcontroller? 2. Why use volatile memory? Why not always use non-volatile memory?l 7 EECS 149/249A, UC Berkeley: 13 Memory Organization for Programs • Statically-allocated memory • Compiler chooses the address at which to store a variable. • Stack • Dynamically allocated memory with a Last-in, First-out (LIFO) strategy • Heap • Dynamically allocated memory EECS 149/249A, UC Berkeley: 14 Statically-Allocated Memory in C char x; int main(void) { x = 0x20; … } Compiler chooses what address to use for x, and the variable is accessible across procedures. The variable’s lifetime is the total duration of the program execution.l 8 EECS 149/249A, UC Berkeley: 15 Statically-Allocated Memory with Limited Scope void foo(void) { static char x; x = 0x20; … } Compiler chooses what address to use for x, but the variable is meant to be accessible only in foo(). The variable’s lifetime is the total duration of the program execution (values persist across calls to foo()). EECS 149/249A, UC Berkeley: 16 Variables on the Stack (“automatic variables”) void foo(void) { char x; x = 0x20; … } When the procedure is called, x is assigned an address on the stack (by decrementing the stack pointer). When the procedure returns, the memory is freed (by incrementing the stack pointer). The variable persists only for the duration of the call to foo(). stack As nested procedures get called, the stack pointer moves to lower memory addresses. When these procedures, return, the pointer moves up.l 9 EECS 149/249A, UC Berkeley: 17 Pause 1 What is meant by the following C code: char x; void foo(void) { x = 0x20; … } EECS 149/249A, UC Berkeley: 18 Answer 1 What is meant by the following C code: char x; void foo(void) { x = 0x20; … } An 8-bit quantity (hex 0x20) is stored at an address in internal RAM determined by the compiler.l 10 EECS 149/249A, UC Berkeley: 19 Pause 2 What is meant by the following C code: char *x; void foo(void) { x = 0x20; … } EECS 149/249A, UC Berkeley: 20 Answer 2 What is meant


View Full Document
Download Memory Architectures
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Memory Architectures and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Memory Architectures 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?