CS 215 Introduction to Assembly Language and Computer Architecture.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Chapter 8: Central Processing Unit
INSTRUCTION SET ARCHITECTURES
Chapter 10- Instruction set architectures
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
EEE226 MICROPROCESSORBY DR. ZAINI ABDUL HALIM School of Electrical & Electronic Engineering USM.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Computer Organization. This module surveys the physical resources of a computer system. –Basic components CPUMemoryBus I/O devices –CPU structure Registers.
Processor Technology and Architecture
The Analytical Engine Module 6 Program Translation.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
State Machines Timing Computer Bus Computer Performance Instruction Set Architectures RISC / CISC Machines.
1 Lecture-2 CS-120 Fall 2000 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Topic 1: Introduction to Computers and Programming
CIS 260 Computer Programming I in C Prof. Timothy Arndt.
CS102 Introduction to Computer Programming
Computer Organization Computer Organization & Assembly Language: Module 2.
Intro to CS Chapt 2 Data Manipualtion 1 Data Manipulation How is data manipulated inside a computer? –How is data input? –How is it stored? –How is it.
Topics Introduction Hardware and Software How Computers Store Data
CS-2710 Computer Organization Dr. Mark L. Hornick web: faculty-web.msoe.edu/hornick – CS-2710 info syllabus, homework, labs… –
Introduction to CS-215 Computer Organization & Assembly Language: Module 0.
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
COMP2011 Assembly Language Programming and Introduction to WRAMP.
CISC105 General Computer Science Class 1 – 6/5/2006.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Digital Design and Computer Architecture Dr. Robert D. Kent LT Ext Lecture 1 Introduction.
CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface.
Computer Architecture And Organization UNIT-II General System Architecture.
Computer Engineering Rabie A. Ramadan Lecture 1. 2 Welcome Back.
1 Programming Fundamentals How to Program in C++ How to Program in C++
ELEN 033 Lecture #1 Tokunbo Ogunfunmi Santa Clara University.
Important Concepts  Parts of the CPU  Arithmetic/Logic Unit  Control Unit  Registers  Program Counter  Instruction Register  Fetch/Decode/Execute.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
Indira Gandhi National Open University presents. A Video Lecture Course: Computer Platforms.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Electronic Analog Computer Dr. Amin Danial Asham by.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Logic Design / Processor and Control Units Tony Diep.
Chapter 1 Getting Acquainted With Computers, Programs, and C++
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO CS 219 Computer Organization.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
MIPS assembly. Computer  What’s in a computer?  Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Operating Systems A Biswas, Dept. of Information Technology.
© 2015 Pearson Education Limited 2015 Quiz in last 15 minutes Midterm 1 is next Sunday Assignment 1 due today at 4pm Assignment 2 will be up today; due.
MIPS Instruction Set Advantages
Topics Introduction Hardware and Software How Computers Store Data
Control Unit Lecture 6.
CSCI-235 Micro-Computer Applications
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Microprocessor Systems Design I
Prof. Sirer CS 316 Cornell University
T Computer Architecture, Autumn 2005
Topics Introduction Hardware and Software How Computers Store Data
Overview of Computer Architecture and Organization
Introduction to Microprocessor Programming
Introduction to Computer Systems
CPU Structure CPU must:
Chapter 4 The Von Neumann Model
Presentation transcript:

CS 215 Introduction to Assembly Language and Computer Architecture

Course topics  Computer Organization Computer Components  CPU, memory, I/O devices, bus Representing information  Integers, real numbers, text characters, machine code Arithmetic operations  Assembly Language Basic features Translation (C  assembly language) Data structures Procedures I/O Operations

Course activities  Computer Organization Representing information  Encode and decode various types of data How is 3.14 represented by a computer? What unsigned integer is represented by the byte ? Arithmetic operations  Demonstrate the (addition/subtraction/multiplication/division) of two (integers/real numbers) using one of the algorithms for hardware operations presented in class Requires an understanding of the representations

Course activities  Assembly Language Translation (C++  assembly language)  Implement a C++ code fragment in assembly language Procedures  Implement a C++ function in assembly language Use activation records Programmed I/O  Write code which manages I/O to a device monitor, keyboard

Focus: MIPS R2000 Assembly Language  The MIPS R2000 is an old CPU from SGI Modern MIPS used in SGI workstations, Sony PS2 All MIPS chips use nearly the same assembly language MIPS assembly language is very similar to that of the PowerPC chip, the heart of the Apple Macintosh  Why MIPS R2000 Simple, easily learned language Straight-forward architecture Freely available simulator: SPIM

Why study assembly language?  Developing a more accurate model of computation is the main goal of this course  A software engineer who understands how a computer works will be able to: design more efficient code program for devices other than PCs Better understand hardware, OS, libraries, network, source code, etc.

What is a model?  A model is a partial representation of a system incomplete specific purpose  Multiple models for different purposes Model of the city of Milwaukee for  MCTS bus driver  MMSD engineer  Bicyclist  Commercial airline pilot

Level of detail  Eliminating distracting detail enables focus on aspects of interest, get higher level perspectives street maps for navigation do not show buildings and topography  More detail is NOT necessarily better A detailed schematic of a car engine would not help the average motorist troubleshoot a sputtering engine  A flow chart would be better A city map that shows every alley is less useful to a visitor than one that shows just major roads

Abstraction  Modeling is about abstraction: building general, high-level concept pictures  Models often abstract away variation Access to UWM computers requires authentication The authentication abstraction filters out mechanism  login-password, fingerprint recognition, ID badge, etc.  Different abstractions, levels of abstraction depending on aspects of interest, degree of expertise

Learning is model refinement  The primary purpose of modeling is to improve understanding Observing differences between the model and reality shows us gaps in our understanding  This is how learning works, according to educational theory  Cognitive dissonance Learn is updating our model to better predict reality

Novice user’s model of computation  A computer is a machine that: Can generate video and sound, like a TV responds to input from a keyboard and a mouse  Unlike a TV must be plugged into the Internet to work properly  Like a TV needs cable, or an antenna  This is a useful model for word-processing, , web browsing, copying CD’s, etc.  Programming requires a more detailed model

CS-201 model of computation  A computer is a machine that executes a C++ program, by Executing each line of the program sequentially, subject to control structures and function calls Allowing the program to receive text input from the keyboard, or a file Allowing the program to produce text output to the monitor, or a file C++ Program Computer

A more complex model of computation  A computer executes machine instructions, and can control a variety of input/output devices  Compiler language definition settings implementation details  Operating system resource allocation device management  CPU machine instructions addressing modes CPU Operating System Compiler C++ Program

Programming Language as Abstraction  A primitive is an elementary operation.  A primitive in a higher level of abstraction can correspond to a set of operations in a lower level of abstraction. For example, Operators of Language A: {+, -, *, /} Operators of Language B: {+, -}  Let 5*2 be a statement in Language A. What is its equivalent in Language B?

Monadic vs. Dyadic  For the most part, the computer hardware is limited to executing monadic and dyadic operations  monadic - takes a single operand, e.g. taking the complement  dyadic - takes two operand, e.g. adding two values

The assembly process  Ultimately, instructions written in a higher level abstraction must be expanded to the primitives the hardware understands directly, the machine language.  For example, high-level language to assembly language using a compiler; then from assembly language to machine language using an assembler

Compilers vs. Assemblers  A compiler is a computer program that translates a high-level language, e.g. C++, into an intermediate-level language, e.g. assembly language.  An assembler is a computer program that translates an assembly language into machine language (string of binary digits).

Computer Architecture  Defines what the computer’s instruction do and how they are specified  The set of instructions determine the computer’s capability  A computer’s machine language is determined by its manufacturer  The assembly language is also formally defined by the manufacturer

SAL, MAL, TAL  SAL (Simple Abstract Language) contains the notion of types similar to HLL and is based on MAL  MAL (MIPS Assembly Language) more abstract and easier to use than TAL. The MIPS RISC assembler translates MAL into TAL, then TAL into MIPS RISC machine code  TAL (True Assembly Language) exactly corresponds with hardware operations

Computer Execution  A computer’s processor executes instructions.  The instructions specifies how variables are to be manipulated and stored in memory.  A variable in the machine language must be assigned a specific memory location. This process of assigning a memory location is called binding.

Example A statement in a high-level language (HLL) A = B + C; An equivalent assembly language instruction may be add A, B, C  The mnemonic add stands for an operation code (opcode) and A, B, and C are the operands

CPU and the Memory  The Central Processing Unit (CPU) is responsible for instruction execution. determines how the memory is to be modified.  The Main Memory is a collection of cells and each cell is assigned a label a cell can hold a value.  CPU stores a new variable value, fetches instructions, or loads a variable value.

Instruction Types  There are three instruction types: Arithmetic, Logical, and Control  Arithmetic and logical instructions evaluate variables and assign new values to variables  Control instructions test or compare values of variables and make decisions about what instruction is going to be executed next.

Fetch-Decode-Execute Cycle  A computer’s complete functionality is described by this mechanism. 1. instruction fetch 2. program counter (PC) update 3. instruction decode 4. operand load 5. operation execution 6. storage of results

Example x1 = x2 + x3; x4 = x2 - x5; if(x4 != x1){ x1 = x1 + x5; } else Next part...

Example part1: add x1,x2,x3 subx4,x2,x5 beq x4,x1,part2 add x1,x1,x5 part2:...