程序代写代做代考 compiler assembler assembly GPU cache mips Java Introduction

Introduction

Introduction
COE 301
Computer Organization
Prof. Muhamed Mudawar
Computer Engineering Department
King Fahd University of Petroleum and Minerals

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Presentation Outline
Welcome to COE 301
Assembly-, Machine-, and High-Level Languages
Classes of Computers
Technology Improvements
Programmer’s View of a Computer System

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Welcome to COE 301
Instructor: Dr. Muhamed F. Mudawar
Office: Building 22, Room 410-2
Office Phone: 4642
Schedule and Office Hours:
http://faculty.kfupm.edu.sa/coe/mudawar/schedule/
Course Web Page:
http://faculty.kfupm.edu.sa/coe/mudawar/coe301/
Email:
mudawar@kfupm.edu.sa

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Which Textbook will be Used?
Computer Organization & Design:
The Hardware/Software Interface
Fifth Edition, 2013
David Patterson and John Hennessy
Morgan Kaufmann
Read the textbook in addition to slides

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Grading Policy
MIPS Programming 8%
Quizzes 12%
Lab Work 10%
CPU Design Project 15%
Midterm Exam 25%
Final Exam 30%
No makeup will be given for missing exam or quiz

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Software Tools
MIPS Simulators
MARS: MIPS Assembly and Runtime Simulator
Runs MIPS-32 assembly language programs
Website: http://courses.missouristate.edu/KenVollmar/MARS/
SPIM
Also Runs MIPS-32 assembly language programs
Website: http://www.cs.wisc.edu/~larus/spim.html
CPU Design and Simulation Tool
Logisim
Educational tool for designing and simulating CPUs
Website: http://ozark.hendrix.edu/~burch/logisim/

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Course Learning Outcomes
Towards the end of this course, you should be able to …
Describe the instruction set architecture of a processor
Analyze, write, and test assembly language programs
Describe organization/operation of integer & floating-point units
Design the datapath and control of a single-cycle CPU
Design the datapath/control of a pipelined CPU & handle hazards
Describe the organization/operation of memory and caches
Analyze the performance of processors and caches
Required Background
Ability to program confidently in Java or C
Ability to design a combinational and sequential circuit

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Next . . .
Welcome to COE 301
Assembly-, Machine-, and High-Level Languages
Classes of Computers
Technology Improvements
Programmer’s View of a Computer System

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Some Important Questions to Ask
What is Assembly Language?
What is Machine Language?
How is Assembly related to a high-level language?
Why Learn Assembly Language?
What is an Assembler, Linker, and Debugger?

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
A Hierarchy of Languages

Application Programs
High-Level Languages
Assembly Language
Machine Language
Hardware

High-Level Language
Low-Level Language
Machine independent
Machine specific

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Assembly and Machine Language
Machine language
Native to a processor: executed directly by hardware
Instructions consist of binary code: 1s and 0s
Assembly language
Slightly higher-level language
Readability of instructions is better than machine language
One-to-one correspondence with machine language instructions
Assemblers translate assembly to machine code
Compilers translate high-level programs to machine code
Either directly, or
Indirectly via an assembler

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Compiler and Assembler

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›

MIPS Assembly Language:
sll $2,$5, 2
add $2,$4,$2
lw $15,0($2)
lw $16,4($2)
sw $16,0($2)
sw $15,4($2)
jr $31
Compiler
Translating Languages
Program (C Language):
swap(int v[], int k) {
int temp;
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
}
A statement in a high-level language is translated typically into several machine-level instructions

MIPS Machine Language:
00051080
00821020
8C620000
8CF20004
ACF20000
AC620004
03E00008

Assembler

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Advantages of High-Level Languages
Program development is faster
High-level statements: fewer instructions to code
Program maintenance is easier
For the same above reasons
Programs are portable
Contain few machine-dependent details
Can be used with little or no modifications on different machines
Compiler translates to the target machine language
However, Assembly language programs are not portable

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Why Learn Assembly Language?
Many reasons:
Accessibility to system hardware
Space and time efficiency
Writing a compiler for a high-level language
Accessibility to system hardware
Assembly Language is useful for implementing system software
Also useful for small embedded system applications
Programming in Assembly Language is harder
Requires deep understanding of the processor architecture
However, it is very rewarding to system software designers
Adds a new perspective on how programs run on real processors

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Assembly Language Programming Tools
Editor
Allows you to create and edit assembly language source files
Assembler
Converts assembly language programs into object files
Object files contain the machine instructions
Linker
Combines object files created by the assembler with link libraries
Produces a single executable program
Debugger
Allows you to trace the execution of a program
Allows you to view machine instructions, memory, and registers

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Assemble and Link Process

Source
File

Source
File

Source
File

Assembler

Object
File

Assembler

Object
File

Assembler

Object
File

Linker

Executable
File

Link
Libraries
A program may consist of multiple source files
Assembler translates each source file into an object file
Linker links all object files together and with link libraries
The result executable file can run directly on the processor

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
MARS Assembler and Simulator Tool

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
MARS Assembler and Simulator Tool
Simulates the execution of a MIPS program
No direct execution on the underlying Intel processor
Editor with color-coded assembly syntax
Allows you to create and edit assembly language source files
Assembler
Converts MIPS assembly language programs into object files
Console and file input/output using system calls
Debugger
Allows you to trace the execution of a program and set breakpoints
Allows you to view machine instructions, edit registers and memory
Easy to use and learn assembly language programming

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Next . . .
Welcome to COE 301
Assembly-, Machine-, and High-Level Languages
Classes of Computers
Technology Improvements
Programmer’s View of a Computer System

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Classes of Computers
Personal computers
General purpose, variety of software, subject to cost/performance
Server computers
Network based, high capacity, performance, and reliability
Range from small servers to building sized
Supercomputers
High-end scientific and engineering calculations
Highest capability but only a small fraction of the computer market
Embedded computers
Hidden as components of systems
Stringent power/performance/cost constraints

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Classes of Computers (cont’d)
Personal Mobile Device (PMD)
Battery operated
Connects to the Internet
Low price: hundreds of dollars
Smart phones, tablets, electronic glasses
Cloud Computing
Warehouse Scale Computers (WSC)
Software, Platform, and Infrastructure as a Service
However, security concerns of storing “sensitive data” in “the cloud”
Examples: Amazon and Google

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Components of a Computer System
Processor
Datapath and Control
Memory & Storage
Main Memory
Disk Storage
Input / Output devices
User-interface devices
Network adapters
For communicating with other computers
Bus: Interconnects processor to memory and I/O
Essentially the same components for all kinds of computers

Computer

Memory
I/O Devices

Input

Output

BUS

Control
Datapath
Processor

Disk

Network

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Fetch instruction
Compute address of next instruction
Generate control signals for instruction
Read operands from registers
Compute result value
Writeback result in a register
Fetch – Execute Cycle
Instruction Decode
Instruction Fetch
Execute
Writeback Result
Infinite Cycle implemented in Hardware
Memory Access
Read or write memory

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Clock
Operation of digital hardware is governed by a clock
Clock period: duration of a clock cycle
e.g., 250 ps = 0.25 ns = 0.25 ×10–9 sec
Clock frequency (rate) = 1 / clock period
e.g., 1/ 0.25 ×10–9 sec = 4.0×109 Hz = 4.0 GHz

Clock (cycles)
Data transfer
and computation
Update state

Clock period

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Memory and Storage Devices
Volatile Memory Devices
RAM = Random Access Memory
DRAM = Dynamic RAM
Dense but must be refreshed (typical choice for main memory)
SRAM: Static RAM
Faster but less dense than DRAM (typical choice for cache memory)
Non-Volatile Storage Devices
Magnetic Disk
Flash Memory (Solid State Disk)
Optical Disk (CDROM, DVD)

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Units for Storage and Memory

Size of disk storage
Value = 10n (base 10)

Size of memory
Value = 2n (base 2)
The binary terms are used to avoid the confusion with the commonly used decimal terms. The size of memory is 2n because the memory address is an n-bit binary number.

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Next . . .
Welcome to COE 301
Assembly-, Machine-, and High-Level Languages
Classes of Computers
Technology Improvements
Programmer’s View of a Computer System

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›

Technology Trends
Electronic Technology continues to improve
Increased capacity
Performance
Reduced cost
DRAM capacity
4X every 3 years
Slowed down to 2X
Year Technology Relative performance/cost
1951 Vacuum tube 1
1965 Transistor 35
1975 Integrated circuit (IC) 900
1995 Very large scale IC (VLSI) 2,400,000
2013 Ultra large scale IC 250,000,000,000

DRAM capacity

Introduction COE 301 – Computer Organization – KFUPM © Muhamed Mudawar – slide ‹#›
Chip Manufacturing Process

20-30 cm diameter
30-60 cm long
< 1 mm thick Cost of a wafer fab (fabrication) is estimated at over $10 billion Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› From Sand to Silicon Sand (beach) has a high percentage of Silicon in the form of Silicon dioxide (SiO2) Melted Silicon is purified in many steps to reach semiconductor manufacturing quality Silicon Ingot: diameter = ~30 cm, weight = ~100 Kg, Silicon purity = 99.9999999% (one alien atom per billion silicon atoms) Source: Intel corporation Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Ingot Slicing  Blank Wafers The ingot is cut into individual silicon disks, called wafers The thickness of a wafer is about 1 mm The wafers are polished until they have mirror-smooth surfaces Wafer diameter = 300mm, but future ones can be 450mm Source: Intel corporation Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Fabrication of Chips on a Wafer Hundreds of precisely controlled steps Patterned layers of various materials one on top of another Ion Implantation: the wafer is bombarded with a beam of ions that are embedded in selected regions of the wafer Dielectric Deposition: using an insulator to reduce leakage Photo Lithography: uses photo-resist and ultraviolet (UV) light to expose a pattern from a photomask to the surface of a wafer Etching: unneeded material is removed to create patterns Metal Layers: multiple metal layers are made to interconnect the various transistors Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Fabrication of Transistors and Metal Layers Ion Implantation Photo Lithography Dielectric Deposition Metal Layers Interconnect the transistors Making of a Transistor Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Wafer of Intel 8th Generation Core i7 Dies Wafer diameter = 30cm (300mm) Wafer has 393 dies Area of a single die ≈ 149.6 mm2 ~9.19 mm by ~16.28 mm Six cores + GPU on a single die About 3.6 billion transistors per die 14 nm manufacturing process 11 metal layers Incomplete dies on the boundary are useless and discarded. They use the same masks used to pattern the wafer. Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Testing the Dies on the Wafer Test patterns are fed into the inputs of each chip on the wafer, and the outputs are compared with the correct values The wafer is cut into pieces called dies The dies that passes the test are kept, and the rest is discarded Source: Intel corporation Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Bonding Die to Package and Final Test The substrate, the die, and the heat-spreader are put together to form a complete processor The green substrate is the interface between the processor and the rest of the PC system (up to several thousand pins) Finally, the processor are tested for their key characteristics, such as power dissipation and maximum frequency Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Next . . . Welcome to COE 301 Assembly-, Machine-, and High-Level Languages Classes of Computers Technology Improvements Programmer's View of a Computer System Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Programmer’s View of a Computer System Application Programs High-Level Language Assembly Language Operating System Instruction Set Architecture Microarchitecture Physical Design Level 0 Level 1 Level 2 Level 3 Level 4 Level 5 Increased level of abstraction Each level hides the details of the level below it Software Hardware Interface SW & HW Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Programmer's View (cont'd) Application Programs (Level 5) Written in high-level programming languages Such as Java, C++, Pascal, Visual Basic . . . Programs compile into assembly language level (Level 4) Assembly Language (Level 4) Instruction mnemonics (symbols) are used Have 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) Operating System (Level 3) Provides services to level 4 and 5 programs Translated to run at the machine instruction level (Level 2) Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› Programmer's View (cont'd) Instruction Set Architecture (Level 2) Interface between software and hardware Specifies how a processor functions Machine instructions, registers, and memory are exposed Machine language is executed by Level 1 (microarchitecture) Microarchitecture (Level 1) Controls the execution of machine instructions (Level 2) Implemented by digital logic Physical Design (Level 0) Implements the microarchitecture at the transistor-level Physical layout of circuits on a chip Introduction COE 301 – Computer Organization - KFUPM © Muhamed Mudawar – slide ‹#› /docProps/thumbnail.jpeg