Intro to Math 230 Assembly Language Programming. Lecture # 01 01/15/08

Similar documents
CS61C Machine Structures. Lecture 1 Introduction. 8/27/2006 John Wawrzynek (Warzneck)

CS61C Machine Structures. Lecture 1 Introduction. 8/25/2003 Brian Harvey. John Wawrzynek (Warznek) www-inst.eecs.berkeley.

levels (layers) of abstraction I stand on the shoulders of giants Lecture #1 Introduction Are Computers Smart? Where does CS61C fit in?

CS61C : Machine Structures

ECE 15B COMPUTER ORGANIZATION

CS61C : Machine Structures

Are Computers Smart? To a programmer: Lecture #1 Introduction & Numbers Andy Carle. Are Computers Smart? What are Machine Structures?

CS430 - Computer Architecture William J. Taffe Fall 2002 using slides from. CS61C - Machine Structures Dave Patterson Fall 2000

CS61C : Machine Structures

What are Machine Structures? Lecture 1 Introduction C. * Coordination of many. levels (layers) of abstraction

levels (layers) of abstraction

ELEC 5200/6200. Computer Architecture & Design. Victor P. Nelson Broun 326

CS61C : Machine Structures

I stand on the shoulders of giants. Lecture #1 Introduction Where does CS61C fit in? Are Computers Smart?

CS/COE0447: Computer Organization

CS61C : Machine Structures

CS61C : Machine Structures

CS61C : Machine Structures

Handouts. (CSC-3501) Lecture 1 (15 Jan 2008) Seung-Jong Park (Jay) Class information. Schedule (check online frequently)

CS61C : Machine Structures

CS61C : Machine Structures

CS61CL : Machine Structures

EECE 321: Computer Organization

ECE 15B Computer Organization Spring 2011

CS64 Computer Organization

Five classic components

ECE 154A. Architecture. Dmitri Strukov

Computer Architecture. Fall Dongkun Shin, SKKU

Instructors: Randy H. Katz David A. PaHerson hhp://inst.eecs.berkeley.edu/~cs61c/fa10. Fall Lecture #1. Agenda

Computer Architecture Computer Architecture. Computer Architecture. What is Computer Architecture? Grading

CPS104 Computer Organization Lecture 1

Computer Architecture!

Computer Architecture

COMPUTER ORGANIZATION (CSE 2021)

IT 252 Computer Organization and Architecture. Introduction. Chia-Chi Teng

Agenda. Old School CS61c. Agenda. New School CS61c 8/26/10. CS 61C: Great Ideas in Computer Architecture (Machine Structures)

CS61C C/Assembler Operators and Operands Lecture 2 January 22, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson)

CPE300: Digital System Architecture and Design

CPS104 Computer Organization Lecture 1. CPS104: Computer Organization. Meat of the Course. Robert Wagner

CS61C : Machine Structures

Computer Architecture

COMPUTER ORGANIZATION (CSE 2021)

CS 61C: Great Ideas in Computer Architecture Lecture 2: Introduction to C, Part I

EEC170 Computer Architecture. Lecture 1: Introduction to Computer Architecture

CS 3410 Computer System Organization and Programming

CS 3410 Computer System Organization and Programming

CPE300: Digital System Architecture and Design. Fall 2011 MW 17:30-18:45 CBC C316

ECE232: Hardware Organization and Design

מבנה מחשבים Amar Lior Based on lectures notes from Arie Schlesinger

Computer Architecture

Concurrency & Parallelism, 10 mi

Review: What is a Computer?

The Beauty and Joy of Computing

CS61C : Machine Structures

What is this class all about?

Fundamentals of Digital System Design ECE 3700, CPSC 3700

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

ECE232: Hardware Organization and Design

Lecture 1: Introduction to Digital Logic Design

Computer Architecture

Computer Architecture!

CS 241 Data Organization. August 21, 2018

Page 1. Logistics. Introduction to Embedded Systems. My Records Indicate. Intel 4004 first single chip computer? Acronyms CS/ECE 6780/5780.

C Programming for Engineers Introduction

Lecture 1: CS/ECE 3810 Introduction

How What When Why CSC3501 FALL07 CSC3501 FALL07. Louisiana State University 1- Introduction - 1. Louisiana State University 1- Introduction - 2

High-Performance Scientific Computing

CS3350B Computer Architecture. Introduction

WELCOME TO. ENGR 303 Introduction to Logic Design. Hello my name is Dr. Chuck Brown

ECE 20B, Winter Purpose of Course. Introduction to Electrical Engineering, II. Administration

Computer Architecture. Introduction. Lynn Choi Korea University

What is this class all about?

14:332:331. Lecture 1

CS 110 Computer Architecture. Lecture 2: Introduction to C, Part I. Instructor: Sören Schwertfeger.

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

Inf2C - Computer Systems Lecture 1 Course overview & the big picture

Instructors. ECE 152 Introduction to Computer Architecture. Undergrad Teaching Assistants. Course Website. Textbook.

Course overview. Computer Organization and Assembly Languages Yung-Yu Chuang 2006/09/18. with slides by Kip Irvine

What is this class all about?

GRE Architecture Session

Computers Are Your Future

Introduction to Computer Systems

CMPE012 Computer Engineering 12 (and Lab) Computing Systems and Assembly Language Programming. Summer 2009

CS 3410: Intro to Computer System Organization and Programming

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

CSE : Introduction to Computer Architecture

Computer Architecture!

CS 152 Computer Architecture and Engineering Lecture 1 Single Cycle Design

What s inside your computer? Session 3. Peter Henderson

Overview of Computer Organization. Chapter 1 S. Dandamudi

Course overview Computer system structure and operation

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

Advanced Computer Architecture (CS620)

Agenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010

EEM 486: Computer Architecture

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Microprocessor. Dr. Rabie A. Ramadan. Al-Azhar University Lecture 1

Overview of Computer Organization. Outline

Chapter 1 Introduction. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Lecture 01: Basic Structure of Computers

Transcription:

Intro to Math 230 Assembly Language Programming Lecture # 01 01/15/08

Lecture Overview Course Overview Short history of industry trends and motivation for course need Lab: command line environment review 2

M230 Course Description Hands-on programming course in C and assembly language programming Covers low level programming and debugging techniques, computer architecture, input/output programming 3

Meeting Times Math 230 Lecture: Tue, Thu: 8:00 am - 9:15 am, rm 394 Lab: Tue, Thu: 9:30 am - 10:45 am, rm 394 Class Web Resources: http://swccd.blackboard.com http://groups.google.com/group/swcclassmath230 4

Instructor Contact Info Bruce Smith, Assist. Prof of Mathematics Phone: 421-6700, x5291 e-mail: bsmith@swccd.edu Office: room 320F Office hours: M, W: 12:10 pm - 1:50 pm Fri: 12:00 pm - 12:50 pm You can also contact me to setup an appointment outside these hours! 5

Required: Textbook and Materials Computer Organization and Design, 3 rd Edition, by Patterson and Hennessy Programming in C, 2 nd Edition, by Kernighan and Ritchie (K&R) On library reserve: Digital Principles and Applications, by Leach K&R 6

Attendance You can be dropped if you have more than 4 absences (i.e., 2 weeks worth of classes) Tardiness and early departures may also be counted as absences Course material discussed during the Lab section may extend (or even add to) lecture material. You are responsible for all material covered in both lab and lecture 7

Semester Grade Evaluation Policy Labs (~10) 10% Homework (~10) 10% Projects (~5) 30% Midterm Exams (2) 25% Final Exam 25% Evaluation Policy Total: 100% Assigned reading: P&H, Ch 1, 3.1, 3.2 (exclude Fig.3.1) HW01 (due Thu, 1/24): Exercises 1.1 thru 1.28, 1.54 Lab01 (due Thu, 1/24): see Blackboard 8

Homework, Labs and Projects Lab exercises every week; to be submitted by the Thursday lab session Homework exercises ~every week Projects ~every 3 weeks 9

Class Policies No food or drink (water bottles OK) Cell phones silent No children or visitors without prior permission 10

Class Policies If you are found cheating or helping someone cheat, you may receive as much as 50% of the assignment s value Any further cheating will result in expulsion from the course. Also see SWC Course Catalog regarding student conduct. 11

Class Resources Primarily the info that is packaged with your textbook PCspim compiler/assembler see text book MARs Science of Computing Text Camera Vivio LogiSim 12

Is MIPS relevant? MIPS Microprocessor Without Interlocked Pipeline Stages 13

Market Share 14

The MIPS share 15

Workstation Peformance 17

Framework for the Course 18

Assembly Language 19

Assembly Language Machine language 19

Assembly Language Machine language The numeric language understood by a computer s processor (the CPU). 19

Assembly Language Machine language The numeric language understood by a computer s processor (the CPU). Consists entirely of 1 s and 0 s low and high voltages 19

Assembly Language Machine language The numeric language understood by a computer s processor (the CPU). Consists entirely of 1 s and 0 s low and high voltages The 1 s and 0 s are usually grouped and represented as larger numbers (hex or octal) 19

Assembly Language Machine language The numeric language understood by a computer s processor (the CPU). Consists entirely of 1 s and 0 s low and high voltages The 1 s and 0 s are usually grouped and represented as larger numbers (hex or octal) Assembly Language 19

Assembly Language Machine language The numeric language understood by a computer s processor (the CPU). Consists entirely of 1 s and 0 s low and high voltages The 1 s and 0 s are usually grouped and represented as larger numbers (hex or octal) Assembly Language Short mnemonics to represent the numeric (machine) language, e.g., ADD, LW, SUB, MUL, J, DIV, JAL 19

Assembly Language Machine language The numeric language understood by a computer s processor (the CPU). Consists entirely of 1 s and 0 s low and high voltages The 1 s and 0 s are usually grouped and represented as larger numbers (hex or octal) Assembly Language Short mnemonics to represent the numeric (machine) language, e.g., ADD, LW, SUB, MUL, J, DIV, JAL Converted to machine language 19

Babel 20

Embedded systems flight control air-conditioning home alarm digital phone Create device drivers printer drivers USB drivers Applications Computer games needing HW access small, quick code 21

What are Machine Structures? Software Hardware Application (ex: browser) Compiler Assembler Processor Memory Digital Design Circuit Design Operating System (Mac OSX) Datapath & Control transistors I/O system Instruction Set Architecture 22

What are Machine Structures? Software Hardware Application (ex: browser) Operating Compiler System Assembler (Mac OSX) Processor Memory I/O system Datapath & Control Digital Design Circuit Design transistors Instruction Set Architecture M 230 22

What are Machine Structures? Software Hardware Application (ex: browser) Operating Compiler System Assembler (Mac OSX) Processor Memory I/O system Datapath & Control Digital Design Circuit Design transistors Instruction Set Architecture M 230 * Coordination of many 22

What are Machine Structures? Software Hardware Application (ex: browser) Operating Compiler System Assembler (Mac OSX) Processor Memory I/O system Datapath & Control Digital Design Circuit Design transistors Instruction Set Architecture M 230 * Coordination of many levels (layers) of abstraction 22

Levels of Representation High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g.,mips) Assembler Machine Language Program (MIPS) Machine Interpretation Hardware Architecture Description (Logic, Logisim, Verilog, etc.) Architecture Implementation Logic Circuit Description (Logisim, etc.) 23

Levels of Representation High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g.,mips) Assembler Machine Language Program (MIPS) temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; Machine Interpretation Hardware Architecture Description (Logic, Logisim, Verilog, etc.) Architecture Implementation Logic Circuit Description (Logisim, etc.) 23

Levels of Representation High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g.,mips) Assembler Machine Language Program (MIPS) temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; lw $t0, 0($2) lw $t1, 4($2) sw $t1, 0($2) sw $t0, 4($2) Machine Interpretation Hardware Architecture Description (Logic, Logisim, Verilog, etc.) Architecture Implementation Logic Circuit Description (Logisim, etc.) 23

Levels of Representation High Level Language Program (e.g., C) Compiler Assembly Language Program (e.g.,mips) Assembler Machine Language Program (MIPS) Machine Interpretation Hardware Architecture Description (Logic, Logisim, Verilog, etc.) Architecture Implementation temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; lw $t0, 0($2) lw $t1, 4($2) sw $t1, 0($2) sw $t0, 4($2) 0000 1001 1100 0110 1010 1111 0101 1000 1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 Logic Circuit Description (Logisim, etc.) 23

Anatomy: 5 components of any Computer Personal Computer Computer Processor Control ( brain ) Datapath ( brawn ) Memory (where programs, data live when running) Devices Input Output Keyboard, Mouse Disk (where programs, data live when not running) Display, Printer 24

Overview of Physical Implementations The hardware out of which we make systems. Integrated Circuits (ICs) Combinational logic circuits, memory elements, analog interfaces. Printed Circuits (PC) boards substrate for ICs and interconnection, distribution of CLK, Vdd, and GND signals, heat dissipation. Power Supplies Converts line AC voltage to regulated DC low voltage levels. Chassis (rack, card case,...) holds boards, power supply, provides physical interface to user or other systems. Connectors and Cables. 25

Integrated Circuits (2005 state-of-the-art) Bare Die Chip in Package Primarily Crystalline Silicon 1mm - 25mm on a side 2005 - feature size ~ 90 nm = 90 x 10-9 m 100-1000M transistors (25-100M logic gates") 3-10 conductive layers CMOS (complementary metal oxide semiconductor) - most common. Package provides: spreading of chip-level signal paths to boardlevel heat dissipation. Ceramic or plastic with gold wires. 26

Printed Circuit Boards fiberglass or ceramic 1-20 conductive layers 1-20 in on a side IC packages are soldered down. Provides: Mechanical support Distribution of power and heat. 27

Technology Trends: Microprocessor Complexity # of transistors on an IC Gordon Moore Intel Cofounder 2X Transistors / Chip Every 1.5 years Called Moore s Law Year 28

Technology Trends: Memory Capacity (Single-Chip DRAM) size Bits 1000000000 100000000 10000000 1000000 100000 10000 1000 1970 1975 1980 1985 1990 1995 2000 Year Now 1.4X/yr, or 2X every 2 years. 8000X since 1980! year size (Mbit) 1980 0.0625 1983 0.25 1986 1 1989 4 1992 16 1996 64 1998 128 2000 256 2002 512 2004 1024 (1Gbit) 29

Technology Trends: Uniprocessor Performance (SPECint) Performance (vs. VAX-11/780) 10000 1000 100 10 1 1.25x/year 25%/year 1.52x/year 52%/year 1.20x/year 20%/year 1978 1980 1982 1984 1986 1988 1990 1992 1994 1996 1998 2000 2002 2004 2006 VAX : 1.25x/year 1978 to 1986 RISC + x86: 1.52x/year 1986 to 2002 RISC + x86: 1.20x/year 2002 to present 30

Computer Technology - Dramatic Change! Memory DRAM capacity: 2x / 2 years (since 96); 64x size improvement in last decade. Processor Speed 2x / 1.5 years (since 85); [slowing!] 100X performance in last decade. Disk Capacity: 2x / 1 year (since 97) 250X size in last decade. 31

Computer Technology - Dramatic Change! We ll see that Kilo, Mega, etc. are incorrect later! State-of-the-art PC when you graduate: (at least ) Processor clock speed: 5000 MegaHertz (5.0 GigaHertz) Memory capacity: 8000 MegaBytes (8.0 GigaBytes) Disk capacity: 2000 GigaBytes (2.0 TeraBytes) New units! Mega Giga, Giga Tera (Tera Peta, Peta Exa, Exa Zetta Zetta Yotta = 10 24 ) 32

M230: So what's in it for me? Learn some of the big ideas in CS & engineering: Principle of abstraction, used to build systems as layers 5 Classic components of a Computer Data can be anything (integers, floating point, characters): a program determines what it is Stored program concept: instructions just data Principle of Locality, exploited via a memory hierarchy (cache) Greater performance by exploiting parallelism Compilation v. interpretation thru system layers Principles/Pitfalls of Performance Measurement 33

Others Skills learned in 230 Learning C If you know one, you should be able to learn another programming language largely on your own Given that you know C++ or Java, should be easy to pick up their ancestor, C Assembly Language Programming This is a skill you will pick up, as a side effect of understanding the Big Ideas Hardware design We ll learn just the basics of hardware design 34

Course Lecture Outline Number representations C-Language (basics + pointers) Storage management Assembly Programming Floating Point make-ing an Executable (compilation, assembly) Logic Circuit Design CPU organization Pipelining Caches Virtual Memory Performance I/O Interrupts Disks, Networks Advanced Topics 35

36

Today s Lab Work Log onto computer (swcstudent): username: pmath password: 7pmath Log onto Blackboard swccd.edu or swccd.blackboard.com announcements grades Updating E-mail on Webadvisor sending e-mail Explore command-line environment 37

Lab 0 dir cd del pwd pushd/popd more path set redirection wildcards 38

Binary Numbers Digits are 1 and 0 1 = true 0 = false MSB most significant bit LSB least significant bit MSB 1 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 Bit numbering: 15 0 LSB 39

Base-10 (decimal) arithmetic Uses the ten numbers from 0 to 9 Each column represents a power of 10 Thousands (10 3 ) column Hundreds (10 2 ) column Tens (10 1 ) column Ones (10 0 ) column 1999 10 = 1x10 3 + 9x10 2 + 9x10 1 + 9x10 0 40

Base-2 (binary) arithmetic Uses the two numbers from 0 to 1 Every column represents a power of 2 41

Base-2 (binary) arithmetic Uses the two numbers from 0 to 1 Every column represents a power of 2 Eights (2 3 ) column Fours (2 2 ) column Twos (2 1 ) column Ones (2 0 ) column 1001 2 = 1x2 3 + 0x2 2 + 0x2 1 + 1x2 0 41

Translating Binary to Decimal Weighted positional notation shows how to calculate the decimal value of each binary bit: dec = (D n-1 2 n-1 ) + (D n-2 2 n-2 ) +... + (D 1 2 1 ) + (D 0 2 0 ) D = binary digit binary 00001001 = decimal 9: (1 2 3 ) + (1 2 0 ) = 9 42

Converting from base-2 to base-10 32 16 8 4 2 1 1 0 0 1 = 1 0 1 1 = 1 0 1 0 1 = 1 1 1 1 1 1 = 43

Converting from base-10 to base-2 (on the fly) 64 32 16 8 4 2 1 = 16 = 55 = 75 = 84 44

Converting from base-10 to base-2 (using division) Repeatedly divide the decimal integer by 2. Each remainder is a binary digit in the translated value: 37 = 100101 45

Addition Base-10 Base-2 1 9 9 8 1 0 1 1 + 1 1 + 1 1 2 0 0 9 1 1 1 0 46

Binary Addition Starting with the LSB, add each pair of digits, include the carry if present. carry: 1 + 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 (4) (7) 0 0 0 0 1 0 1 1 (11) bit position: 7 6 5 4 3 2 1 0 47

Practice binary arithmetic 1 0 1 1 1 1 1 + 1 1 + 1 48