ICS 2005 Instructor: Peter A. Dinda TA: Bin Lin Recitation 1.

Slides:



Advertisements
Similar presentations
Intro to Computer Systems Recitation #1 By sseshadr.
Advertisements

Integers. Integer Storage Since Binary consists only of 0s and 1s, we can’t use a negative sign ( - ) for integers. Instead, the Most Significant Bit.
2’s Complement Arithmetic (remember it’s a fixed length system)
Radix Conversion Given a value X represented in source system with radix  s, represent the same number in a destination system with radix  d Consider.
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
CSCI 3 CH 1.6. REMINDER Remember to put your Student ID # on your homework Remember to put your Student ID # on your homework If you are not going to.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Quiz 1.1 Convert the following unsigned binary numbers to their decimal equivalent: Number2 Number
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
CSE20 Lecture 3 Number Systems: Negative Numbers 1.Sign and Magnitude Representation 2.1’s Complement Representation 3.2’s Complement Representation 1.
Number System and Codes
Unsigned and Signed Numbers. Hexadecimal Number 217A 16 Position Digits A Value = 2x x x16 + Ax1 = 2x x x16.
Operations on data CHAPTER 4.
1.6 Signed Binary Numbers.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Computer Systems 1 Fundamentals of Computing Negative Binary.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
Computer Architecture
Dale & Lewis Chapter 3 Data Representation. Data and computers Everything inside a computer is stored as patterns of 0s and 1s Numbers, text, audio, video,
1 Bit Operator. Advanced Compiler Laboratory2 Bit operators ! : invert logical value if value is 0 change to 1, otherwise set to 0 ~ : invert all bits.
COMPSCI 210 Semester Tutorial 1
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
CPU Internal memory I/O interface circuit System bus
Mohammad Amin Kuhail M.Sc. (York, UK) University of Palestine Faculty of Engineering and Urban planning Software Engineering Department Digital Logic Design.
The Teacher CP4 Binary and all that… CP4 Revision.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
Positional Number Systems
ECEN 248 Lab 4: Multiplexer Based Arithmetic Logic Unit
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.
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Chapter 1  Number Systems Decimal System Binary System Octal System Hexadecimal System  Binary weighted cods Signed number binary order  1’s and 2’s.
15213 Recitation Section C Introduction Unix and C Playing with Bits Practice Problems Shimin Chen Sept. 9, 2002 Outline.
1 Positive numbers are well understood An n-bit number represents numbers from 0 to 2 n -1 n+m bits can be used to represent n-bit integer and m-bit fraction.
Addition and Substraction
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Integer Exponents. Look for a pattern in the table to extend what you know about exponents to include negative exponents. ÷ –1 10 –
Integer Multiplication, Division Arithmetic shift Twice the number of places MIPS multiply unit. mult, multu Significant bits Mfhi, mflo, div, divu Arithmetic.
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
ELECTRICAL ENGINEERING: PRINCIPLES AND APPLICATIONS, Third Edition, by Allan R. Hambley, ©2005 Pearson Education, Inc. Chapter 7 Logic Circuits.
Chapter 4 Operations on Bits. Apply arithmetic operations on bits when the integer is represented in two’s complement. Apply logical operations on bits.
Computer Organization 1 Data Representation Negative Integers.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
1  For recitations  Amr Mahmoud  Office Hours: Monday Benedum Hall.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
CSE20 Lecture 2: Number Systems: Binary Numbers, Gray Code, and Negative Numbers CK Cheng 1.
Software Design and Development Storing Data Computing Science.
Data Lab: Manipulating Bits
Advanced Binary b. describe and use two’s complement and sign and magnitude to represent negative integers; c. perform integer binary arithmetic, that.
Chapter 4 Operations on Bits.
Boolean Algebra, Bitwise Operations
Reference: Moris Mano 4th Edition Chapter 4
Recitation: Data Lab The TAs Sep 11, 2017.
BCD = Binary Coded Decimal
1.6) Storing Integer:.
13 Digital Logic Circuits.
Lab Project #1: Datalab Assigned March 12, 2012; due March 22, 11:59 PM Professor Hugh C. Lauer CS-2011, Machine Organization and Assembly Language.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts.
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Presentation transcript:

ICS 2005 Instructor: Peter A. Dinda TA: Bin Lin Recitation 1

Project 1: Datalab Part I: Bit manipulations X= 0011 Y = 1010 (NOR?) (XOR?) X NOR Y is 0100 X XOR Y is 1001

Puzzle 1 X NOR Y (~(x|y)) using only ~ and & Hints: DeMorgan's Law –a rule of inference, NOT, AND, and OR operatorsNOTANDOR –to distribute a negative to a conjunction or disjunctionnegativeconjunctiondisjunction Example: ~(A | B): "It is not true that the class is boring or the newspaper is interesting.“ ~A & ~B: "The class is not boring and the newspaper is not interesting.”

Part II: Two’s Complement Arithmetic a way of representing positive and negative integers any bit pattern that has a sign bit of 0 is a positive number, on the other hand, sign bit 1 means negative Positive: convert it straight into decimal as you would convert a normal binary number Negative: bit pattern needs to be converted out of 2's complement before you can convert it from binary into decimal.

Two's complement using patterns of length 3

Puzzle 1 tmax(void): largest two’s complement integer just use's 2's complement max integer definition ~(1 << 31) or ~(0x1 <<31)

How to check your code before handin dlc: a modified ANSI C compiler, check your programs for compliance with the coding style rules. What is style rules? –straightline code (i.e., no loops or conditionals) –a limited number of C arithmetic and logical operators. Usage:./dlc bits.c Demo

How to check your code before handin (cont.) btest: evaluate the functional correctness of your code. Read the README! Usage:./btest Work through the functions one at a time -f flag to instruct btest to test only a single function, e.g.,./btest -f isPositive. Demo

See how you’re doing “submit.pl” script st.htmlhttp://grayling.cs.northwestern.edu/dlconte st.html