Review CAS CS210 Ying Ye Boston University. Logical expressions Truth table input: A, B, Coutput: D ABCD 0001 1000 1100 1111 0100 0110 0010 1011 (~A)(~B)(~C)

Slides:



Advertisements
Similar presentations
CSE 351 Midterm Review. Your midterm is next Wednesday Study past midterms (link on the website) Point of emphasis: Registers are not memory Registers.
Advertisements

Computer Organization and Architecture Tutorial 6 Kenneth Lee.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 1.7 Storing Fractions. Excess Notation, continued… In this notation, "m" indicates the total number of bits. For us (working with 8 bits), it.
Floating Point Numbers. CMPE12cGabriel Hugh Elkaim 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or.
Floating Point Numbers. CMPE12cCyrus Bazeghi 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or 2 64.
Assembly Language and Computer Architecture Using C++ and Java
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Signed Numbers.
Assembly Language and Computer Architecture Using C++ and Java
Floating Point Numbers
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
Number Representation Rizwan Rehman, CCS, DU. Convert a number from decimal to binary notation and vice versa. Understand the different representations.
Computer Science 210 Computer Organization Floating Point Representation.
The IEEE Format for storing float (single precision) data type Use the “enter” key to proceed through the show.
Lecture 8 Floating point format
Operations on data CHAPTER 4.
Topic 4 Computer Mathematics and Logic
Dr. Bernard Chen Ph.D. University of Central Arkansas
Simple Data Type Representation and conversion of numbers
Chapter 3 Number Representation. Convert a number from decimal 、 hexadecimal,octal to binary notation and vice versa. Understand the different representations.
Ch. 2 Floating Point Numbers
Information Representation (Level ISA3) Floating point numbers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
Numeric precision in SAS. Two aspects of numeric data in SAS The first is how numeric data are stored (how a number is represented in the computer). –
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computer Architecture
Data Representation and Computer Arithmetic
COMPSCI 210 Semester Tutorial 1
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 10 Department of Computer Science and Software Engineering University of.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
9.4 FLOATING-POINT REPRESENTATION
Floating Point Representations CDA 3101 Discussion Session 02.
CSCI 6307 Foundation of Systems – Exercise (2) Xiang Lian The University of Texas – Pan American Edinburg, TX
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
Number Representation
Lecture12. Outline Binary representation of integer numbers Operations on bits –The Bitwise AND Operator –The Bitwise Inclusive-OR Operator –The Bitwise.
ITEC 1011 Introduction to Information Technologies 4. Floating Point Numbers Chapt. 5.
Integer & Floating Point Representations CDA 3101 Discussion Session 05.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Computer Organization and Design Information Encoding II Montek Singh Wed, Aug 29, 2012 Lecture 3.
UniMAP Sem2-10/11 DKT121: Fundamental of Computer Programming1 Number Systems and Bitwise Operation.
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
Floating Point Binary A2 Computing OCR Module 2509.
Number Representation and Arithmetic Circuits
Numbers in Computers.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
ECE 103 Engineering Programming Chapter 3 Numbers Herbert G. Mayer, PSU CS Status 6/19/2015 Initial content copied verbatim from ECE 103 material developed.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
1 Midterm Exam Review. Data representation 2 For parts a-c: Fill in the missing values of this chart. All binary and hexadecimal values are given in 8-bit.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
FLOATING-POINT NUMBER REPRESENTATION
Computer Science 210 Computer Organization
Introduction To Computer Science
Floating Point Representations
Recitation 4&5 and review 1 & 2 & 3
ECE 103 Engineering Programming Chapter 3 Numbers
What to bring: iCard, pens/pencils (They provide the scratch paper)
Number Representation
Overview Fractions & Sign Extension Floating Point Representations
39 32 Exponent Sign 31 Mantissa 30 Operations are perfomred with an implied binary point between bits 31 and 30. When the implied most significant.
ECE 120 Midterm 1 HKN Review Session.
Presentation transcript:

Review CAS CS210 Ying Ye Boston University

Logical expressions Truth table input: A, B, Coutput: D ABCD (~A)(~B)(~C) ABC A(~B)C D = (~A)(~B)(~C) + ABC + A(~B)C

Logical expressions Properties: expression = NOT( NOT(expression) ) NOT( A AND B) = NOT(A) OR NOT(B) NOT( A OR B) = NOT(A) AND NOT(B) Usage: A AND B = NOT( NOT(A) OR NOT(B) ) A OR B = NOT( NOT(A) AND NOT(B) ) Using constant NOT(A) = A XOR 1

Operators int a, b = 2;  1. a == ? A. 2B. 0C. I don't know  2. a = ++b, b++; a == ? A. 3B. 4C. I don't know  3. a = b += ++b; a == ? A. 3B. 6C b == ? A. 2B. 3C. 6  5. a = b += b++; a == ? A. 2B. 4C b == ? A. 2B. 6C. 5

Floating-point numbers sign bit: 1 Single precision IEEE floating-point format: negative exponent (biased 127): value: ( ) = 1 10 fraction: value: floating-point number: -1 * (1.1) * 2 1

Floating-point numbers use a floating point representation with a sign bit in the leftmost position, followed by a three-bit two’s complement exponent, followed by a normalized three bit fraction in base 2. A normalized fraction means a 1 to the right of the binary point, for example.101 is normalized. Zero is represented by the bit pattern There is no hidden 1. There are a total of seven bits in this floating point representation, and there are 2 7 = 128 unique bit patterns. How many of these bit patterns are valid?

Floating-point numbers +/- X * 2 e Why normalized fraction?.001 * 2 2 =.010 * 2 1 = * 2 0 If X = 0: only 1 valid number If X != 0: the most significant bit of X must be 1, leaving only 2 free bits for fraction total valid number = * 4 * 8 1 valid for X = 0 1 free sign bit 2 free fraction bits 3 free exponent bits

Practice exam Convert the following binary numbers to hexadecimal: ; 1101; ; Suppose a 7-bit representation. What are the decimal values of the following two’s complement binary numbers? ; ;

Pointer download from replace /*TODO*/ with pointer operations, not allowed to use variable a, b except in the first TODO

Pointer Output a = 1 b = 2 ++a = 2 a++ = 2 b = 4 a + b = 7

Pointer Possible solution: int *p1 = &a, *p2 = &b; printf("a = %d\n", *p1); printf("b = %d\n", *p2); printf("++a = %d\n", ++(*p1)); printf("a++ = %d\n", (*p1)++); *p2 = 4; printf("b = %d\n", *p2); printf("a + b = %d\n", *p1 + *p2);