Expressions. Operands. Operators

Size: px
Start display at page:

Download "Expressions. Operands. Operators"

Transcription

1 Página 1 de 6 Expressions The Assembler incorporates constant expressions. Expressions can consist of operands, operators and functions. All expressions are internally 32 bits in AVRASM, and 64 bits in AVRASM2. Operands The following operands can be used: User defined labels which are given the value of the location counter at the place they appear. User defined variables defined by the SET directive User defined constants defined by the EQU directive Integer constants: constants can be given in several formats, including Decimal (default): 10, 255 Hexadecimal (two notations): 0x0a, $0a, 0xff, $ff Binary: 0b , 0b Octal (leading zero): 010, 077 PC - the current value of the Program memory location counter Floating point constants - AVRASM2 only. Operators The Assembler supports a number of operators which are described here. The higher the precedence, the higher the priority. Expressions may be enclosed in parentheses, and such expressions are always evaluated before combined with anything outside the parentheses. The associativity of binary operators indicates the evaluation order of chained operators, left associativity meaning they are evaluated left to right, i.e., is (2-3) - 4, while right associativity would mean is 2 - (3-4). Some operators are not assoiciative, meaning chaining has no meaning. The following operators are defined: Symbol Description! Logical Not ~ Bitwise Not - Unary Minus * Multiplication / Division % Modulo (AVRASM2 only) + Addition - Subtraction << Shift left >> Shift right < Less than <= Less than or equal > Greater than >= Greater than or equal == Equal

2 Página 2 de 6!= Not equal & Bitwise And ^ Bitwise Xor Bitwise Or && Logical And Logical Or Conditional operator? (AVRASM2 only) Logical Not Symbol:! Description: Unary operator which returns 1 if the expression was zero, and returns 0 if the expression was nonzero Example: ldi r16,!0xf0 ; Load r16 with 0x00 Bitwise Not Symbol: ~ Description: Unary operator which returns the input expression with all bits inverted Example: ldi r16,~0xf0 ; Load r16 with 0x0f Unary Minus Symbol: - Description: Unary operator which returns the arithmetic negation of an expression Precedence: 14 Example: ldi r16,-2 ; Load -2(0xfe) in r16 Multiplication Symbol: * Description: Binary operator which returns the product of two expressions Precedence: 13 Example: ldi r30,label*2 ; Load r30 with label*2 Division Symbol: / Description: Binary operator which returns the integer quotient of the left expression divided by the right expression Precedence: 13 Example: ldi r30,label/2 ; Load r30 with label/2

3 Página 3 de 6 Modulo (AVRASM2 Only) Symbol: % Description: Binary operator which returns the integer remainder of the left expression divided by the right expression Precedence: 13 Example: ldi r30,label%2 ; Load r30 with label%2 Addition Symbol: + Description: Binary operator which returns the sum of two expressions Example: ldi r30,c1+c2 ; Load r30 with c1+c2 Subtraction Symbol: - Description: Binary operator which returns the left expression minus the right expression Example: ldi r17,c1-c2 ;Load r17 with c1-c2 Shift left Symbol: << Description: Binary operator which returns the left expression shifted left the number given by the right expression Precedence: 11 Example: ldi r17,1<<bitmask ;Load r17 with 1 shifted left bitmask times Shift right Symbol: >> Description: Binary operator which returns the left expression shifted right the number given by the right expression Precedence: 11 Example: ldi r17,c1>>c2 ;Load r17 with c1 shifted right c2 times Less than Symbol: < left is Less than the signed expression to the right, 0 otherwise Example: ori r18,bitmask*(c1<c2)+1 ;Or r18 with an expression

4 Página 4 de 6 Less or equal Symbol: <= left is Less than or Equal to the signed expression to the right, 0 otherwise Example: ori r18,bitmask*(c1<=c2)+1 ;Or r18 with an expression Greater than Symbol: > left is Greater than the signed expression to the right, 0 otherwise Example: ori r18,bitmask*(c1>c2)+1 ;Or r18 with an expression Greater or equal Symbol: >= left is Greater than or Equal to the signed expression to the right, 0 otherwise Example: ori r18,bitmask*(c1>=c2)+1 ;Or r18 with an expression Equal Symbol: == left is Equal to the signed expression to the right, 0 otherwise Precedence: 9 Example: andi r19,bitmask*(c1==c2)+1 ;And r19 with an expression Not equal Symbol:!= left is Not Equal to the signed expression to the right, 0 otherwise Precedence: 9 Example:.SET flag=(c1!=c2) ;Set flag to 1 or 0 Bitwise And Symbol: & Description: Binary operator which returns the bitwise And between two expressions Precedence: 8

5 Página 5 de 6 Example: ldi r18,high(c1&c2) ;Load r18 with an expression Bitwise Xor Symbol: Description: expressions Precedence: 7 ^ Binary operator which returns the bitwise Exclusive Or between two Example: ldi r18,low(c1^c2) ;Load r18 with an expression Bitwise Or Symbol: Description: Binary operator which returns the bitwise Or between two expressions Precedence: 6 Example: ldi r18,low(c1 c2) ;Load r18 with an expression Logical And Symbol: Description: nonzero, 0 otherwise Precedence: 5 && Binary operator which returns 1 if the expressions are both Example: ldi r18,low(c1&&c2) ;Load r18 with an expression Logical Or Symbol: Description: Binary operator which returns 1 if one or both of the expressions are nonzero, 0 otherwise Precedence: 4 Example: ldi r18,low(c1 c2) ;Load r18 with an expression Conditional operator (AVRASM2 only) Symbol:? : Syntax: condtion? expression1 : expression2 Description: Ternary operator which returns expression1 if condition is true, expression2 otherwise. Precedence: 3 Example: ldi r18, a > b? a : b ; Load r18 with the maximum numeric value of a and b. Note: This feature was introduced in AVRASM 2.1 and is not available in 2.0 or earlier versions. Functions The following functions are defined: LOW(expression) returns the low byte of an expression

6 Página 6 de 6 HIGH(expression) returns the second byte of an expression BYTE2(expression) is the same function as HIGH BYTE3(expression) returns the third byte of an expression BYTE4(expression) returns the fourth byte of an expression LWRD(expression) returns bits 0-15 of an expression HWRD(expression) returns bits of an expression PAGE(expression) returns bits of an expression EXP2(expression) returns 2 to the power of expression LOG2(expression) returns the integer part of log2(expression) The following functions are only defined in AVRASM2: INT(expression) Truncates a floating point expression to integer (ie discards fractional part) FRAC(expression) Extracts fractional part of a floating point expression (ie discards integer part). Q7(expression) Converts a fractional floating point expression to a form suitable for the FMUL/FMULS/FMULSU instructions. (sign + 7-bit fraction) Q15(expression) Converts a fractional floating point expression to a form suitable for the FMUL/FMULS/FMULSU instructions. (sign +15-bit fraction) ABS() Returns the absolute value of a constant expression. DEFINED(symbol) Returns true if symbol is previously defined using.equ/.set/.def directives. Normally used in conjunction with.if directives (.if defined(foo)), but may be used in any context. It differs from other functions in that parentheses around its argument are not required, and that it only makes sense to use a single symbol as argument. STRLEN(string) returns the length of a string c+onstant, in bytes.

COMP3221: Microprocessors and Embedded Systems. Lecture 11: Assembly Lecturer: Hui Wu Session 2, 2005

COMP3221: Microprocessors and Embedded Systems. Lecture 11: Assembly  Lecturer: Hui Wu Session 2, 2005 COMP3221: Microprocessors and Embedded Systems Lecture 11: Assembly http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 Overview Pseudo Instructions Macro Assembly Process 2 Assembly Language

More information

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.

More information

Menu. >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board. Machine Codes 6811: $86 $0A GCPU: $02 $0A

Menu. >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board. Machine Codes 6811: $86 $0A GCPU: $02 $0A Big Picture Assembler Directives Examples using: Menu >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board Look into my... See on web-site: GCPU_to_XMEGA.pdf, Examples:

More information

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

More information

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g. 1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object

More information

AVR Assembler Examples

AVR Assembler Examples AVR Assembler Examples AVR specific examples Credit to Dr. Robucci for slide information SBR Set bits in reg Equivalent to an ORI REQUIRES MASKS, not bit number m169pdef.inc Include file detailing register

More information

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

Expressions and Precedence. Last updated 12/10/18

Expressions and Precedence. Last updated 12/10/18 Expressions and Precedence Last updated 12/10/18 Expression: Sequence of Operators and Operands that reduce to a single value Simple and Complex Expressions Subject to Precedence and Associativity Six

More information

Operators in C. Staff Incharge: S.Sasirekha

Operators in C. Staff Incharge: S.Sasirekha Operators in C Staff Incharge: S.Sasirekha Operators An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C

More information

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one. http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.

More information

Computer Programming CS F111

Computer Programming CS F111 Computer Programming CS F111 BITS Pilani Dubai Campus NAND KUMAR Basics of C Programming BITS Pilani Dubai Campus Write a program that 1. Asks 5 marks from the user, find the average of the marks and print

More information

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1

Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions

More information

Informatics Ingeniería en Electrónica y Automática Industrial

Informatics Ingeniería en Electrónica y Automática Industrial Informatics Ingeniería en Electrónica y Automática Industrial Operators and expressions in C Operators and expressions in C Numerical expressions and operators Arithmetical operators Relational and logical

More information

JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

Learning the Language - V

Learning the Language - V Learning the Language - V Fundamentals We now have locations to store things so we need a way to get things into those storage locations To do that, we use assignment statements Deja Moo: The feeling that

More information

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018 Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Administrative Stuff The class is full I will not be adding more ppl

More information

Lecture 3 Tao Wang 1

Lecture 3 Tao Wang 1 Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers

More information

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Ziad Matni Dept. of Computer Science, UCSB Adding this Class The class is full I will not be adding more ppl L Even if others

More information

Operators in java Operator operands.

Operators in java Operator operands. Operators in java Operator in java is a symbol that is used to perform operations and the objects of operation are referred as operands. There are many types of operators in java such as unary operator,

More information

Beginning C Programming for Engineers

Beginning C Programming for Engineers Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary

More information

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships

More information

Prof. Navrati Saxena TA: Rochak Sachan

Prof. Navrati Saxena TA: Rochak Sachan JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides

More information

LECTURE 3 C++ Basics Part 2

LECTURE 3 C++ Basics Part 2 LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by

More information

Chapter 3: Operators, Expressions and Type Conversion

Chapter 3: Operators, Expressions and Type Conversion 101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

More information

Information Science 1

Information Science 1 Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting

More information

Operators & Expressions

Operators & Expressions Operators & Expressions Operator An operator is a symbol used to indicate a specific operation on variables in a program. Example : symbol + is an add operator that adds two data items called operands.

More information

CSCI 2212: Intermediate Programming / C Chapter 15

CSCI 2212: Intermediate Programming / C Chapter 15 ... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations

More information

Department of Computer Science

Department of Computer Science Department of Computer Science Definition An operator is a symbol (+,-,*,/) that directs the computer to perform certain mathematical or logical manipulations and is usually used to manipulate data and

More information

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the

More information

Unit-2 (Operators) ANAND KR.SRIVASTAVA

Unit-2 (Operators) ANAND KR.SRIVASTAVA Unit-2 (Operators) ANAND KR.SRIVASTAVA 1 Operators in C ( use of operators in C ) Operators are the symbol, to perform some operation ( calculation, manipulation). Set of Operations are used in completion

More information

Programming I Lecture 7

Programming I Lecture 7 . Definition: An integer is a number without a fractional part. The set of integers is the union of the set of whole numbers and the set of negative counting numbers... Integers and whole numbers. C++

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

cast int( x float( x str( x hex( int string int oct( int string int bin( int string int chr( int int ord( ch

cast int( x float( x str( x hex( int string int oct( int string int bin( int string int chr( int int ord( ch More About Values Casts To cast is to take a value of one type and return the corresponding value of some other type (or an error, if the cast is impossible) int(x) casts a string, float, or boolean x

More information

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators ARITHMATIC OPERATORS The assignment operator in IDL is the equals sign, =. IDL uses all the familiar arithmetic operators

More information

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

More information

The Arithmetic Operators

The Arithmetic Operators The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x

More information

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One

More information

Operators. Lecture 3 COP 3014 Spring January 16, 2018

Operators. Lecture 3 COP 3014 Spring January 16, 2018 Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator

More information

RUBY OPERATORS. Ruby Arithmetic Operators: Ruby Comparison Operators:

RUBY OPERATORS. Ruby Arithmetic Operators: Ruby Comparison Operators: http://www.tutorialspoint.com/ruby/ruby_operators.htm RUBY OPERATORS Copyright tutorialspoint.com Ruby supports a rich set of operators, as you'd expect from a modern language. Most operators are actually

More information

3. EXPRESSIONS. It is a sequence of operands and operators that reduce to a single value.

3. EXPRESSIONS. It is a sequence of operands and operators that reduce to a single value. 3. EXPRESSIONS It is a sequence of operands and operators that reduce to a single value. Operator : It is a symbolic token that represents an action to be taken. Ex: * is an multiplication operator. Operand:

More information

More Programming Constructs -- Introduction

More Programming Constructs -- Introduction More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

More information

Advanced Algorithms and Computational Models (module A)

Advanced Algorithms and Computational Models (module A) Advanced Algorithms and Computational Models (module A) Giacomo Fiumara giacomo.fiumara@unime.it 2014-2015 1 / 34 Python's built-in classes A class is immutable if each object of that class has a xed value

More information

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal - use the definition of a number in a positional number system with base - evaluate the definition formula using

More information

Chap 6 - Introduction to HDL (b)

Chap 6 - Introduction to HDL (b) Design with Verilog Chap 6 - Introduction to HDL (b) Credit to: MD Rizal Othman Faculty of Electrical & Electronics Engineering Universiti Malaysia Pahang Ext: 6036 Language Elements 1. Operators There

More information

C Programming Language. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

C Programming Language. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff C Programming Language 1 C C is better to use than assembly for embedded systems programming. You can program at a higher level of logic than in assembly, so programs are shorter and easier to understand.

More information

Chapter 12 Variables and Operators

Chapter 12 Variables and Operators Chapter 12 Variables and Operators Highlights (1) r. height width operator area = 3.14 * r *r + width * height literal/constant variable expression (assignment) statement 12-2 Highlights (2) r. height

More information

Computer Organisation CS303

Computer Organisation CS303 Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with

More information

Expression and Operator

Expression and Operator Expression and Operator Examples: Two types: Expressions and Operators 3 + 5; x; x=0; x=x+1; printf("%d",x); Function calls The expressions formed by data and operators An expression in C usually has a

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Basic language This reference guide

More information

SOFTWARE DEVELOPMENT 1. Operators 2018W A. Ferscha (Institute of Pervasive Computing, JKU Linz)

SOFTWARE DEVELOPMENT 1. Operators 2018W A. Ferscha (Institute of Pervasive Computing, JKU Linz) SOFTWARE DEVELOPMENT 1 Operators 2018W (Institute of Pervasive Computing, JKU Linz) OPERATORS Operators are required to form expressions. Depending on the number of operands they take, they are called:

More information

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Basic Operators Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

Unit 3. Operators. School of Science and Technology INTRODUCTION

Unit 3. Operators. School of Science and Technology INTRODUCTION INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.

More information

EE292: Fundamentals of ECE

EE292: Fundamentals of ECE EE292: Fundamentals of ECE Fall 2012 TTh 10:00-11:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic

More information

Number Systems and Their Representations

Number Systems and Their Representations Number Representations Cptr280 Dr Curtis Nelson Number Systems and Their Representations In this presentation you will learn about: Representation of numbers in computers; Signed vs. unsigned numbers;

More information

CS 33. Data Representation, Part 1. CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

CS 33. Data Representation, Part 1. CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. CS 33 Data Representation, Part 1 CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Number Representation Hindu-Arabic numerals developed by Hindus starting in

More information

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. I Internal Examination Sept. 2018 Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. [I]Very short answer questions (Max 40 words). (5 * 2 = 10) 1. What is

More information

Arithmetic for Computers

Arithmetic for Computers MIPS Arithmetic Instructions Cptr280 Dr Curtis Nelson Arithmetic for Computers Operations on integers Addition and subtraction; Multiplication and division; Dealing with overflow; Signed vs. unsigned numbers.

More information

Chapter Two MIPS Arithmetic

Chapter Two MIPS Arithmetic Chapter Two MIPS Arithmetic Computer Organization Review Binary Representation Used for all data and instructions Fixed size values: 8, 16, 32, 64 Hexadecimal Sign extension Base and virtual machines.

More information

C expressions. (Reek, Ch. 5) 1 CS 3090: Safety Critical Programming in C

C expressions. (Reek, Ch. 5) 1 CS 3090: Safety Critical Programming in C C expressions (Reek, Ch. 5) 1 Shift operations Left shift: value > n Two definitions: logical version: discard the n

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output? Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int

More information

Bits, Bytes, and Integers

Bits, Bytes, and Integers Bits, Bytes, and Integers with contributions from Dr. Bin Ren, College of William & Mary 1 Bits, Bytes, and Integers Representing information as bits Bit-level manipulations Integers Representation: unsigned

More information

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(

More information

Operators and Expressions:

Operators and Expressions: Operators and Expressions: Operators and expression using numeric and relational operators, mixed operands, type conversion, logical operators, bit operations, assignment operator, operator precedence

More information

UNIT 3 OPERATORS. [Marks- 12]

UNIT 3 OPERATORS. [Marks- 12] 1 UNIT 3 OPERATORS [Marks- 12] SYLLABUS 2 INTRODUCTION C supports a rich set of operators such as +, -, *,,

More information

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation CS113: Lecture 3 Topics: Variables Data types Arithmetic and Bitwise Operators Order of Evaluation 1 Variables Names of variables: Composed of letters, digits, and the underscore ( ) character. (NO spaces;

More information

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6

More information

Lecture 3. More About C

Lecture 3. More About C Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants

More information

SECTION II: LANGUAGE BASICS

SECTION II: LANGUAGE BASICS Chapter 5 SECTION II: LANGUAGE BASICS Operators Chapter 04: Basic Fundamentals demonstrated declaring and initializing variables. This chapter depicts how to do something with them, using operators. Operators

More information

Chapter. Computer Architecture

Chapter. Computer Architecture Chapter 4 Computer Architecture Figure 4.1 Input device Central processing unit Main memory Output device Bus Data flow Control Figure 4.2 Central processing unit () Status bits ( ) Accumulator ( ) Index

More information

PYTHON- AN INNOVATION

PYTHON- AN INNOVATION PYTHON- AN INNOVATION As per CBSE curriculum Class 11 Chapter- 2 By- Neha Tyagi PGT (CS) KV 5 Jaipur(II Shift) Jaipur Region Python Introduction In order to provide an input, process it and to receive

More information

9 Using Equation Networks

9 Using Equation Networks 9 Using Equation Networks In this chapter Introduction to Equation Networks 244 Equation format 247 Using register address lists 254 Setting up an enable contact 255 Equations displayed within the Network

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

More information

Divide: Paper & Pencil

Divide: Paper & Pencil Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

More information

NAME asm cross-assembler SYNOPSIS

NAME asm cross-assembler SYNOPSIS NAME asm6809 6809 cross-assembler SYNOPSIS asm6809 [OPTION] [SOURCE-FILE] DESCRIPTION asm6809 is a portable macro cross assembler targeting the Motorola 6809 and Hitachi 6309 processors. These processors

More information

Applied Computer Programming

Applied Computer Programming Applied Computer Programming Representation of Numbers. Bitwise Operators Course 07 Lect.eng. Adriana ALBU, PhD Politehnica University Timisoara Internal representation All data, of any type, processed

More information

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems

More information

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design 1 COE 0- Digital Logic Number Systems II Dr. Abdulaziz Y. Barnawi COE Department KFUPM COE 0 Logic Design January 3, 016 Objectives Base Conversion Decimal to other bases Binary to Octal and Hexadecimal

More information

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction

More information

Chapter 4. Operations on Data

Chapter 4. Operations on Data Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations

More information

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

More information

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to

More information

ECEN 468 Advanced Logic Design

ECEN 468 Advanced Logic Design ECEN 468 Advanced Logic Design Lecture 26: Verilog Operators ECEN 468 Lecture 26 Operators Operator Number of Operands Result Arithmetic 2 Binary word Bitwise 2 Binary word Reduction 1 Bit Logical 2 Boolean

More information

Programming. Elementary Concepts

Programming. Elementary Concepts Programming Elementary Concepts Summary } C Language Basic Concepts } Comments, Preprocessor, Main } Key Definitions } Datatypes } Variables } Constants } Operators } Conditional expressions } Type conversions

More information

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003 Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

More information

A Java program contains at least one class definition.

A Java program contains at least one class definition. Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public

More information

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers

More information

Lecture Notes on Ints

Lecture Notes on Ints Lecture Notes on Ints 15-122: Principles of Imperative Computation Frank Pfenning Lecture 2 August 26, 2010 1 Introduction Two fundamental types in almost any programming language are booleans and integers.

More information

FAQ No. 53. ihost: Logic Points. Roles and Privileges. Adding and removing logic points. Accessing and using the Logic Editor

FAQ No. 53. ihost: Logic Points. Roles and Privileges. Adding and removing logic points. Accessing and using the Logic Editor ihost: Logic Points In addition to displaying values reported by a unit, ihost supports adding additional logic points to a unit and calculating the value based on a custom logic expression. On calculation

More information

CSE I-Sem)

CSE I-Sem) Objective: Understanding miscellaneous aspects of C ENUMERATED, STRUCTURE AND UNION TYPES: Derived types- structures declaration, definition and initialization of structures, accessing structures, nested

More information

Introduction to Computers. Laboratory Manual. Experiment #3. Elementary Programming, II

Introduction to Computers. Laboratory Manual. Experiment #3. Elementary Programming, II Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 LNGG 1003 Khaleel I. Shaheen Introduction to Computers Laboratory Manual Experiment

More information

CS107, Lecture 3 Bits and Bytes; Bitwise Operators

CS107, Lecture 3 Bits and Bytes; Bitwise Operators CS107, Lecture 3 Bits and Bytes; Bitwise Operators reading: Bryant & O Hallaron, Ch. 2.1 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative Commons Attribution

More information