Chapter 7, The Assembly Language Level 7.1 Introduction To Assembly Language 7.2 Macros 7.3 The Assembly Process 7.4 Linking And Loading 7.

Size: px
Start display at page:

Download "Chapter 7, The Assembly Language Level 7.1 Introduction To Assembly Language 7.2 Macros 7.3 The Assembly Process 7.4 Linking And Loading 7."

Transcription

1 Chapter 7, The Assembly Language Level 7.1 Introduction To Assembly Language 7.2 Macros 7.3 The Assembly Process 7.4 Linking And Loading 7.5 Summary 1 of 19 ECE 357

2 The Assembly Language Level AST: The assembly language level differs in a significant respect it is implemented by translation rather than by interpretation. Programming Considerations High-Level Language Compiled in Compiler Object or Assembly Language Code Generated Assembly Language Assembled in Assembler Object Code Generated May be optional if no assembly language present Link Object Code Modules Create Machine Executable Binary Code (*.exe) Machine code mnemonic equivalent, memory map, variable table, etc. Machine Code Mnemonics When using software development tools with a microprocessor or microcontroller, the machine code mnemonics used are the same as the assembly language. As the text states, A pure assembly language is a language in which each statement produces exactly one machine instruction. In other words, there is a one-to-one correspondence between machine instructions and statements in the assembly program. Therefore, the assembly language must be an interpreted language. Right? 2 of 19 ECE 357

3 Assembly Language Level Text DefinitionThe text introduces assembly language level by stating, it is implemented by translation rather than interpretation. How can both be right? An assembly language level vs. a pure assembly language! A Subtle PointWhen a programmer writes assembly language code, it really isn t a pure assembly language anymore. High-Level Language Constructs: Symbolic Variable Names and Addresses Macrofunctions Pseudoinstruction/Assembler Directives As written today, the assembly language is translated into object code and then linked. The text is right, but be careful who you talk to... Old timers (some of those you will interview for jobs with) and microcontroller people likely believe in a pure assembly language. What you learn and believe in college is hard to unlearn or believe in the future but sometimes it is useful or even necessary. This may sound like semantics, but others peoples thoughts on and decisions effecting your ability and career potential may depend on it (employment interviews coming soon?). 3 of 19 ECE 357

4 Modern Concepts Compiler: Assembler: Translates High-Level Languages into a symbolic language or a numerical machine language Translates a symbolic representation of the machine language into a numerical machine language Therefore: The assembly language must be a symbolic language Writing Code in Assembly Language (1) Much more tedious than coding in a High-Level Language (2) There are more instructions than in a HLL required to perform the same function (S/W programming aspect) (3) The final code is faster and more dense Drivers ISRs Embedded applications where operation rates, memory or registers are at a premium Making Code run faster: The Relationship 10% of the program is responsible for 90% of the execution time. The 1-50 common code extension 1 % of the program is responsible for 50% of the execution time If you want to speed up the program, where would you start? The 1% and then the other 9%! But, it takes much longer to write assembly code than HLL! 4 of 19 ECE 357

5 Benchmark Tradeoff Program manager s software coding estimates: For complete code with design, documentation, coding, and code test completed. HLL: 4-8 lines-of-code (LOC) per hour ASM: 8+ LOC per hour but will require 4-8 times the number of lines While there is at least a 2x speedup in writing code, the number of lines will expand by a factor of from 4x to 8x (resulting in 2x to 4x longer development times) 5 of 19 ECE 357

6 Practical Business Approach Prototype in a high-level language Use a process monitor or trace of the execution to determine execution time and flow Rewrite critical or slow segments Important Issues/Features Improved performance Resource limits and limitations memory size, number of registers, screen size (PDAs) Compiler Issues Compiler generated code: Can the output be read and comprehended? (Is it useful for rewriting into assembly language?) Understanding a compiler: Can you make it do what you want? Writing compilers: Someone has to (TI bought a company for their VLIW processor line) Expose the real machine remove layers of indirection and/or complexity Another Similar Relationships in Engineering: HLL to ASM relationship for software VHDL/Verilog Code and Synthesis to custom IC Design and Layout for ICs Faster development and delivery, larger product vs. Slower development and delivery, smaller more optimized result Many companies make two versions the fast time to market one (sell at a loss or for no profit) the slower lower manufacturing cost one (where the profit comes from) 6 of 19 ECE 357

7 The Assembly Language as a translated language Format of an assembly language already observed somewhat at the ISA level with some things added and other left out. Labels/Variables/Symbolic names Pseudo Operations or Pseudo Instructions Reserve memory space ASM Language Fields: (1) Label, (2) Opcode, (3) Result and Operand Fields, (4) Comments Comments on the code: Syntax are unique but similar Comments fields delimited Storage is done explicitly based on data type. Initialization value can be provided 7 of 19 ECE 357

8 Pseudo Instruction (or) Assembler Directives An assembly language may also contain commands meant for the assembler. Examples follow: Pseudo Instruction Memory assignment (storage and initial values) Forced memory alignment (word boundaries, long-word boundaries, cache-lines?) Equate symbolic names BASE EQU 1000 BASE2 EQU (BASE ) Naming access (local or global) PUBLIC EXTERN INCLUDE Definitions, macros, structures, etc. Conditional Assembly (or Compilation) IF, ELSE, ENDIF COMMENT Redefine delimiters or other defined character or field 8 of 19 ECE 357

9 Pentium4 MASM Pseudoinstructions 9 of 19 ECE 357

10 Macros Do you use a macro or make a procedure call? Procedure calls are done during execution Macros are expanded at time of assembly known as a macro call The output machine code will not distinguish where a macro was use (you can t tell) After reverse assembly macros will not exist so it may be confusing at first. Macros make the machine code longer (require more memory storage space) Macros execute faster as no branching may be required (procedure calls and return overhead) The SWAP example: Writing a macro: 1. A macro header giving the name of the macro and any internal variables 2. The text comprising the body of the macro 3. An end-macro pseudoinstruction marking the end of the macro Macros may be included as an assembler directive for those commonly used, they may appear embedded in the assembly code, or they may appear as a group prior to or following the main body of the code. For documentation, clearly identifying macros is important! 10 of 19 ECE 357

11 Formal Parameters may be used to define a Macro. Actual parameters will be substituted when the macro is expanded (one for one replacement) Comparison: Macro vs. Procedure 11 of 19 ECE 357

12 Advanced Macros If there are internal labels, they must become unique after expansion (user or assembler) Example: M1 M2 M2 MACRO IF WORDSIZE GT 16 MACRO... ENDM ELSE MACRO... ENDM ENDIF ENDM M2 must be uniquely defined after macro expansion! If there are internal macro variables, they may also be required to be unique or planned to change. (e.g. Declare local variables or registers) Macros may call other macros or themselves a limit of recursion may be enforced. The existence of Macros require Assemblers to: Save macro definitions for use (a macro table with names and code) Expand macro calls (read and perform operations called for) Assembler pass one find all macros and place them in a Macro Table expand macros (when encountered replace with macro code) resolve all local variable names, labels etc. during the expansion. 12 of 19 ECE 357

13 The Assembly Process A multi-pass assembler is preferred, a two-pass assembler is possible. Multiple passes are required with forward referencing for variables and labels. 1 st Pass Assembly Build Tables of code and information about the code. Symbol Table, Opcode Table, Pseudoinstruction Table, (optional) Literal Table, Macro Table, etc. Maintain code/variable length information, relative/absolute values for the code/variable locations 2 nd to N-1 st Pass Assembly Resolve unknowns from previous pass. Determine Instruction Location Counts (ILC) Sort tables, remove duplicate reference, and resolve references in tables Nth Pass Assembly Output translated machine ISA/OSM language, provide debugging tables Maintain symbol table and code table for linking. 13 of 19 ECE 357

14 Tables Symbol Table One entry per variable name, label any symbolic name Data type, data storage size and location Relative ASM address location Opcode Table One entry per symbolic opcode Hold information about the opcode for execution Opcode machine code, operand addressing, ISA length, etc. Required to determine ILC Pdeudoinstruction Table Insertion points Macro expanded code description (ILC) Assembler directive instruction generation Literals Table One entry per constant/literal Hold information about constants or text strings Reserves memory and helps code readability and debugging 14 of 19 ECE 357

15 Example Code: Pass One Symbol/Labels Table Literal Table Opcode Table with type and length Write a modified file to be used during the next pass of assembly. 15 of 19 ECE 357

16 Example Code: Pass Two Evaluate and generate every line of machine language Provide outputs for both machine and programmer 16 of 19 ECE 357

17 Common Errors 1. Symbol undefined 2. Symbol multiple definitions 3. Illegal opcode 4. Opcode needs more or fewer operands 5. Illegal octal number/ hex number / binary number 6. Illegal register use 7. END statement missing A major source of error is DATA TYPEs Pascal/VHDL heavily typed languages. C/Verilog loosely typed languages. A debugging problem with ECE 4820 projects integer vs. floating point!!! Multiplication, addition, ADC/DAC input/output, coefficient storage 17 of 19 ECE 357

18 Speeding Up the Assembly Time Tables, particularly the symbol table, can be large. Would like to use content addressable memory or an associative memory, but (Symbol, Value) pairs for searching Realistic search algorithms 1. Linear search Dumb, slow, average N/2 access time 2. Binary search Assumes a sorted table (time on storage to sort, or a sort process before use) Faster, average log(n, base=2) access time 3. Hash Code with a linked list When K tables are available for storage Use a hashing function (a defined algorithm) to convert the symbol into a value between 1 and K (a table number) Add the symbol to the table as a member of a linked list Average table length = N/K Average access time = Hashing time + (N/K)/2 Notes: no sorting required, can be very fast for large tables. Speedup linear N 2 Hash N 2K K 1 2K Hash N for N very large, hashing time is minimal and the speedup becomes Speeduplinear K 18 of 19 ECE 357

19 Hashing example: Multiply the ASCII representation of symbol together. Take the modulo based on the number of tables, K, use a linked list to put it in Build a linked list (note, do not try the above computations in this list it doesn t work) 19 of 19 ECE 357

The Assembly Language Level

The Assembly Language Level The Assembly Language Level Translators can be divided into two groups. When the source language is essentially a symbolic representation for a numerical machine language, the translator is called an assembler,

More information

The Assembly Language Level

The Assembly Language Level The Assembly Language Level Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

More information

CS1101: Lecture 37 Introduction to Assembly Language

CS1101: Lecture 37 Introduction to Assembly Language CS1101: Lecture 37 Introduction to Assembly Language Dr. Barry O Sullivan b.osullivan@cs.ucc.ie Introduction What is Translation? Types of Translator Lecture Outline What is an Assembly Language? Assembly

More information

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present

More information

Chapter 1 Basic Concepts

Chapter 1 Basic Concepts Chapter 1 Basic Concepts 1.1 Welcome to Assembly Language 1 1.1.1 Good Questions to Ask 2 1.1.2 Assembly language Applications 5 1.1.3 Section Review 6 1.2 Virtual Machine Concept 7 1.2.1 History of PC

More information

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

CS 16: Assembly Language Programming for the IBM PC and Compatibles CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking

More information

SIT102 Introduction to Programming

SIT102 Introduction to Programming SIT102 Introduction to Programming After working through this session you should: Understand the relationships between operating systems, their user interfaces, and programs; Understand the difference

More information

Programming the Basic Computer. lecture 8

Programming the Basic Computer. lecture 8 Programming the Basic Computer lecture 8 Programming the Basic Computer A computer system includes both hardware and software. Hardware consist of the physical components. Software refers to computer programs.

More information

Assembly language programs are made up of statements. Each statement may be composed of constants, literals, names, mnemonics, operands, and comments.

Assembly language programs are made up of statements. Each statement may be composed of constants, literals, names, mnemonics, operands, and comments. CS221 Assembly Language Fundamentals : Irvine Chapter 3 While debug is good for writing very small programs and experimenting with memory, interrupts, and function calls, it is not very good for larger

More information

Chapter 2 Assemblers http://www.intel.com/multi-core/demos.htm

Chapter 2 Assemblers http://www.intel.com/multi-core/demos.htm Chapter 2 Assemblers http://www.intel.com/multi-core/demos.htm Source Program Assembler Object Code Linker Executable Code Loader 1 Outline 2.1 Basic Assembler Functions A simple SIC assembler Assembler

More information

Chapter 2 Assemblers -- Basic Assembler Functions

Chapter 2 Assemblers -- Basic Assembler Functions Chapter 2 Assemblers -- Basic Assembler Functions Outline Basic assembler functions A simple SIC assembler Assembler algorithm and data structure Basic assembler functions Translating mnemonic operation

More information

2 Programs: Instructions in the Computer

2 Programs: Instructions in the Computer 2 2 Programs: Instructions in the Computer Figure 2. illustrates the first few processing steps taken as a simple CPU executes a program. The CPU for this example is assumed to have a program counter (PC),

More information

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 603 203 DEPARTMENT OF COMPUTER APPLICATIONS QUESTION BANK IN REVISED BLOOM S TAXONOMY

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 603 203 DEPARTMENT OF COMPUTER APPLICATIONS QUESTION BANK IN REVISED BLOOM S TAXONOMY ACADEMIC YEAR: 0 7 VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 0 0 SEMESTER: ODD BRANCH: MCA YEAR: I SEMESTER: I SUBJECT CODE AND NAME: MC70 Problem Solving and Programming NAME OF THE FACULTY

More information

Write the program in Assembly Language using the Instructions Supported by your application s target processor/controller Converting the program from

Write the program in Assembly Language using the Instructions Supported by your application s target processor/controller Converting the program from EMBEDDED FIRMWARE The control algorithm (Program instructions) and or the configuration settings that an embedded system developer dumps into the code (Program) memory of the embedded system The embedded

More information

THE ASSEMBLY LANGUAGE LEVEL

THE ASSEMBLY LANGUAGE LEVEL 7 THE ASSEMBLY LANGUAGE LEVEL 1 Programmer-years to produce the program Program execution time in seconds Assembly language 50 33 High-level language 10 100 Mixed approach before tuning Critical 10% 1

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CHAPTER 4 MARIE: An Introduction to a Simple Computer CHAPTER 4 MARIE: An Introduction to a Simple Computer 4.1 Introduction 145 4.1.1 CPU Basics and Organization 145 4.1.2 The Bus 147 4.1.3 Clocks 151 4.1.4 The Input/Output Subsystem 153 4.1.5 Memory Organization

More information

P A R T DIGITAL TECHNOLOGY

P A R T DIGITAL TECHNOLOGY P A R T A DIGITAL TECHNOLOGY 1 CHAPTER NUMBERING SYSTEMS 1.0 INTRODUCTION This chapter discusses several important concepts including the binary, octal and hexadecimal numbering systems, binary data organization

More information

6.170 Tutorial 3 - Ruby Basics

6.170 Tutorial 3 - Ruby Basics 6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM

NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM 12 Digital Principles Switching Theory C HAPTER 1 NUMBERING SYSTEMS 1.0 INTRODUCTION Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk,

More information

1/20/2016 INTRODUCTION

1/20/2016 INTRODUCTION INTRODUCTION 1 Programming languages have common concepts that are seen in all languages This course will discuss and illustrate these common concepts: Syntax Names Types Semantics Memory Management We

More information

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 1: Basic Concepts Slides prepared by Kip R. Irvine Revision date: 10/27/2002 Chapter corrections (Web) Printing a slide show

More information

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine

More information

High level code and machine code

High level code and machine code High level code and machine code Teacher s Notes Lesson Plan x Length 60 mins Specification Link 2.1.7/cde Programming languages Learning objective Students should be able to (a) explain the difference

More information

8 Algorithms. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, students should be able to:

8 Algorithms. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, students should be able to: 8 Algorithms 8.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: Define an algorithm and relate it to problem solving. Define

More information

LC-3 Assembly Language

LC-3 Assembly Language LC-3 Assembly Language (Textbook Chapter 7) Assembly and assembler Machine language - binary 0001110010000110 Assembly language - symbolic ADD R6, R2, R6 ; increment index reg. Assembler is a program that

More information

BINARY-CODED DECIMAL (BCD)

BINARY-CODED DECIMAL (BCD) BINARY-CODED DECIMAL (BCD) Definition The binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequence. Basics In computing and electronic

More information

Programming in C 1. Bharat Kinariwala Tep Dobry. 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved.

Programming in C 1. Bharat Kinariwala Tep Dobry. 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved. Programming in C 1 Bharat Kinariwala University ofhawai`i Tep Dobry University ofhawai`i January 5, 1993 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved. Contents Table of Contents

More information

High-level programming (Ch 11-14)

High-level programming (Ch 11-14) High-level programming (Ch 11-14) hardware software H/w s/w interface Problems Algorithms Prog. Lang & Interfaces Instruction Set Architecture Microarchitecture (Organization) Circuits Devices (Transistors)

More information

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and

More information

B. GENERATIONS OF PROGRAMMING LANGUAGES

B. GENERATIONS OF PROGRAMMING LANGUAGES LANGUAGE TRANSLATORS A. HIGH AND LOW LEVEL LANGUAGES Programming languages Low Level Languages Example: Assembly Language High-Level Languages Example: Pascal, Basic, Java Characteristics of LOW Level

More information

CHAPTER 2 PROBLEM SOLVING

CHAPTER 2 PROBLEM SOLVING CHAPTER 2 PROBLEM SOLVING This chapter will cover the following topics: Problem Solving Concepts for the Computer Pre-Programming Phase Programming Or Implementation Phase What Problem Can Be Solved By

More information

Chapter II Binary Data Representation

Chapter II Binary Data Representation Chapter II Binary Data Representation The atomic unit of data in computer systems is the bit, which is actually an acronym that stands for BInary digit. It can hold only 2 values or states: 0 or 1, true

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

Week 5 Course notes. Introduction to material covered this week

Week 5 Course notes. Introduction to material covered this week Week 5 Course notes Introduction to material covered this week Having reviewed the instruction set for the MC68HC11 with practice on some of the more frequently used opcodes, we are now ready to learn

More information

LC-3 Assembly Language. Programming and tips Textbook Chapter 7

LC-3 Assembly Language. Programming and tips Textbook Chapter 7 LC-3 Assembly Language Programming and tips Textbook Chapter 7 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program that turns symbols

More information

İSTANBUL AYDIN UNIVERSITY

İSTANBUL AYDIN UNIVERSITY İSTANBUL AYDIN UNIVERSITY FACULTY OF ENGİNEERİNG SOFTWARE ENGINEERING THE PROJECT OF THE INSTRUCTION SET COMPUTER ORGANIZATION GÖZDE ARAS B1205.090015 Instructor: Prof. Dr. HASAN HÜSEYİN BALIK DECEMBER

More information

3 SOFTWARE AND PROGRAMMING LANGUAGES

3 SOFTWARE AND PROGRAMMING LANGUAGES 3 SOFTWARE AND PROGRAMMING LANGUAGES 3.1 INTRODUCTION In the previous lesson we discussed about the different parts and configurations of computer. It has been mentioned that programs or instructions have

More information

Programming Languages. National Chiao Tung University Chun-Jen Tsai 05/4/2012

Programming Languages. National Chiao Tung University Chun-Jen Tsai 05/4/2012 Programming Languages National Chiao Tung University Chun-Jen Tsai 05/4/2012 Programming Language Programming Language (PL) is a language that can precisely describe an algorithm to a computer so that

More information

8051 Programming. The 8051 may be programmed using a low-level or a high-level programming language.

8051 Programming. The 8051 may be programmed using a low-level or a high-level programming language. 8051 Programming The 8051 may be programmed using a low-level or a high-level programming language. Low-Level Programming Assembly language programming writes statements that the microcontroller directly

More information

LC-3 Assembly Language

LC-3 Assembly Language LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program

More information

Pipelining and Exceptions

Pipelining and Exceptions Pipelining and Exceptions Exceptions represent another form of control dependence. Therefore, they create a potential branch hazard Exceptions must be recognized early enough in the pipeline that subsequent

More information

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 1: Basic Concepts Slides prepared by Kip R. Irvine Revision date: 07/21/2002 Chapter corrections (Web) Assembly language

More information

Memory Systems. Static Random Access Memory (SRAM) Cell

Memory Systems. Static Random Access Memory (SRAM) Cell Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled

More information

Data Types and Addressing Modes 29

Data Types and Addressing Modes 29 29 This section describes data types and addressing modes available to programmers of the Intel Architecture processors. 29.1 Fundamental Data Types The fundamental data types of the Intel Architecture

More information

Chapter 2: Problem Solving Using C++

Chapter 2: Problem Solving Using C++ Chapter 2: Problem Solving Using C++ 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common

More information

Lab Experience 17. Programming Language Translation

Lab Experience 17. Programming Language Translation Lab Experience 17 Programming Language Translation Objectives Gain insight into the translation process for converting one virtual machine to another See the process by which an assembler translates assembly

More information

Design Cycle for Microprocessors

Design Cycle for Microprocessors Cycle for Microprocessors Raúl Martínez Intel Barcelona Research Center Cursos de Verano 2010 UCLM Intel Corporation, 2010 Agenda Introduction plan Architecture Microarchitecture Logic Silicon ramp Types

More information

Rasm51E Cross Assembler for the 8051 Microcontroller User s Manual

Rasm51E Cross Assembler for the 8051 Microcontroller User s Manual Rasm51E Cross Assembler for the 8051 Microcontroller User s Manual 6.115 Microcomputer Laboratory Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science The RASM51E

More information

Microprocessor project: Digital watch

Microprocessor project: Digital watch Digital System 2009-2010: Semester 1 Netlists and simulator Table of contents 1 Netlists and simulator Netlists Specifications of the simulator Circuit watch 2 3 Instruction set - specifications Assembly

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Performance Basics; Computer Architectures

Performance Basics; Computer Architectures 8 Performance Basics; Computer Architectures 8.1 Speed and limiting factors of computations Basic floating-point operations, such as addition and multiplication, are carried out directly on the central

More information

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing. CS143 Handout 18 Summer 2008 30 July, 2008 Processor Architectures Handout written by Maggie Johnson and revised by Julie Zelenski. Architecture Vocabulary Let s review a few relevant hardware definitions:

More information

2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

2. Compressing data to reduce the amount of transmitted data (e.g., to save money). Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

More information

Lecture 03 Bits, Bytes and Data Types

Lecture 03 Bits, Bytes and Data Types Lecture 03 Bits, Bytes and Data Types In this lecture Computer Languages Assembly Language The compiler Operating system Data and program instructions Bits, Bytes and Data Types ASCII table Data Types

More information

CPU Organization and Assembly Language

CPU Organization and Assembly Language COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

More information

Optimization Techniques in C. Team Emertxe

Optimization Techniques in C. Team Emertxe Optimization Techniques in C Team Emertxe Optimization Techniques Basic Concepts Programming Algorithm and Techniques Optimization Techniques Basic Concepts What is Optimization Methods Space and Time

More information

David R. Kaeli Department of Electrical and Computer Engineering, Northeastern University, USA

David R. Kaeli Department of Electrical and Computer Engineering, Northeastern University, USA MACHINE LANGUAGE David R. Kaeli Department of Electrical and Computer Engineering, Northeastern University, USA Keywords: microperations, data path, assembly code, binary format, microcontroller, microcode,

More information

Figure 1: Graphical example of a mergesort 1.

Figure 1: Graphical example of a mergesort 1. CSE 30321 Computer Architecture I Fall 2011 Lab 02: Procedure Calls in MIPS Assembly Programming and Performance Total Points: 100 points due to its complexity, this lab will weight more heavily in your

More information

on an system with an infinite number of processors. Calculate the speedup of

on an system with an infinite number of processors. Calculate the speedup of 1. Amdahl s law Three enhancements with the following speedups are proposed for a new architecture: Speedup1 = 30 Speedup2 = 20 Speedup3 = 10 Only one enhancement is usable at a time. a) If enhancements

More information

Unit 5 Central Processing Unit (CPU)

Unit 5 Central Processing Unit (CPU) Unit 5 Central Processing Unit (CPU) Introduction Part of the computer that performs the bulk of data-processing operations is called the central processing unit (CPU). It consists of 3 major parts: Register

More information

a. Chapter 1: Exercises: =>

a. Chapter 1: Exercises: => Selected Solutions to Problem-Set #1 COE608: Computer Organization and Architecture Introduction, Instruction Set Architecture and Computer Arithmetic Chapters 1, 2 and 3 a. Chapter 1: Exercises: 1.1.1

More information

X86-64 Architecture Guide

X86-64 Architecture Guide X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int

More information

Functions. Recursion

Functions. Recursion CandC++ 2. Functions Preprocessor Stephen Clark University of Cambridge (heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford and Bjarne Stroustrup) Michaelmas Term 2011

More information

Programming Languages

Programming Languages Programming Languages Programming languages bridge the gap between people and machines; for that matter, they also bridge the gap among people who would like to share algorithms in a way that immediately

More information

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CHAPTER 4 MARIE: An Introduction to a Simple Computer CHAPTER 4 MARIE: An Introduction to a Simple Computer 4.1 Introduction 195 4.2 CPU Basics and Organization 195 4.2.1 The Registers 196 4.2.2 The ALU 197 4.2.3 The Control Unit 197 4.3 The Bus 197 4.4 Clocks

More information

Introduction Difference between microcontroller and microprocessor Criteria for choosing a microcontroller Overview of 8051 microcontroller Inside

Introduction Difference between microcontroller and microprocessor Criteria for choosing a microcontroller Overview of 8051 microcontroller Inside Introduction Difference between microcontroller and microprocessor Criteria for choosing a microcontroller Overview of 8051 microcontroller Inside the 8051 Inside the computer Microprocessor CPU for

More information

Representation of Data

Representation of Data Representation of Data In contrast with higher-level programming languages, C does not provide strong abstractions for representing data. Indeed, while languages like Racket has a rich notion of data type

More information

Introduction to C Programming

Introduction to C Programming Introduction to C Programming C HOW TO PROGRAM, 6/E 1992-2010 by Pearson Education, Inc. All Rights Reserved. 2.1 Introduction The C language facilitates a structured and disciplined approach to computer

More information

Semantic Analysis: Types and Type Checking

Semantic Analysis: Types and Type Checking Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

More information

Tutorial No. 1 - Solution (Introduction to Computers & Programming)

Tutorial No. 1 - Solution (Introduction to Computers & Programming) Tutorial No. 1 - Solution (Introduction to Computers & Programming) Computer Programming and Utilization (2110003) 1. Draw a block diagram of computer architecture. 2. List various components of a computer

More information

Chapter 7 Assembly Language

Chapter 7 Assembly Language Chapter 7 Assembly Language Human-Readable Machine Language Computers like ones and zeros 0001110010000110 Humans like symbols ADD R6,R2,R6 increment index reg. Assembler is a program that turns symbols

More information

CPE 323 Data Types and Number Representations

CPE 323 Data Types and Number Representations CPE 323 Data Types and Number Representations Aleksandar Milenkovic Numeral Systems: Decimal, binary, hexadecimal, and octal We ordinarily represent numbers using decimal numeral system that has 10 as

More information

Lecture 2: MC68000 architecture

Lecture 2: MC68000 architecture Lecture 2: MC68000 architecture g General information g Programmer s model g Memory organization g Instruction format g Our first assembly program g The sim68k simulator g Machine translation 1 MC68000

More information

Final Exam Review. CS 1428 Fall Jill Seaman. Final Exam

Final Exam Review. CS 1428 Fall Jill Seaman. Final Exam Final Exam Review CS 1428 Fall 2011 Jill Seaman 1 Final Exam Friday, December 9, 11:00am to 1:30pm Derr 241 (here) Closed book, closed notes, clean desk Comprehensive (covers entire course) 25% of your

More information

Department of Electrical and Computer Engineering Faculty of Engineering and Architecture American University of Beirut Course Information

Department of Electrical and Computer Engineering Faculty of Engineering and Architecture American University of Beirut Course Information Department of Electrical and Computer Engineering Faculty of Engineering and Architecture American University of Beirut Course Information Course title: Computer Organization Course number: EECE 321 Catalog

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Introduction to C Programming S Y STEMS

Introduction to C Programming S Y STEMS Introduction to C Programming CS 40: INTRODUCTION TO U NIX A ND L I NUX O P E R AT ING S Y STEMS Objectives Introduce C programming, including what it is and what it contains, which includes: Command line

More information

High level language programs versus Machine code

High level language programs versus Machine code High level language programs versus Machine code You all have experience programming in a high level language. You know that when you write a program in a language such as C or Java, the program is nothing

More information

Dept. of CSE, IIT KGP

Dept. of CSE, IIT KGP Basic Programming Concepts CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Some Terminologies Algorithm / Flowchart

More information

Lab 1d. Fixed-point Conversions

Lab 1d. Fixed-point Conversions Lab 1d Fixed-point Conversions Page 1d.1 Lab 1d. Fixed-point Conversions This laboratory assignment accompanies the book, Embedded Microcomputer Systems: Real Time Interfacing, Second edition, by, published

More information

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming

More information

Demo program from Lecture #1

Demo program from Lecture #1 Registers start MOV total, a ; Make the first number the subtotal ADD total, total, b ; Add the second number to the subtotal ADD total, total, c ; Add the third number to the subtotal ADD total, total,

More information

Why study the Alpha (assembly)?

Why study the Alpha (assembly)? Why study the Alpha (assembly)? The Alpha architecture is the first 64-bit load/store RISC (as opposed to CISC) architecture designed to enhance computer performance by improving clock speeding, multiple

More information

Chapter 12. Development Tools for Microcontroller Applications

Chapter 12. Development Tools for Microcontroller Applications Chapter 12 Development Tools for Microcontroller Applications Lesson 01 Software Development Process and Development Tools Step 1: Development Phases Analysis Design Implementation Phase 1 Phase 2 Phase

More information

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio. Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Names, Bindings, and Scopes A name is a symbolic identifier used

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

Privileged Instructions

Privileged Instructions Privileged Instructions Computer instructions are usually divided into two classes: user instructions and privileged instructions. User instructions are those that are not privileged. Instructions can

More information

C Programming, Chapter 1: C vs. Java, Types, Reading and Writing

C Programming, Chapter 1: C vs. Java, Types, Reading and Writing C Programming, Chapter 1: C vs. Java, Types, Reading and Writing T. Karvi August 2013 T. Karvi C Programming, Chapter 1: C vs. Java, Types, Reading and Writing August 2013 1 / 1 C and Java I Although the

More information

1 Computer Architecture Question Bank Part A Questions

1 Computer Architecture Question Bank Part A Questions 1 Computer Architecture Part A Questions 1. What is stored program concept? 2. Differentiate memory write and I/O write. 3. What are the various methods of accessing data from memory? 4. Define memory

More information

Dividing up a primitive class results in subclasses that do not completely dene a concept. As a result, the two classes must make frequent reference t

Dividing up a primitive class results in subclasses that do not completely dene a concept. As a result, the two classes must make frequent reference t LECTURE 12 Some Tips on How to Program in C++ When it comes to learning how to program in C++, there's no substitute for experience. But there are some things that are good to keep in mind. Advice on how

More information

Notes on Assembly Language

Notes on Assembly Language Notes on Assembly Language Brief introduction to assembly programming The main components of a computer that take part in the execution of a program written in assembly code are the following: A set of

More information

CPU- Internal Structure

CPU- Internal Structure ESD-1 Elettronica dei Sistemi Digitali 1 CPU- Internal Structure Lesson 12 CPU Structure&Function Instruction Sets Addressing Modes Read Stallings s chapters: 11, 9, 10 esd-1-9:10:11-2002 1 esd-1-9:10:11-2002

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

Chapter 6: The Assembly Process

Chapter 6: The Assembly Process Chapter 6: The Assembly Process This chapter will present a brief introduction to the functioning of a standard two pass assembler. It will focus on the conversion of the text of an assembly language program,

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

SFC A Structured Flow Chart Editor Version 2.3 User s Guide Tia Watts, Ph.D. Sonoma State University

SFC A Structured Flow Chart Editor Version 2.3 User s Guide Tia Watts, Ph.D. Sonoma State University SFC A Structured Flow Chart Editor Version 2.3 User s Guide Tia Watts, Ph.D. Sonoma State University 1 of 35 SFC A Structured Flow Chart Editor Version 2.3 User s Guide Table of Contents 1. Introduction...

More information

C Programming Dr. Hasan Demirel

C Programming Dr. Hasan Demirel C How to Program, H. M. Deitel and P. J. Deitel, Prentice Hall, 5 th edition (3 rd edition or above is also OK). Introduction to C Programming Dr. Hasan Demirel Programming Languages There are three types

More information

So far we have considered only numeric processing, i.e. processing of numeric data represented

So far we have considered only numeric processing, i.e. processing of numeric data represented Chapter 4 Processing Character Data So far we have considered only numeric processing, i.e. processing of numeric data represented as integer and oating point types. Humans also use computers to manipulate

More information