“C” and Assembly Language- What are they good for?

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

Chapter 8: Central Processing Unit
CPU Review and Programming Models CT101 – Computing Systems.
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
RISC / CISC Architecture By: Ramtin Raji Kermani Ramtin Raji Kermani Rayan Arasteh Rayan Arasteh An Introduction to Professor: Mr. Khayami Mr. Khayami.
Computer Organization and Architecture
ΜP rocessor Architectures To : Eng. Ahmad Hassan By: Group 18.
PART 4: (2/2) Central Processing Unit (CPU) Basics CHAPTER 13: REDUCED INSTRUCTION SET COMPUTERS (RISC) 1.
Computer Organization and Architecture
Computer Organization and Architecture
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
Chapter XI Reduced Instruction Set Computing (RISC) CS 147 Li-Chuan Fang.
Major Advances in Computers(1) The family concept —IBM System/ —DEC PDP-8 —Separates architecture from implementation Microporgrammed control unit.
RISC. Rational Behind RISC Few of the complex instructions were used –data movement – 45% –ALU ops – 25% –branching – 30% Cheaper memory VLSI technology.
11/11/05ELEC CISC (Complex Instruction Set Computer) Veeraraghavan Ramamurthy ELEC 6200 Computer Architecture and Design Fall 2005.
Unit -II CPU Organization By- Mr. S. S. Hire. CPU organization.
Chapter 13 Reduced Instruction Set Computers (RISC) CISC – Complex Instruction Set Computer RISC – Reduced Instruction Set Computer.
(6.1) Central Processing Unit Architecture  Architecture overview  Machine organization – von Neumann  Speeding up CPU operations – multiple registers.
RISC CSS 548 Joshua Lo.
Reduced Instruction Set Computers (RISC) Computer Organization and Architecture.
Cisc Complex Instruction Set Computing By Christopher Wong 1.
CH12 CPU Structure and Function
Processor Organization and Architecture
Advanced Computer Architectures
Computer Organization and Architecture Reduced Instruction Set Computers (RISC) Chapter 13.
CH13 Reduced Instruction Set Computers {Make hardware Simpler, but quicker} Key features  Large number of general purpose registers  Use of compiler.
RISC:Reduced Instruction Set Computing. Overview What is RISC architecture? How did RISC evolve? How does RISC use instruction pipelining? How does RISC.
1 4.2 MARIE This is the MARIE architecture shown graphically.
Chapter 1 An Introduction to Processor Design 부산대학교 컴퓨터공학과.
Operating Systems and Networks AE4B33OSS Introduction.
What have mr aldred’s dirty clothes got to do with the cpu
Computer architecture Lecture 11: Reduced Instruction Set Computers Piotr Bilski.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 12 Overview and Concluding Remarks.
Chapter 8 CPU and Memory: Design, Implementation, and Enhancement The Architecture of Computer Hardware and Systems Software: An Information Technology.
ECE 456 Computer Architecture Lecture #14 – CPU (III) Instruction Cycle & Pipelining Instructor: Dr. Honggang Wang Fall 2013.
RISC and CISC. What is CISC? CISC is an acronym for Complex Instruction Set Computer and are chips that are easy to program and which make efficient use.
ECEG-3202 Computer Architecture and Organization Chapter 7 Reduced Instruction Set Computers.
Reduced Instruction Set Computers. Major Advances in Computers(1) The family concept —IBM System/ —DEC PDP-8 —Separates architecture from implementation.
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
RISC / CISC Architecture by Derek Ng. Overview CISC Architecture RISC Architecture  Pipelining RISC vs CISC.
Jan. 5, 2000Systems Architecture II1 Machine Organization (CS 570) Lecture 1: Overview of High Performance Processors * Jeremy R. Johnson Wed. Sept. 27,
CISC. What is it?  CISC - Complex Instruction Set Computer  CISC is a design philosophy that:  1) uses microcode instruction sets  2) uses larger.
High Performance Computing1 High Performance Computing (CS 680) Lecture 2a: Overview of High Performance Processors * Jeremy R. Johnson *This lecture was.
Topics to be covered Instruction Execution Characteristics
The CPU, RISC and CISC Component 1.
Advanced Architectures
Immediate Addressing Mode
Central Processing Unit Architecture
William Stallings Computer Organization and Architecture 8th Edition
Advanced Topic: Alternative Architectures Chapter 9 Objectives
Overview Introduction General Register Organization Stack Organization
A Closer Look at Instruction Set Architectures
Computer Architecture
Central Processing Unit
Central Processing Unit
Getting the Most Out of Low Power MCUs
Computer Structure S.Abinash 11/29/ _02.
1.1 The Characteristics of Contemporary Processors, Input, Output and Storage Devices Types of Processors.
Chapter 12 Pipelining and RISC
Course Outline for Computer Architecture
Lecture 4: Instruction Set Design/Pipelining
Chapter 11 Processor Structure and function
COMPUTER ORGANIZATION AND ARCHITECTURE
Computer Architecture Assembly Language
Presentation transcript:

“C” and Assembly Language- What are they good for? Class 2: An MCU as a Software Target 7/30/2013 Warren Miller

This Week’s Agenda 7/29/13 Introduction to MCU Architecture 7/30/13 An MCU as a Software Target 7/31/13 Assembly Language for MCUs 8/01/13 “C” for MCUs 8/02/13 Assembly vs. “C” Fight Club!

Class Description "C" and Assembly language are by far the most popular languages for programming MCUs. This class will highlight some of the key characteristics of both "C" and Assembly language as programming ‘paradigms’. Examples of things these languages are 'good' for and 'bad' for will help illustrate an efficient thought process that can help guide the selection of the 'right' language for a particular algorithm.

Today’s Topics Goals and Objectives MCU Architecture- Advanced Concepts Instruction Pipeline Instruction/Data Cache Call and Return Interrupts RISC and CISC Execution Efficiency MCU Program Control Peripherals

Goals and Objectives Expand our understanding to cover advanced MCU architecture topics- in particular efficiency related topics Need to know these concepts to understand how programs are mapped into MCU instructions Need to compare alternative architectures Need to uderstand common optimization techniques

Simple MCU Architecture: Advanced Concepts Example Simple CPU Architecture PC Instruction Memory Decode Data Memory MAR MDR Register File ALU

Instruction Pipelines Pipeline Use Single cycle execution results in a long clock cycle Break execution into three equal delay phases Overlap phases Faster Clock cycle Clock 1 Clock 2 Clock 3 Inst 1 Fetch Decode Execute Inst 2 Inst 3 Clock 1 Delay Fetch 3.3ns Decode Execute

Instruction Pipelines Advantages Faster Clock Rate Higher performance Improved power efficiency Efficient for inline code Many advance computations can be done inline- no jumps needed Disadvantages Conditional jumps interrupt the pipe Loops for example Delays not ‘deterministic’ Execution path depends on data

Instruction/Data Cache MAR When Memory access is slow Store recent accesses in smaller faster memory Compare address in cache to see if it was recently accessed Read data from Cache if a HIT Read data from memory and store in Cache if a MISS Can be even more efficient if memory is accessed in ‘Blocks’ Memory Cache

Types of Memory Cache Direct Mapped- Simple, more MISSES N-way Associative- Balanced Fully Associative- Complex, less MISSES Cache Upper Address Compare Two (N) Address Compares

Call and Return Call: Save State and Jump to Subroutine Save Registers + Condition Codes + PC<Next> Store to memory at Stack Pointer location Return: Restore State Pop all registers Load PC Delay Stacking Data Memory Registers Stack Stack Pointer Reg 1 Reg 2 Reg 3 PC

Interrupts Similar to Call/Return, but Can happen based on hardware signals Immediate attention required Priority and Masking

CISC and RISC Architectures CISC Architecture ‘Complex’ Instructions Multiple Addressing Modes Slower clock rate Multiple cycles Difficult to pipeline Code Efficient Instructions Fewer instructions needed Less memory required Easier to map to High Level Language (HLL) constructs RISC Architecture ‘Simple’ Instructions Load and Store Faster clock rate Single cycle Easy to pipeline Less Code Efficient More instructions needed More memory required Modern compilers make HLL mapping easy

Execution Efficiency How to determine efficiency? Clock Frequency Memory, Cache, Pipelines, Instruction Set, Benchmarks (DMIPs) 1 DMIPs = VAX 11/780 DMIPs/MHz DMIPs is computation oriented- your mileage may vary! The Dhrystone benchmark contains no floating point operations, thus the name is a pun on the then-popular Whetstone benchmark for floating point operations. The output from the benchmark is the number of Dhrystones per second (the number of iterations of the main code loop per second). Both Whetstone and Dhrystone are synthetic benchmarks, meaning that they are simple programs that are carefully designed to statistically mimic the processor usage of some common set of programs. Whetstone, developed in 1972, originally strove to mimic typical Algol 60 programs based on measurements from 1970, but eventually became most popular in its Fortran version, reflecting the highly numerical orientation of computing in the 1960s.

Other MCU Features Intelligent Peripherals (For Program Control) Timers Real Time Clocks Direct Memory Access (DMA) controller Watch Dog Timer Etc.

Additional Resources MicroController Central Web Site: http://www.microcontrollercentral.com Max Maxfield: Bebop to the Boolean Boogie http://www.amazon.com/Bebop-Boolean-Boogie-Third-Unconventional/dp/1856175073 Computer Architecture Classes: http://csg.csail.mit.edu/6.823/index.html (Computer Architecture, MIT) Li-Shiuan Peh Programming Paradigms (Stanford) Jerry Cain (iTunes University) Introduction to Algorithms (MIT) Erik Demaine (iTunes University) Introduction to Computer Science and Programming (MIT) Eric Grimson, John Guttag (iTunes University)

This Week’s Agenda 7/29/13 Introduction to MCU Architecture 7/30/13 An MCU as a Software Target 7/31/13 Assembly Language for MCUs 8/01/13 “C” for MCUs 8/02/13 Assembly vs. “C” Fight Club!