CDA 3100 Fall 2012.

Slides:



Advertisements
Similar presentations
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
CS 61C L02 Number Representation (1)Harvey / Wawrzynek Fall 2003 © UCB 8/27/2003  Brian Harvey ( John Wawrzynek  (Warznek) (
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
1 CS/COE0447 Computer Organization & Assembly Language Pre-Chapter 2.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Numeral Systems Subjects: Numeral System Positional systems Decimal
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
Comp Sci 251 Intro 1 Computer organization and assembly language Wing Huen.
Number Representation. 10/12/2015CDA31002 Conversion between Representations Now we can represent a quantity in different number representations How can.
1-1 Lecture 1 Class Overview and Appendix A -- Number Systems.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
CDA 3100 Fall Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course.
Number systems, Operations, and Codes
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Positional Notation 642 in base 10 positional notation is:
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
Introduction To Number Systems Binary System M. AL-Towaileb1.
CDA 3100 Spring Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course.
CDA 3100 Fall2009. Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course.
Numbers in Computers.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
CDA 3100 Fall Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
CPE 201 Digital Design Lecture 2: Digital Systems & Binary Numbers (2)
Data Representation COE 308 Computer Architecture
Lecturer: Santokh Singh
Introduction To Number Systems
Number Systems & Binary Arithmetic
Data Representation ICS 233
Lec 3: Data Representation
Data Representation.
Chapter 02 Nell Dale & John Lewis.
Discrete Mathematics Numbering System.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Data Representation Binary Numbers Binary Addition
Logistics Always read the Calendar at
Computer Science LESSON 1 on Number Bases.
Number Systems Give qualifications of instructors:
Base ‘b’ number for i = 0 to n – 1 for an n digit quantity
Location in course textbook
Chapter 3 Data Representation
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
Chapter 1 Number Systems & Conversions
CDA 3100 Summer 2011.
Data Representation COE 301 Computer Organization
Introduction to IT By: Muhammed s. anwar.
CDA 3100 Fall 2015.
Number Representation
Textbook Computer Science Illuminated 4th Edition  By Nell Dale, John Lewis - Jones and Bartlett Publishers 11/20/2018.
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
CDA 3100 Spring 2009.
Overview Digital Systems and Computer Systems
CDA 3100 Summer 2013.
Numbering System TODAY AND TOMORROW 11th Edition
CDA 3100 Spring 2010.
Digital Logic & Design Lecture 02.
Chapter 2: Number Systems
AP Computer Science LESSON 1 on Number Bases.
John Owen, Rockport Fulton HS
Data Representation ICS 233
Binary to Decimal Conversion
Information Representation
Binary Values and Number Systems
Data Representation COE 308 Computer Architecture
Presentation transcript:

CDA 3100 Fall 2012

Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course

About Me My name is Zhenghao Zhang 4/30/2019 About Me My name is Zhenghao Zhang Why I am teaching this course: I worked for two years as an embedded system engineer, writing codes for embedded controllers. 4/30/2019 CDA3100 CDA3100

What you will learn to answer (among other things) How does the software instruct the hardware to perform the needed functions What is going on in the processor How a simple processor is designed

Why This Class Important? 4/30/2019 Why This Class Important? If you want to create better computers It introduces necessary concepts, components, and principles for a computer scientist By understanding the existing systems, you may create better ones If you want to build software with better performance If you want to have a good choice of jobs If you want to be a real computer scientist 4/30/2019 CDA3100 CDA3100

Career Potential for a Computer Science Graduate 4/30/2019 Career Potential for a Computer Science Graduate http://www.jobweb.com/studentarticles.aspx?id=904&terms=starting+salary 4/30/2019 CDA3100 CDA3100

Career Potential for a Computer Science Graduate 4/30/2019 Career Potential for a Computer Science Graduate Source: NACE Fall 2005 Report (http://www.jobweb.com/resources/library/Careers_In/Starting_Salary_51_01.htm) 4/30/2019 CDA3100 CDA3100

Required Background Based on years of teaching this course, I find that you will suffer if you do not have the required C/C++ programming background. We will need assembly coding, which is more advanced than C/C++. If you do not have a clear understanding at this moment of array and loop , it is recommended that you take this course at a later time, after getting more experience with C/C++ programming.

Array – What Happens? #include <stdio.h> int main (void) { int A[5] = {16, 2, 77, 40, 12071}; A[A[1]] += 1; return 0; } A[1] = 2, so A[2] <- 78.

Loop – What Happens? #include <stdio.h> int main () { int A[5] = {16, 20, 77, 40, 12071}; int result = 0; int i = 0; while (result < A[i]) { result += A[i]; i++; } return 0; result = 113, i=3

4/30/2019 Class Communication This class will use class web site to post news, changes, and updates. So please check the class website regularly Please also make sure that you check your emails on the account on your University record Blackboard will be used for posting the grades 4/30/2019 CDA3100 CDA3100

Required Textbook The required textbook for this class is 4/30/2019 Required Textbook The required textbook for this class is “Computer Organization and Design” The hardware/software interface By David A. Patterson and John L. Hennessy Fourth Edition 4/30/2019 CDA3100 CDA3100

Lecture Notes and Textbook 4/30/2019 Lecture Notes and Textbook All the materials that you will be tested on will be covered in the lectures Even though you may need to read the textbook for review and further detail explanations The lectures will be based on the textbook and handouts distributed in class 4/30/2019 CDA3100 CDA3100

Decimal Numbering System 4/30/2019 Decimal Numbering System We humans naturally use a particular numbering system 4/30/2019 CDA3100 CDA3100

Decimal Numbering System 4/30/2019 Decimal Numbering System For any nonnegative integer , its value is given by Here d0 is the least significant digit and dn is the most significant digit 4/30/2019 CDA3100 CDA3100

General Numbering System – Base X 4/30/2019 General Numbering System – Base X Besides 10, we can use other bases as well In base X, Then, the base X representation of this number is defined as dndn-1…d2d1d0. The same number can have many representations on many bases. For 23 based 10, it is 23ten 10111two 17sixteen, often written as 0x17. 4/30/2019 CDA3100 CDA3100

Commonly Used Bases Which one is natural to computers? Why? Base 4/30/2019 Commonly Used Bases Base Common Name Representation Digits 10 Decimal 5023ten or 5023 0-9 2 Binary 1001110011111two 0-1 8 Octal 11637eight 0-7 16 Hexadecimal 139Fhex or 0x139F 0-9, A-F Note that other bases are used as well including 12 and 60 Which one is natural to computers? Why? 4/30/2019 CDA3100 CDA3100

Meaning of a Number Representation 4/30/2019 Meaning of a Number Representation When we specify a number, we need also to specify the base For example, 10 presents a different quantity in a different base  There are 10 kinds of mathematicians. Those who can think binarily and those who can't... http://www.math.ualberta.ca/~runde/jokes.html 4/30/2019 CDA3100 CDA3100

4/30/2019 CDA3100

Question How many different numbers that can be represented by 4 bits? Always 16 (24), because there are this number of different combinations with 4 bits, regardless of the type of the number these 4 bits are representing. Obviously, this also applies to other number of bits. With n bits, we can represent 2n different numbers. If the number is unsigned integer, it is from 0 to 2n-1.

Conversion between Representations 4/30/2019 Conversion between Representations Now we can represent a quantity in different number representations How can we convert a decimal number to binary? How can we then convert a binary number to a decimal one? 4/30/2019 CDA3100 CDA3100

Conversion Between Bases 4/30/2019 Conversion Between Bases From binary to decimal example 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20 4/30/2019 CDA3100 CDA3100

Converting from binary to decimal Converting from binary to decimal. This conversion is also based on the formula: d = dn-12n-1 + dn-22n-2 +…+ d222 + d121 + d020 while remembering that the digits in the binary representation are the coefficients. For example, given 101011two, in decimal, it is 25 + 23 + 21 + 20 = 43.

Conversion Between Bases Converting from decimal to binary: given a number in decimal, repeatedly divide it by 2, and write down the remainder from right to the left, until the quotient is 0 Example: 11. Quotient Remainder 5 1 2

Digging a little deeper Why can a binary number be obtained by keeping on dividing by 2, and why should the last remainder be the first bit? Note that Any integer can be represented by the summation of the powers of 2: d = dn-12n-1 + dn-22n-2 +…+ d222 + d121 + d020 For example, 19 = 16 + 2 + 1 = 1 * 24 + 0 * 23 + 0 * 22 + 1 * 21 + 1 * 20. The binary representation is the binary coefficients. So 19ten in binary is 10011two.

Digging a little deeper In fact, any integer can be represented by the summation of the powers of some base, where the base is either 10, 2 or 16 in this course. For example, 19 = 1 * 101 + 9 * 100. How do you get the 1 and 9? You divide 19 by 10 repeatedly until the quotient is 0, same as binary! In fact, the dividing process is just an efficient way to get the coefficients. How do you determine whether the last bit is 0 or 1? You can do it by checking whether the number is even or odd. Once this is determined, you go ahead to determine the next bit, by checking (d - d020)/2 is even or odd, and so on, until you don’t have to check any more (when the number is 0).

Conversion between Base 16 and Base 2 Extremely easy. From base 2 to base 16: divide the digits in to groups of 4, then apply the table. From base 16 to base 2: replace every digit by a 4-bit string according to the table. Because 16 is 2 to the power of 4.

Addition in binary 39ten + 57ten = ? How to do it in binary?

Addition in Binary First, convert the numbers to binary forms. We are using 8 bits. 39ten -> 001001112 57ten -> 001110012 Second, add them. 00100111 00111001 01100000

Addition in binary The addition is bit by bit. We will run in at most 4 cases, where the leading bit of the result is the carry: 0+0+0=00 1+0+0=01 1+1+0=10 1+1+1=11

Subtraction in Binary 57ten – 39ten = ?

Subtraction in Binary 00111001 00100111 00010010

Subtraction in binary Do this digit by digit. No problem if 0 - 0 = 0, 1 - 0 = 1 1 – 1 = 0. When encounter 0 - 1, set the result to be 1 first, then borrow 1 from the next more significant bit, just as in decimal. Borrow means setting the borrowed bit to be 0 and the bits from the bit following the borrowed bit to the bit before the current bit to be 1. Think about, for example, subtracting 349 from 5003 (both based 10). The last digit is first set to be 4, and you will be basically subtracting 34 from 499 from now on.