Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
COSMOS Summer 2008 Embedded Systems Rajesh K. Gupta Computer Science and Engineering University of California, San Diego. ©2008 R. Gupta, UCSD Roadmap • Topic: – What are embedded systems? – What has that got to do with computers and ‘chips’? • This lecture – Concepts covered: computing, computers, computer architecture – Computer peripherals • Next lecture – Computer interfaces and networks: I2C, SPI • Reference – None ©2008 R. Gupta, UCSD Keywords: Embedded Computer Computing Machines Computer Application Computer Architecture Computer Organization CPU, Memory, Bus ISA Conventions (if I can follow them • Important concept words are usually highlighted – Or strongly highlighted. • “Memory” means more than it says • Challenges and Teasers – Teaser questions are not meant to be answered ©2008 R. Gupta, UCSD ©2008 R. Gupta, UCSD Embedded Systems • “Systems” that are part of another “Application” • We are interested in “Embedded Computer Systems” – Why? Hold that thought for now. (Hint: wait until ‘chips’) • Computers are machines that are designed either for general-purpose applications or for specific applications. • Computing refers to problem solving using Computers – machine-centric problem solving. • In the past, computing are confined to scientific applications, and machines were expensive and necessarily shared. ©2008 R. Gupta, UCSD Examples of Computational Problem Solving • Can you think of examples where you need computers to solve problems? – Day-to-day – In-the-interest-science-and-humanity • Actually by far the largest application of computing was in building computers (hw, sw) ©2008 R. Gupta, UCSD Problem Solving • Problem: – Find greatest common divisor of two numbers: 6, 15. • Solutions: 1. Mathematical: gcd(a, b) = gcd(a-b, b) assume w.l.o.g. a >=b gcd(a, 0) = a 2. Procedural (Sequential): Chinese Remainder Theorem. ©2008 R. Gupta, UCSD if (x != 0 and y!= 0) { repeat { while (x>=y) x = x - y; swap x, y; } until (y=0); write gcd = x; Traditional Problem Solving using Computers • Describe the method in a programming language • Compile this program into a machine language • Execute machine program – supply input data ©2008 R. Gupta, UCSD The Computing Experience • The Computer Center – Mainframe computing • The Personal Computer – Desktop, laptop, palm top computing • The Ubiquitous Embedded Computer – Mobile, purpose-built. ©2008 R. Gupta, UCSD Computing Machines: Touchpoints in History • Generation 0: Mechanical machines – Difference engine by Babbage (1834) • Generation 1: Vacuum Tubes (1945-1955) – ENIAC by Eckert and Mauchly (1943) • Generation 2: Transistors (1955-1965) – PDP-1 by DEC (1960): first microcomputer • Generation 3: Integrated Circuits (1965-1980) – IBM 1401, 7094 and System/360 (1964) • Generation 4: PCs and VLSI (1980-continuing) ©2008 R. Gupta, UCSD The Computer • Computers manipulate information by means of programmed instructions • A computer hardware that makes this possible is called a stored program computer. • A computer system designer must – evaluate applications for which the computer is to be used – build a system architecture from software to its hardware organization – (by architecture we often mean how the system appears to the system programmer, though it is not strictly correct..) • The lexicon: architecture, organization, usage. ©2008 R. Gupta, UCSD Computer Architecture • Architecture provides – A model to organize, implement system parts – A model to use the system • Architectures can be diverse… ©2008 R. Gupta, UCSD Architectural Design Paradigms “Organically grown” The Planned Community The sacrificial altar Specialized Ambitious (and never finished) Engineered Hardware Organization • Computer Organization refers to the structure of a computer: CPU Controller Address control enables selects R/W DataPath Data data conditions ©2008 R. Gupta, UCSD Memory Software ‘Architecture’ Application Compiler Assembler Micro-operations Hardware ©2008 R. Gupta, UCSD A Personal Computer (PC) • Uses commodity components and standard interfaces to build the machine • Performance/cost variations due to choice of components and (sometimes) their interconnection. ©2008 R. Gupta, UCSD PC Components • Case: – desktop, minitower, mid case, mid tower, full tower, large tower – include a power supply (typically 200 watts) • CPU and CPU fan – sold as a chip • Motherboard – single-board computer – contains place holders for CPU and Memories – Memory modules • Interfaces – Video (card and monitor) – Others: (I/O card) “Floppy, CD-ROM, Keyboard, Hard drive, Sound card, Speakers, Modem, Tape/zip drive, Mouse” ©2008 R. Gupta, UCSD 168-pin SDRAM The Stuff at Fry’s 184-pin DDR-SDRAM ©2008 R. Gupta, UCSD Personal Computing • “Low cost and general purpose” INST CPU DATA BUS CPU MEM BUS ©2008 R. Gupta, UCSD Computer Organization 3 1 CPU MEM 2 4 ©2008 R. Gupta, UCSD BUS Drives Devices Input devices Devices Devices Output devices Networking Interface Memory 2-3 GHz CPU MEM BUS Devices Devices Devices ©2008 R. Gupta, UCSD 50 ns SIMM PC2-5300 667 MHz DIMM Lexicon: Non-intuitive & Not-obvious • Random Access: RAMs – static – dynamic – quasi-static CPU • Read Only: ROMs – PROM – EPROM Cache – EEPROM – Flash EPROM – “CMOS” • “Cache”? Memory ©2008 R. Gupta, UCSD What are L1, L2, L3? Buses • Functions: – transmit information – coordinate activities – interface standard • Bandwidth, width/xfr * xfr/sec • Memory addressing, addr/word, addr/block • Latency tolerance: low, medium, high • Length: microns, mm, inches, feet, km, 1000s km ©2008 R. Gupta, UCSD Buses • CPU -- L1 Cache – very high bandwidth, 50-500 MB/sec, addr/word • L1 Cache -- L2 Cache • Cache -- Main Memory • Network -- Main Memory – similar to disk-memory • Memory/CPU -- Display – high bandwidth, 1-20 MB/sec • Computer -- Computer – very high bandwidth, 1-200 MB/sec– medium bandwidth, kbps to Mbps, addr/message. • Main Memory -- Disk – high bandwidth, 2 MB/sec, addr/block ©2008 R. Gupta, UCSD CPU – Memory Interaction Clock 200 ns CPU Address control enables selects Controller clock R/W DataPath Memory Data data conditions • CPU controlled by a clock pulse. • Memory is controlled by R/W control signals. • CPU must synchronize its memory read, write operations with respect to its internal clock. • Example: 5 MHz clock, 500 ns access time. ©2008 R. Gupta, UCSD addr select VALID 500 ns R/W’ data VALID WRITE CYCLE CPU Operation • A computing machine delivers its functionality using instructions. – instruction set architecture (ISA) • A CPU executes each instruction in steps: – Fetch instruction – Decode instruction – Execute instruction • Fetch instruction – location pointed by the Program Counter ©2008 R. Gupta, UCSD CPU Simplified Register File A B ALU Accumulator ©2008 R. Gupta, UCSD The Assembly Language • Machine defined by an ISA • A program is translated into an object program • An assembly language consists of – statement corresponding to machine instructions – represented mnemonically: easier to remember than numbers and bits – typical mnemonics: ADD, SUB, MUL – machine dependent ©2008 R. Gupta, UCSD control enables selects Data Path Program Controller data Level 3 data conditions A CPU prog. MEM B Level 2 SR SA Lc mux ALU Level 1 Register File C A Level 0 B ALU Accumulator Hardware View ©2008 R. Gupta, UCSD Software Vie Let us see how a programmer would build a CPU... PC Mem Step 1: PC points to an instruction in the memory. ©2008 R. Gupta, UCSD Let us see how a programmer would build a CPU... PC PC Mem Step 1: PC points to an instruction in the memory. ©2008 R. Gupta, UCSD Mem IR Step 2: Memory responds with “data” that represent an instruction to be stored in IR. Let us see how a programmer would build a PC CPU... PC Mem Step 1: PC points to an instruction in the memory. PC Mem IR control Step 3: an instruction is decoded into “control” lines by the control block. ©2008 R. Gupta, UCSD Mem IR Step 2: Memory responds with “data” that represent an instruction to be storedin IR. Let us see how a programmer would build a PC CPU... PC Mem Mem Step 1: PC points to an instruction in the memory. IR Step 2: Memory responds with “data” that represent an instruction to be storedin IR. PC PC Mem Mem IR control Step 3: an instruction is decoded into “control” lines by the control block. ©2008 R. Gupta, UCSD ALU IR Acc control Step 4: Memory also provides “data” that is used by the ALU to compute variable values. CPU Building (contd.) load new address into PC, jump operation. PC addr data out ALU IR Mem data in control Acc save data into memory. Step 5: ALU output is stored back into memory; the ALU may also compute address, in which case ACC output it input to PC. ALU also computes data which is stored in memory. ©2008 R. Gupta, UCSD The Changing Computer Instrumented wide-area spaces Internet end-points In-body, in-cell, in-vitro spaces Personal area spaces ©2008 R. Gupta, UCSD Driven By “Chips” Underneath ©2008 R. Gupta, UCSD Cellphone Baseband Graphics Controller Embedded Systems: Sensor Node ©2008 R. Gupta, UCSD ©2008 R. Gupta, UCSD Recap • A computer is a ‘Computing Machine’ • We saw what a computer looks like – Beyond what you see at Fry’s – Architectural components & interfaces • CPU, ALU, Memory, Bus • Application = What can we do with computers – Traditional numeric problem solving replaced by ‘special-purpose’ functions • Sensing, control, media,… • Next: what are peripherals and how we connect to these? ©2008 R. Gupta, UCSD