Logic and data representation Revision. AND gate A B A B All inputs have to be true ( i.e 1) for the output of the gate to be high, in all other cases.

Slides:



Advertisements
Similar presentations
The Binary Numbering Systems
Advertisements

A digital system is a system that manipulates discrete elements of information represented internally in binary form. Digital computers –general purposes.
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
Logic Circuits Another look at Floating Point Numbers Common Combinational Logic Circuits Timing Sequential Circuits Note: Multiplication & Division in.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Lecture 3 Number Representation 2 This week – Recap Addition – Addition circuitry – Subtraction of integers in binary – Representing numbers with fractional.
Text Representation within Computers CS208. The Binary Digit (Bit) One bit can encode a value set that contains two elements e.g. {black, white}, {up,
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
Storage of Bits Computers represent information as patterns of bits
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Digital Fundamentals Floyd Chapter 2 Tenth Edition
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Data Representation 3 This week – Recap on Floating point number – ASCII – unicode.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
Chapter 12 Digital Logic Circuit Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Mantıksal Tasarım – BBM231 M. Önder Efe
Topic 4 Computer Mathematics and Logic
Binary Representation and Computer Arithmetic
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
Dr. Bernard Chen Ph.D. University of Central Arkansas
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Binary Representation. Binary Representation for Numbers Assume 4-bit numbers 5 as an integer  as an integer  How? 5.0 as a real number  How?
Numbers and Number Systems
Computers Organization & Assembly Language
Computer Arithmetic Nizamettin AYDIN
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Logic and Digital System Design - CS 303
Computer Architecture
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Number Systems Spring Semester 2013Programming and Data Structure1.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
The Teacher CP4 Binary and all that… CP4 Revision.
CSC 221 Computer Organization and Assembly Language
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
1. Computing Systems Lecture 3 Binary Representation & Boolean Logic Binary and Logic 2.
Boolean and Sequential Logic Last week – Basic Gates AND OR NOT NOR XOR NAND.
CO5023 Introduction to Digital Circuits. What do we know so far? How to represent numbers (integers and floating point) in binary How to convert between.
Number Representation and Arithmetic Circuits
Number Systems and Computer Arithmetic Winter 2014 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
Number Representation 1 Lecture 2. Outcomes By the end of the session you should: – Understand what bits/bytes/words are. – Understanding conversion between.
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Computing Systems Lecture 3 Binary Representation & Boolean Logic Binary and Logic 1.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
CS2100 Computer Organisation
Programming and Data Structure
Data Representation.
Number Representation
Data Representation Binary Numbers Binary Addition
University of Gujrat Department of Computer Science
CS1010 Programming Methodology
Chapter 2 Bits, Data Types & Operations Integer Representation
Data Representation Data Types Complements Fixed Point Representation
ECE 331 – Digital System Design
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Presentation transcript:

Logic and data representation Revision

AND gate A B A B All inputs have to be true ( i.e 1) for the output of the gate to be high, in all other cases the output is false.

OR gate A B A B If any of the inputs are true then the output is true

A _ A _ A NOT gate The output of a NOT gate is the opposite of the input, in other words the gate inverts the input, so is often called an inverter.

NAND gate The opposite of an AND gate when any of the inputs are false the output is true Equivalent to A B A B

A B A B Equivalent to The opposite of the OR gate, the gate is only true when none of the inputs are true. NOR gate

A B Exclusive OR (XOR) In a 2-input the gate is only true when the inputs are different.

Boolean Algebra

Combining gates

Truth table for previous slide ABCDEF

Truth table to logic diagram ABCDEFG

Looking at the truth table on the previous slide Output G is only true when the inputs A is false and B is true, or A is true and B is false The output for an AND gate is only true when both the inputs are true, so if we build a circuit that when the combinations of inputs A is false and B is true, or A is true and B is false we get an true output we have built a circuit to do this logic operation.

A is false and B is true So if we can find a way to make the output from AND be true for this combination – part of the answer. There is no problem with B this is true. A is false so we need to pass it through a device that we A is false the output is true – NOT gate.

We can do a similar operation for when A is true and B is false We also need a way of combining these two parts together so if either combination occurs we get an true (1) output. OR gate

Combining gates

R-S Flip-Flop/Latch

For a R-S flip-flop based around the NOR gate. RSQ(t+1) 000- stays same (e.g. if 1 to starts then stays as 1) 011-Q is set to Q is reset 11X-indeterminate

Where Q(t) is the current value (or state) of the output Q and Q(t+1) is the state of Q that will be produce. X is indeterminate (due to the outputs dependent on which gate changes first)

D-type Data (D) only appears at the output Q on a clock pulse. So if D=1 on a clock pulse, R=0,S=1 and Q=1. So if D=0 on a clock pulse R=1,S=0 and Q=0. Otherwise Q stays the same.

Shift Register A 4-bit shift register

Shift Register Each time the flip-flop are clocked ( goes positive then negative), the value at the input to the flip-flop is passed to its output. The effect is that a sequence at the input to the circuit is passed from the input to the output of the circuit one bit at a time.

J-K Flip-Flop Three inputs - J,K,and clock This is a master-slave arrangement, the inputs are isolated from the outputs by the second latch, which does not change until after the master has ‘latched’.

J-K Flip-Flop JK Q(t)Comment 00QThe output Q stays the same. 010Reset (Q=0) 101Set (Q=1) 111Toggle Two ways to get no change on output: Clock turned off J and K both 0

Numbering Systems (Binary) The two-state nature of logic gates means the use of 0 or 1, as the basic unit of the count is natural. Data is represented by binary digits (bits), words are groups of bits, but by convention the size of words are multiples of 8 bits (or a byte). bit furthest right as the least significant bit (lsb) and bit furthest left as the most significant bit as the most significant bit (msb).

Decimalmsb Lsb

Numbering system (Hexadecimal) A base-16 system with 16 possible digits {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}. Each hexadecimal number can be represented by 4 bits.

HexadecimalBinaryDecimal A B C D E F111115

Negative and Positive Numbers So far is the discussion no mention has been made about the being able to represent negative numbers, how can both negative and positive number be stored.

2’s complement There is an alternative, which allows addition and subtraction to be treated in the same way. 2’s complement has the ‘sign’ of the number built in. This achieved by the most significant bit the value –2 n-1 having a negative value so if n=8 this is –128 and the rest of the bits are unsigned bits.

2’s complement If was stored the msb =-128 and the rest equals 1 so the number is –128+1=-127. If was stored the msb =0 and the rest equals 1 so the number this time is 0+1=1

::::::::: ::::::::

So if 2’s complement we can represent numbers between –128 and +127, in all that is involved is adding two numbers together = = If we reverse all the bits in –126 we get if we add to this we get

Starting Number = Reverse bits Add Positive to negative and back

For example _____ = ^ Carry __|

Binary subtraction Binary subtraction is performed by converting the second number into it’s two’s complement and adding. So there is not a need for a subtracting circuit. As an example: 14-6

Subtraction Example Number A= Number B= Reverse bits in Number B B 2’s Complement = C ’s Complement of add

421½¼1/81/

Floating-point numbers Often we want to represent very small, very large numbers or numbers with fractional parts. For example, or One way of doing this is scientific notation where these numbers are split into two parts a number with a decimal point within it (called the mantissa) and a power of 10 (called the exponent).

Fixed NotationScientific NotationMantissaExponent x x

The decimal number could be represented as If we use this mantissa and exponent idea, it could also be written as x2 2 (Normalised) where the exponent shows the final position of the binary point relative to the current position. Because the binary point can be altered depending on the magnitude of the exponent, it often refereed to as a floating-point representation.

IEEE standard (single precision) SignExponentMantissa Bit 31Bits 23-30Bits ve

Features with floating point representation Gives a wide range of numbers It is not precise Precision and Range can be improved using more bits (64 bits in Double precision) – Bit 63 for sign, – bits for exponent – Bits 0 to 51 for mantissa

ASCII Most common text representation. Each character has a code. Special characters such as space, return, etc have codes. American Standards Code for Information Interchange. Alternatives: EBCDIC not widely used.

ASCII SOHDC1!1AQaq 2STXDC2“2BRbr 3ETXDC3#3CScs 4EOTDC4$4DTdt 5ENQNAK%5EUeu 6ACKSYN&6FVfv 7BELETB‘7GWgw 8BSCAN(8HXhx 9HTEM)9IYiy ALFSUB*:JZjz BVTESC+;K[k{ CFFFS, N^n~ FSIUS/?O_oDEL

Unicode ASCII used 7 bits (often the 8 th bit used to help check the data was transferred correctly). Therefore, limited a small character set. Unicode is a 16-bit system, and can deal with the requirements of the modern system, with the need for different character sets for different languages.

ASCII So what is the code for A? Go to the table and find A it is on the column marked 4 and row marked 1. This can be used to give a hexadecimal number – Column gives the higher hexadecimal number. – Row gives the low hexadecimal number. There A is What is this code as a decimal number? or ?

Test yourself! Go to URL: &stage=all&year=all Download summer exam papers for 2004 and 2005 (ones ending in N) – From 2004 paper do Q1,Q5 a,b,d – From 2005 paper do Q2a,c,d; Q5