Computer Organization and Assembly Languages 2007/11/10

Slides:



Advertisements
Similar presentations
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Advertisements

Basic Concepts COE 205 Computer Organization and Assembly Language
Data Representation Computer Organization &
Data Representation COE 205
Introduction to Microprocessors Number Systems and Conversions No /6/00 Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
COMP3221 lec07-numbers-III.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 7: Number Systems - III
Data Representation ICS 233
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
Course overview Computer Organization and Assembly Languages Yung-Yu Chuang 2007/09/17 with slides by Kip Irvine.
Basic Concepts Computer Organization and Assembly Language.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Codes and number systems Introduction to Computer Yung-Yu Chuang with slides by Nisan & Schocken ( ) and Harris & Harris (DDCA)
+ CS 325: CS Hardware and Software Organization and Architecture Exam 1: Study Guide.
Computer Organization and Assembly Languages Yung-Yu Chuang
Assembly Language for Intel-Based Computers, 5th Edition
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this slide show for your personal use, or for.
Computers Organization & Assembly Language
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
ACOE2511 ACOE251/AEEC335 -Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
Comp Sci 251 Intro 1 Computer organization and assembly language Wing Huen.
Chapter 1: Basic Concepts
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Assembly Language for x86 Processors 7 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Introduction to Computer Systems and the Java Programming Language.
CPU Internal memory I/O interface circuit System bus
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
CSNB374: Microprocessor Systems Chapter 1: Introduction to Microprocessor.
Introduction to Programming Instructor: Yong Tang Brookhaven National Laboratory Working on accelerator control (BNL Phone #)
ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
Assembly Language for Intel-Based Computers
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Sahar Mosleh California State University San MarcosPage 1 Assembly language and Digital Circuit By Sahar Mosleh California State University San Marcos.
CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.
ECE 2110: Introduction to Digital Systems
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
Data Representation COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
1 Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine 9/6/2003.
Data Representation COE 308 Computer Architecture
Today's Agenda What is Computer Architecture?
Data Representation ICS 233
Lec 3: Data Representation
Assembly Language for x86 Processors 6th Edition
Data Representation.
Assembly Language (CSW 353)
3.1 Denary, Binary and Hexadecimal Number Systems
Data Representation Binary Numbers Binary Addition
Microprocessor Systems Design I
Microprocessor and Assembly Language
Fundamentals & Ethics of Information Systems IS 201
University of Gujrat Department of Computer Science
Assembly Language for x86 Processors 6th Edition
Data Representation COE 301 Computer Organization
Computer Organization and Assembly Languages Yung-Yu Chuang 2006/09/18
Computer Organization and Assembly Language
Data Representation ICS 233
Data Representation COE 308 Computer Architecture
Dr. Clincy Professor of CS
Presentation transcript:

Computer Organization and Assembly Languages 2007/11/10 Course overview Computer Organization and Assembly Languages 2007/11/10

Prerequisites Programming experience with some high-level language such C, C ++,Java …

Books Textbook Assembly Language for Intel-Based Computers, 4th Edition, Kip Irvine Reference The Art of Assembly Language, Randy Hyde Michael Abrash' s Graphics Programming Black Book, chap 1-22

Computer Architecture vs. Computer Organization Computer architecture deals with the functional behavior of a computer system as viewed by a programmer. Architecture refers to attributes visible to a programmer. Computer organization refers to operational units and their interconnections that realize the architectural specifications. Computer organization deals with structural relationships that are not visible to the programmer.

Computer Architecture vs. Computer Organization Computer architecture deals with the functional behavior of a computer system as viewed by a programmer. Architecture refers to attributes visible to a programmer. Computer organization refers to operational units and their interconnections that realize the architectural specifications. Computer organization deals with structural relationships that are not visible to the programmer.

What is “Computer Organization“ ? Computer Organization is the organization of computer components that are transparent to programmers, such as Processor, Memory, and I/O Devices. Computer Organization is not the same as Implementation Computer Any part of some implementation can fall into one of these categories. Memory Devices Processor Control Input Datapath Output

Why learn assembly? It is required. It is a foundation for computer architecture and compilers. At times, you do need to write assembly code. “I really don’t think that you can write a book for serious computer programmers unless you are able to discuss low-level details.” Donald Knuth

Why programming in assembly? It is all about lack of smart compilers Faster code, compiler is not good enough Smaller code , compiler is not good enough, e.g. mobile devices, embedded devices, also Smaller code → better cache performance → faster code Unusual architecture , there isn’t even a compiler or compiler quality is bad, eg GPU, DSP chips, even MMX.

Syllabus (topics we might cover) IA-32 Processor Architecture Assembly Language Fundamentals Data Transfers, Addressing, and Arithmetic Procedures Conditional Processing Integer Arithmetic Advanced Procedures Strings and Arrays Structures and Macros High-Level Language Interface BIOS Level Programming Real Arithmetic MMX Code Optimization

What you will learn Basic principle of computer architecture IA-32 modes and memory management Assembly basics How high-level language is translated to assembly How to communicate with OS Specific components, FPU/MMX Code optimization Interface between assembly to high-level language

Chapter.1 Overview Virtual Machine Concept Data Representation Boolean Operations

Assembly programming editor assembler debugger linker loader mov eax, Y add eax, 4 mov ebx, 3 imul ebx mov X, eax editor .asm assembler debugger .obj linker .exe loader

Virtual machines Abstractions for computers

High-Level Language Level 5 Application-oriented languages Programs compile into assembly language (Level 4) X:=(Y+4)*3

Assembly Language Level 4 Instruction mnemonics that have a one-to-one correspondence to machine language Calls functions written at the operating system level (Level 3) Programs are translated into machine language (Level 2) mov eax, Y add eax, 4 mov ebx, 3 imul ebx mov X, eax

Operating System Level 3 Provides services Programs translated and run at the instruction set architecture level (Level 2)

Instruction Set Architecture Level 2 Also known as conventional machine language Executed by Level 1 program (microarchitecture, Level 1)

Microarchitecture Level 1 Interprets conventional machine instructions (Level 2) Executed by digital hardware (Level 0)

Digital Logic Level 0 CPU, constructed from digital logic gates System bus Memory

Data representation Computer is a construction of digital circuits with two states: on and off You need to have the ability to translate between different representations to examine the content of the machine Common number systems: binary, octal, decimal and hexadecimal

Binary numbers Digits are 1 and 0 (a binary digit is called a bit) 1 = true 0 = false MSB –most significant bit LSB –least significant bit Bit numbering: A bit string could have different interpretations

Unsigned binary integers Each digit (bit) is either 1 or 0 Each bit represents a power of 2: Every binary number is a sum of powers of 2

Translating Binary to Decimal Weighted positional notation shows how to calculate the decimal value of each binary bit: dec = (Dn-1  2n-1) + (Dn-2  2n-2) + ... + (D1  21) + (D0  20) D = binary digit binary 00001001 = decimal 9: (1  23) + (1  20) = 9

Translating Unsigned Decimal to Binary Repeatedly divide the decimal integer by 2. Each remainder is a binary digit in the translated value: 37 = 100101

Binary addition Starting with the LSB, add each pair of digits, include the carry if present.

Integer storage sizes Standard sizes: Practice: What is the largest unsigned integer that may be stored in 20 bits?

Large measurements Kilobyte (KB), 210 bytes Megabyte (MB), 220 bytes Gigabyte (GB), 230 bytes Terabyte (TB), 240 bytes Petabyte Exabyte Zettabyte Yottabyte

Hexadecimal integers All values in memory are stored in binary. Because long binary numbers are hard to read, we use hexadecimal representation.

Translating binary to hexadecimal Each hexadecimal digit corresponds to 4 binary bits. Example: Translate the binary integer 000101101010011110010100 to hexadecimal:

Converting hexadecimal to decimal Multiply each digit by its corresponding power of 16: dec = (D3  163) + (D2  162) + (D1  161) + (D0  160) Hex 1234 equals (1  163) + (2  162) + (3  161) + (4  160), or decimal 4,660. Hex 3BA4 equals (3  163) + (11 * 162) + (10  161) + (4  160), or decimal 15,268.

Powers of 16 Used when calculating hexadecimal values up to 8 digits long:

Converting decimal to hexadecimal decimal 422 = 1A6 hexadecimal

Hexadecimal addition Divide the sum of two digits by the number base (16). The quotient becomes the carry value, and the remainder is the sum digit. 1 1 36 28 28 6A 42 45 58 4B 78 6D 80 B5 Important skill: Programmers frequently add and subtract the addresses of variables and instructions.

Hexadecimal subtraction When a borrow is required from the digit to the left, add 10h to the current digit's value: -1 C6 75 A2 47 24 2E Practice: The address of var1 is 00400020. The address of the next variable after var1 is 0040006A. How many bytes are used by var1?

Signed integers The highest bit indicates the sign. 1 = negative, 0 = positive If the highest digit of a hexadecmal integer is > 7, the value is negative. Examples: 8A, C5, A2, 9D

Two's complement notation Steps: Complement (reverse) each bit Add 1 Note that 00000001 + 11111111 = 00000000

Binary subtraction When subtracting A – B, convert B to its two's complement Add A to (–B) 1 1 0 0 1 1 0 0 – 0 0 1 1 1 1 0 1 1 0 0 1 Advantages for 2’s complement: No two 0’s Sign bit Remove the need for separate circuits for add and sub

Ranges of signed integers The highest bit is reserved for the sign. This limits the range:

Character Character sets Null-terminated String Using the ASCII table Standard ASCII (0 – 127) Extended ASCII (0 – 255) ANSI (0 – 255) Unicode (0 – 65,535) Null-terminated String Array of characters followed by a null byte Using the ASCII table back inside cover of book

Boolean algebra Boolean expressions created from: NOT, AND, OR

Digital gate diagram for NOT: Inverts (reverses) a boolean value Truth table for Boolean NOT operator: Digital gate diagram for NOT:

Digital gate diagram for AND: Truth if both are true Truth table for Boolean AND operator: Digital gate diagram for AND:

Digital gate diagram for OR: True if either is true Truth table for Boolean OR operator: Digital gate diagram for OR:

Operator precedence NOT > AND > OR Examples showing the order of operations: Use parentheses to avoid ambiguity

Truth Tables (1 of 3) A Boolean function has one or more Boolean inputs, and returns a single Boolean output. A truth table shows all the inputs and outputs of a Boolean function Example: X  Y

Truth Tables (2 of 3) Example: X  Y

Two-input multiplexer Truth Tables (3 of 3) Example: (Y  S)  (X  S)

What is “Computer (Instruction Set) Architecture“ ? The study of how to co-ordinate between levels of abstraction and how to design the programmer visible components Application Visible to Programmers Operating Compiler System (Instruction Set) Architecture Instr. Set Proc. I/O system Not Visible to Programmers Digital Design Circuit Design Implementation details are not part of the Architecture (See Ch. 1, page 7)