The von Neumann Machine

Similar documents
The von Neumann Machine

Instruction Set Architectures

Instruction Set Architectures

Today: Machine Programming I: Basics

CS241 Computer Organization Spring Introduction to Assembly

Instruction Set Architectures

Carnegie Mellon. 5 th Lecture, Jan. 31, Instructors: Todd C. Mowry & Anthony Rowe

MACHINE-LEVEL PROGRAMMING I: BASICS COMPUTER ARCHITECTURE AND ORGANIZATION

MACHINE-LEVEL PROGRAMMING I: BASICS

Machine Level Programming I: Basics

Today: Machine Programming I: Basics. Machine Level Programming I: Basics. Intel x86 Processors. Intel x86 Evolution: Milestones

Introduction to IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung

Machine Level Programming I: Basics. Credits to Randy Bryant & Dave O Hallaron

Introduction to Machine/Assembler Language

Credits and Disclaimers

Assembly I: Basic Operations. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

How Software Executes

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

CS241 Computer Organization Spring 2015 IA

Assembly Language Each statement in an assembly language program consists of four parts or fields.

+ Machine Level Programming: x86-64 History

RISC I from Berkeley. 44k Transistors 1Mhz 77mm^2

Registers. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth

Last Time: Floating Point. Intel x86 Processors. Lecture 4: Machine Basics Computer Architecture and Systems Programming ( )

Meet & Greet! Come hang out with your TAs and Fellow Students (& eat free insomnia cookies) When : TODAY!! 5-6 pm Where : 3rd Floor Atrium, CIT

x86 Programming I CSE 351 Winter

CS 16: Assembly Language Programming for the IBM PC and Compatibles

Complex Instruction Set Computer (CISC)

Instruction Set Architecture (ISA) Data Types

Binghamton University. CS-220 Spring x86 Assembler. Computer Systems: Sections

Today: Machine Programming I: Basics. Machine-Level Programming I: Basics. Intel x86 Processors. Intel x86 Evolution: Milestones

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Machine-Level Programming I Introduction

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

Chapter 3 Machine-Level Programming I: Basics. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

Intel x86-64 and Y86-64 Instruction Set Architecture

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p

Machine-Level Programming I Introduction

Machine-Level Programming I: Basics

x86 64 Programming I CSE 351 Autumn 2018 Instructor: Justin Hsia

x86-64 Assembly CSE 351 Winter 2018 Instructor: Mark Wyse

The Hardware/Software Interface CSE351 Spring 2013

Advanced Microprocessors

The x86 Architecture

Credits and Disclaimers

Assembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012

Hardware and Software Architecture. Chapter 2

EEM336 Microprocessors I. The Microprocessor and Its Architecture

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

Machine/Assembler Language Putting It All Together

MODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE

Machine- Level Programming I: Basics

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CSC 252: Computer Organization Spring 2018: Lecture 5

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 03, SPRING 2013

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit

x86 Programming I CSE 351 Autumn 2016 Instructor: Justin Hsia

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

CS165 Computer Security. Understanding low-level program execution Oct 1 st, 2015

X86 Assembly -Data II:1

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature

Machine-Level Programming Introduction

Access. Young W. Lim Fri. Young W. Lim Access Fri 1 / 18

CS 261 Fall Machine and Assembly Code. Data Movement and Arithmetic. Mike Lam, Professor

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 4

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

Machine Programming 3: Procedures

Access. Young W. Lim Sat. Young W. Lim Access Sat 1 / 19

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Chapter 2: The Microprocessor and its Architecture

Assembly Language Programming 64-bit environments

Software. Hardware. x86 basics. ISA View. a brief history of x86 10/6/15. Program, Application. Programming Language. Compiler/Interpreter

CMSC Lecture 03. UMBC, CMSC313, Richard Chang

The x86 Architecture. ICS312 - Spring 2018 Machine-Level and Systems Programming. Henri Casanova

C to Assembly SPEED LIMIT LECTURE Performance Engineering of Software Systems. I-Ting Angelina Lee. September 13, 2012

Systems I. Machine-Level Programming I: Introduction

CS Bootcamp x86-64 Autumn 2015

Machine Programming I: Basics

EEM336 Microprocessors I. Addressing Modes

Today: Machine Programming I: Basics. Machine-Level Programming I: Basics. Intel x86 Processors. Intel x86 Evolution: Milestones

Machine Program: Procedure. Zhaoguo Wang

Machine-Level Programming Introduction

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

Function Calls and Stack

Machine Level Programming: Basics

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

x86 Assembly Tutorial COS 318: Fall 2017

Addressing Modes on the x86

x86-64 Programming I CSE 351 Summer 2018 Instructor: Justin Hsia Teaching Assistants: Josie Lee Natalie Andreeva Teagan Horkan

Machine Level Programming: Basics

Reverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher

Machine- Level Programming II: Arithme6c & Control

Module 3 Instruction Set Architecture (ISA)

Reverse Engineering II: The Basics

Machine-Level Programming I: Introduction Jan. 30, 2001

CSC 8400: Computer Systems. Machine-Level Representation of Programs

Transcription:

The von Neumann Machine 1 1945: John von Neumann Wrote a report on the stored program concept, known as the First Draft of a Report on EDVAC also Alan Turing Konrad Zuse Eckert & Mauchly The basic structure proposed in the draft became known as the von Neumann machine (or model). a memory, containing instructions and data a processing unit, for performing arithmetic and logical operations a control unit, for interpreting instructions

The von Neumann Machine Abstraction of von Neumann Architecture stores both program instructions and data 2 decodes current instruction, manages processing unit to carry out instruction program counter: points to the next instruction to be fetched instruction register: stores current instruction

Intel x86 History 3 Totally dominate laptop/desktop/server market Evolutionary design Backwards compatible up until 8086, introduced in 1978 Added more features as time goes on Complex instruction set computer (CISC) Many different instructions with many different formats But, only small subset encountered with Linux programs Hard to match performance of Reduced Instruction Set Computers (RISC) But, Intel has done just that! In terms of speed. Less so for low power.

Intel x86 History 4 Name Date Transistors MHz 8086 1978 29K 5-10 First 16-bit processor. Basis for IBM PC & DOS 1MB address space 80386 1985 275K 16-33 First 32 bit processor, referred to as IA32 Added flat addressing Capable of running Unix 32-bit Linux/gcc uses no instructions introduced in later models Pentium 4F 2004 125M 2800-3800 First 64-bit processor, referred to as x86-64 Core i7 2008 731M 2667-3333 Our shark machines

Intel x86 History 5 Architectures Processors X86-16 8086 X86-32/IA32 MMX SSE SSE2 SSE3 X86-64 / EM64t SSE4 286 386 486 Pentium Pentium MMX Pentium III Pentium 4 Pentium 4E Pentium 4F Core 2 Duo Core i7 time

Intel x86 History Intel Attempted Radical Shift from IA32 to IA64 Totally different architecture (Itanium) Executes IA32 code only as legacy Performance disappointing 6 AMD Stepped in with Evolutionary Solution x86-64 (now called AMD64 ) Intel Felt Obligated to Focus on IA64 Hard to admit mistake or that AMD's approach is better 2004: Intel Announces EM64T extension to IA32 Extended Memory 64-bit Technology Almost identical to x86-64! All but low-end x86 processors support x86-64 But, lots of code still runs in 32-bit mode

von Neumann View of x86 7 CPU PC Registers Condition Codes Addresses Data Instructions Memory Object Code Program Data OS Data Stack

High-level x86 CPU 8 Programmer-Visible State PC: Program counter Address of next instruction Called EIP (IA32) or RIP (x86-64) Register file Heavily used program data Condition codes Store status information about most recent arithmetic operation Used for conditional branching CPU PC Registers Condition Codes

general purpose IA32 Integer Registers 9 CPU PC Registers 16-bit virtual registers (backwards compatibility) Condition Codes %eax %ax %ah %al %ecx %cx %ch %cl %edx %dx %dh %dl %ebx %bx %bh %bl %esi %si %edi %di %esp %sp %ebp %bp

High-level x86 Memory 10 Memory Byte addressable array Code, user data, (some) OS data Includes stack used to support procedures Memory Object Code Program Data OS Data Stack

Programming the Machine // C code... int imax(int first, int second) { 11 } if ( first >= second ) return first; return second; But the hardware only "understands" binary representations

Programming the Machine int imax(int first, int second) { 12 } if ( first >= second ) return first; return second; gcc -O0 -c -m32 -std=c99 imax.c 457f464c010100010000000000000000 00010003000100000000000000000000 00bc0000000000000034000000000028 0009000689558be50845453b7c0c8b05 084503eb458b5d0c00c3000047004343 203a55287562746e2f75694c616e6f72 3420352e322e382d62756e7575742934... But who wants to program in binary?

Programming the Machine int imax(int first, int second) { 13 } if ( first >= second ) return first; return second;... imax: pushl movl %ebp %esp, %ebp Solution: translate high-level language code into intermediate-level code which is more human-friendly, then translate that "assembly" code into the machine's langauge..l2:.l3:... movl 8(%ebp), %eax cmpl 12(%ebp), %eax jl.l2 movl 8(%ebp), %eax jmp.l3 movl 12(%ebp), %eax popl %ebp ret

Explanation: moving data 14 Source Dest Src,Dest C Analog Imm Reg Mem movl $0x4,%eax tmp = 0x4; movl $-147,(%eax) *p = -147; movl Reg Reg Mem movl %eax,%edx movl %eax,(%edx) tmp2 = tmp1; *p = tmp; Mem Reg movl (%eax),%edx tmp = *p;

x86-64 Integer Registers 15 %rax %eax %r8 %r8d %rbx %ebx %r9 %r9d %rcx %ecx %r10 %r10d %rdx %edx %r11 %r11d %rsi %esi %r12 %r12d %rdi %edi %r13 %r13d %rsp %esp %r14 %r14d %rbp %ebp %r15 %r15d Extend existing registers. Add 8 new ones. Make %ebp/%rbp general purpose

x86-64 Example int imax(int first, int second) { 16 } if ( first >= second ) return first; return second;... movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jl.l2 movl -4(%rbp), %eax jmp.l3.l2: movl -8(%rbp), %eax.l3:...