CS1800: Hex & Logic. Professor Kevin Gold

Size: px
Start display at page:

Download "CS1800: Hex & Logic. Professor Kevin Gold"

Transcription

1 CS1800: Hex & Logic Professor Kevin Gold

2 Reviewing Last Time: Binary Last time, we saw that arbitrary numbers can be represented in binary. Each place in a binary number stands for a different power of 2. If you re familiar with the powers of 2, a reasonable way to convert from decimal to binary is to subtract powers of 2 until you get is too big, so =65 that s close to 64, so = 1, subtract 1 and done

3 Powers of 2 Will Become Familiar Because of Gadgets iphone XR memory possibilities 512 GB Hard Drive (sometimes rounded to 500) This often happens because memory addresses are binary numbers - so the maximum n-bit address is 2 n -1

4 Powers of 2 You Should Become Familiar With 2 8 = 256. A chunk of 8 bits is a byte, and 256 is the number of values a byte can take on (0-255). This makes 255 come up as a max value for things, from IP address values to Zelda rupees 2 10 = Kilobytes don t come up much anymore, but this is still a handy way of estimating how big binary values are = 2 10 * 2 10 * 2 10 = about 1,000,000,000 Megabyte = 2 20 bytes, Gigabyte = 2 30 bytes, etc. 2 4 = 16. This is the number of values possible in half a byte, or a nibble (0-15), which will be useful for our study of hex.

5 Hexadecimal Hexadecimal is base 16, and also a kind of shorthand for binary. As a base 16 number system, each place has 16 possible digits: A B C D E F Places are worth 1, 16, 16 2 = 256, 16 3 = 4096 so A001 is (10* *1) The number may be preceded by 0x or have subscript 16 to signal that it is hex and not binary or decimal: 0x20 = = 32. The evaluation of a particular hex string as a number is therefore a sum of powers of 16. 0xA9 = (16*10 + 9*1) = 169 0x103 = ( ) = ( ) = 259

6 The Trick : One Hex Digit is a Nibble (4 bits) The convenient thing for CS is that we can very easily convert between binary and hex. Every 4 bits can be directly read as a hex digit, and this will be the correct hexadecimal number. For example, can be read as 0101 = 5 and 0010 = 2 so the hex should be 0x52. (Check: = = 82. 5*16+2 = 82.) Or, can be read as = (15,12) = 0xFC. (Check: = 252; 15*16+12=252.)

7 The Trick : One Hex Digit is A Nibble (4 bits) The binary values and the hex digits 0 F serve the same purpose In both cases, they can represent a value between 0 and 15 The rest of the number is worth 16*whatever other value is written down Another way of putting it is, we could just see our binary nibbles as a wordy way of doing base 16 x16 x x16+2= F C 15x16+12=252

8 Some Examples of Hex Values in the Wild IPv6 IP addresses (network addresses): 128 bits in hex 2001:db8:85a3:8d3:1319:8a2e:370:7348 Windows blue screen of death errors Programming languages often refer to memory addresses using hex A Hex Editor lets you change files on a bit-by-bit level

9 Other Bases Decimal, hex, and binary all have features that make them useful to us but other bases work too We add a subscript to indicate the base in base 3: 1* *3 + 1*1 = 10 10, so Interpreting AAA 11 : 10* * *1 = = 1330 Value of 2222 b : 2b 3 + 2b 2 + 2b + 2 The same techniques for converting binary or hex work for other bases We mention this mostly so that you understand the bases we do care about better

10 CS Logic is Real Logic When someone says that s illogical or Sherlock Holmes makes a logical deduction, that is the same kind of logic we are talking about We ll see over the next two lectures how the logic in circuits and programming can also be used in mathematical proofs While different flavors of logic exist, depending on what you re trying to do, they generally share the rules we ll describe Cumberbatch as Sherlock Holmes

11 When Do We Use Logic in CS? Most commonly in writing conditional statements, like If A and B but not C, execute this code If we can simplify conditional statements like that, sometimes there is a modest gain in speed In showing computational problems are hard Logic is often a component to proofs that show problems are unlikely to have quick algorithms In designing circuits The course textbook shows how we can go all the way from simple logic circuits to a basic CPU!

12 Primary Logical Operators and Their Symbols AND: ^ True iff both arguments true It is raining AND I don t have an umbrella OR: v True iff at least one argument is true ( inclusive OR, our default assumption) It is raining OR the sprinklers are on NOT: True iff argument is false It is NOT raining

13 We Will Talk About Implication Later A B means A implies B, or If A, then B. It s similar to the kind of logical deduction you might be familiar with outside math. But if it wasn t Colonel Mustard, then it must be We ll pick it up later and see how we can express using our other operators

14 Relation to Sets A U B = {x : (x A) v (x B)} (or) A B = {x : (x A) ^ (x B)} (and) A = {x : (x A)} (not) Union Intersection Complement A B A B A Universe A U B A B A

15 Truth Tables Truth tables are a way of understanding particular logical formulas. We list all possible combinations of values of true or false for the logical formula variable, and list the outputs in the rightmost column. There will generally be 2 N possible combinations for N variables. A B A ^ B A B A v B F F F F F F A A F T F F T T F T T F F T F T T F T T T T T T

16 Truth Tables And Scratch Columns It can be helpful to add extra columns to a truth table to help figure out the final values. a b c (a^b) (a^ b) (c^ a) (a ^ b) v (a ^ b) v (c ^ a) F F F F F T F T F F T T T F F T F T T T F T T T

17 Truth Tables And Scratch Columns It can be helpful to add extra columns to a truth table to help figure out the final values. a b c (a^b) (a^ b) (c^ a) (a ^ b) v (a ^ b) v (c ^ a) F F F F F F T F F T F F F T T F T F F F T F T F T T F T T T T T

18 Truth Tables And Scratch Columns It can be helpful to add extra columns to a truth table to help figure out the final values. a b c (a^b) (a^ b) (c^ a) (a ^ b) v (a ^ b) v (c ^ a) F F F F F F F T F F F T F F F F T T F F T F F F T T F T F T T T F T F T T T T F

19 Truth Tables And Scratch Columns It can be helpful to add extra columns to a truth table to help figure out the final values. a b c (a^b) (a^ b) (c^ a) (a ^ b) v (a ^ b) v (c ^ a) F F F F F F F F T F F T F T F F F F F T T F F T T F F F T F T F T F T F T T F T F F T T T T F F

20 Truth Tables And Scratch Columns It can be helpful to add extra columns to a truth table to help figure out the final values. a b c (a^b) (a^ b) (c^ a) (a ^ b) v (a ^ b) v (c ^ a) F F F F F F F F F T F F T T F T F F F F F F T T F F T T T F F F T F T T F T F T F T T T F T F F T T T T T F F T

21 Truth Tables and Logical Equivalence If two logical formulas have the same truth table outcomes for all inputs, they are equivalent. a b c (a^b) v (a^ b) v (c^ a) F F F F F F T T F T F F F T T T T F F T T F T T T T F T T T T T a b c (a v c) F F F F F F T T F T F F F T T T T F F T T F T T T T F T T T T T

22 Creating a Formula From a Desired Truth Table Suppose we have desired outputs, and just want a logical formula that behaves exactly that way a b c??? F F F F F F T T F T F F F T T T T F F T T F T T T T F T T T T T

23 Creating a Formula From a Desired Truth Table Suppose we have desired outputs, and just want a logical formula that behaves exactly that way a b c??? F F F F F F T T F T F F F T T T T F F T T F T T T T F T T T T T A brute force approach is to explicitly list all the true possibilities, and join them with OR. If it s one of those possibilities, it s true. If not, it s false. ( a ^ b ^ c) v ( a ^ b ^ c) v (a ^ b ^ c) v (a ^ b ^ c) v (a ^ b ^ c) v (a ^ b ^ c)

24 Disjunctive Normal Form (DNF) A clause is a part of a logical formula in parentheses. A formula in disjunctive normal form consists of clauses where the clauses contain only AND, and the clauses are only joined by OR. The method we just suggested produces disjunctive normal form. ( a ^ b ^ c) v ( a ^ b ^ c) v (a ^ b ^ c) v (a ^ b ^ c) v (a ^ b ^ c) v (a ^ b ^ c) The formula we were describing earlier is, too, despite not mentioning all its variables in all clauses: (a^b) v (a^ b) v (c^ a) disjunctive - having to do with OR (the formula is one big OR) normal form - as in, standardized

25 Simplifying Logical Formulas Simplifying formulas can make them easier to read and quicker to compute. The rules for simplifying logical formulas are mostly commonsense. Example: A ^ A simplifies to F. Something can t be true and false at the same time. There can be more than one path to simplification - different rules applied in different orders. It is sometimes ambiguous what counts as simplified ( as short as possible is generally what s desired, but sometimes multiple formulas are equally short)

26 Memorizing names not necessary except De Morgan s equivalent to

27 A Logical Simplification (a ^ b) v (a ^ b) v (c ^ a) (a ^ (b v b)) v (c ^ a) (distributive) (a ^ T) v (c ^ a) (complement) a v (c ^ a) (identity) (a v c) ^ (a v a) (distributive) (a v c) ^ T (complement) a v c (identity)

28 Another Logical Simplification ((a ^ b ^ c) v (a ^ b ^ c)) v (a v b) ((a ^ b) ^(c v c)) v (a v b) (distributive) (a ^ b ^ T) v (a v b) (complement) (a ^ b) v (a v b) (identity) (a ^ b) v ( a ^ b) (de Morgan s) (a ^ b) v ( a ^ b) (double negation) (a v a) ^ b (distributive) T ^ b (complement) b (identity)

29 De Morgan s Observations Notice that because we can always use De Morgan s law to flip a sign, we only need either AND or OR. We could always write one in terms of the other. a ^ b ^ c <=> ( a v b v c) a v b v c <=> ( a ^ b ^ c)

30 De Morgan s Observations All of the logical laws have their equivalents when talking about sets. We can have a pictorial version of De Morgan s Laws. A B = A U B A B U A B = A B

31 Using De Morgan s to Create Formulas from False TT Entries Before, we saw how it was possible to create formulas directly from truth tables by using just the true entries. We can read off only the false entries, too. a b c??? F F F F F F T T F T F F F T T T T F F T T F T T T T F T T T T T As long as a formula is none of the false entries, it must be true. So we can say, Not this AND not that. ( a ^ b ^ c) ^ ( a ^ b ^ c) Applying De Morgan s law lets us distribute the s: (a v b v c) ^ (a v b v c)

32 Conjunctive Normal Form (CNF) Conjunctive Normal Form is a bunch of clauses joined by AND, where each clause contains only OR. The process described on the previous slide is a way to get CNF for any desired truth table. (Thus, any formula can be converted to CNF.) CNF comes up in theoretical computer science in proofs that problems are hard to compute. (a v b v c) ^ (a v b v c) ^ conjunctive - having to do with AND (the formula is one big AND)

33 Logic Gates Circuit elements called logic gates make up the important hardware in your computer, including the central processing unit (CPU) In principle, it s possible to create any pattern of outputs from any pattern of inputs using just AND, OR, and NOT. AND gate OR gate NOT gate

34 Implementation of Logic Gates (Very Optional) Logic gates rely on semiconductors to act as switches that are either normally open or normally shut If a switch is closed, then current can pass The line that isn t a switch is hidden in the logic diagram AND needs both switches OR can have either shut

35 An Example of a Logical Circuit a b c ((a ^ b) ^ (a v c)) Notice the difference between a connection and a hop

36 Can We Simplify This? ((a ^ b) ^ (a v c)) Distributive: ((a ^ b) ^ a) v ((a ^ b) ^ c)) Commutative, associative: ((a ^ a ^ b) v ((a ^ b) ^ c)) Idempotence: ((a ^ b) v ((a ^ b) ^ c)) Absorption: (a ^ b) a b c (We can actually do this with 1 gate on the next slide )

37 Other Logic Gates, in Decreasing Importance XOR: Exclusive OR NAND: Not And NOR: Not Or XNOR: Not XOR (responds iff inputs same!)

38 Bitwise AND a3 b3 a2 b2 a1 b1 a0 b0 out3 out2 out1 out & Recall that this performs intersection on sets represented with bits

39 Doing Other Computations With Logic The CPU does lots of things. How could it, for instance, add numbers with logic gates? Many things are represented in binary in computers, and T or F can be mapped to 1 and 0. Consider a piece of the machinery that handles just two input bits in the addition. It needs to take two bits as input and have the behavior at right for the sum and the carry

40 The Half-Adder as Example of Logic Circuits Doing Computation Now the above circuit is doing simple addition using just logical circuits How could we add entire multibit numbers? We just need a little more complexity

41 The Full-Adder and Multibit Computations A1 B1 A0 B0 Cout Full adder Cout Full adder S1 S0 The full adder essentially adds A and B, then adds the carry-in bit from the previous place. Stringing these together gives something that can add multibit numbers.

Binary addition example worked out

Binary addition example worked out Binary addition example worked out Some terms are given here Exercise: what are these numbers equivalent to in decimal? The initial carry in is implicitly 0 1 1 1 0 (Carries) 1 0 1 1 (Augend) + 1 1 1 0

More information

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Hakim Weatherspoon CS 3410 Computer Science Cornell University Hakim Weatherspoon CS 3410 Computer Science Cornell University The slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. memory inst 32 register

More information

ECE/CS 250 Computer Architecture

ECE/CS 250 Computer Architecture ECE/CS 250 Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates (Combinational Logic) Tyler Bletsch Duke University Slides are derived from work by Daniel J. Sorin (Duke), Alvy Lebeck

More information

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates ECE 250 / CPS 250 Computer Architecture Basics of Logic Design Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Andrew Hilton (Duke), Alvy Lebeck (Duke) Benjamin Lee (Duke), and Amir

More information

CHAPTER1: Digital Logic Circuits Combination Circuits

CHAPTER1: Digital Logic Circuits Combination Circuits CS224: Computer Organization S.KHABET CHAPTER1: Digital Logic Circuits Combination Circuits 1 PRIMITIVE LOGIC GATES Each of our basic operations can be implemented in hardware using a primitive logic gate.

More information

Boolean Algebra. Philipp Koehn. 9 September 2016

Boolean Algebra. Philipp Koehn. 9 September 2016 Boolean Algebra Philipp Koehn 9 September 2016 Core Boolean Operators 1 AND OR NOT A B A and B 0 0 0 0 1 0 1 0 0 1 1 1 A B A or B 0 0 0 0 1 1 1 0 1 1 1 1 A not A 0 1 1 0 AND OR NOT 2 Boolean algebra Boolean

More information

School of Computer Science and Electrical Engineering 28/05/01. Digital Circuits. Lecture 14. ENG1030 Electrical Physics and Electronics

School of Computer Science and Electrical Engineering 28/05/01. Digital Circuits. Lecture 14. ENG1030 Electrical Physics and Electronics Digital Circuits 1 Why are we studying digital So that one day you can design something which is better than the... circuits? 2 Why are we studying digital or something better than the... circuits? 3 Why

More information

Digital Logic (2) Boolean Algebra

Digital Logic (2) Boolean Algebra Digital Logic (2) Boolean Algebra Boolean algebra is the mathematics of digital systems. It was developed in 1850 s by George Boole. We will use Boolean algebra to minimize logic expressions. Karnaugh

More information

Mathematical Logic Part One

Mathematical Logic Part One Mathematical Logic Part One Question: How do we formalize the definitions and reasoning we use in our proofs? Where We're Going Propositional Logic (oday) Basic logical connectives. ruth tables. Logical

More information

Topic 1: Propositional logic

Topic 1: Propositional logic Topic 1: Propositional logic Guy McCusker 1 1 University of Bath Logic! This lecture is about the simplest kind of mathematical logic: propositional calculus. We discuss propositions, which are statements

More information

Digital Electronics Part 1: Binary Logic

Digital Electronics Part 1: Binary Logic Digital Electronics Part 1: Binary Logic Electronic devices in your everyday life What makes these products examples of electronic devices? What are some things they have in common? 2 How do electronics

More information

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic. Propositional Logic Winter 2012 Propositional Logic: Section 1.1 Proposition A proposition is a declarative sentence that is either true or false. Which ones of the following sentences are propositions?

More information

Logic and Boolean algebra

Logic and Boolean algebra Computer Mathematics Week 7 Logic and Boolean algebra College of Information Science and Engineering Ritsumeikan University last week coding theory channel coding information theory concept Hamming distance

More information

Fundamentals of Digital Design

Fundamentals of Digital Design Fundamentals of Digital Design Digital Radiation Measurement and Spectroscopy NE/RHP 537 1 Binary Number System The binary numeral system, or base-2 number system, is a numeral system that represents numeric

More information

Boolean Algebra, Gates and Circuits

Boolean Algebra, Gates and Circuits Boolean Algebra, Gates and Circuits Kasper Brink November 21, 2017 (Images taken from Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc.) Outline Last week: Von

More information

Part 1: Digital Logic and Gates. Analog vs. Digital waveforms. The digital advantage. In real life...

Part 1: Digital Logic and Gates. Analog vs. Digital waveforms. The digital advantage. In real life... Part 1: Digital Logic and Gates Analog vs Digital waveforms An analog signal assumes a continuous range of values: v(t) ANALOG A digital signal assumes discrete (isolated, separate) values Usually there

More information

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table. The Laws of Boolean Boolean algebra As well as the logic symbols 0 and 1 being used to represent a digital input or output, we can also use them as constants for a permanently Open or Closed circuit or

More information

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors CSC258 Week 3 1 Logistics If you cannot login to MarkUs, email me your UTORID and name. Check lab marks on MarkUs, if it s recorded wrong, contact Larry within a week after the lab. Quiz 1 average: 86%

More information

Boolean Algebra and Digital Logic

Boolean Algebra and Digital Logic All modern digital computers are dependent on circuits that implement Boolean functions. We shall discuss two classes of such circuits: Combinational and Sequential. The difference between the two types

More information

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure. XOR - XNOR Gates Lesson Objectives: In addition to AND, OR, NOT, NAND and NOR gates, exclusive-or (XOR) and exclusive-nor (XNOR) gates are also used in the design of digital circuits. These have special

More information

Mathematical Logic Part One

Mathematical Logic Part One Mathematical Logic Part One Question: How do we formalize the defnitions and reasoning we use in our proofs? Where We're Going Propositional Logic (Today) Basic logical connectives. Truth tables. Logical

More information

Review: Additional Boolean operations

Review: Additional Boolean operations Review: Additional Boolean operations Operation: NAND (NOT-AND) NOR (NOT-OR) XOR (exclusive OR) Expressions: (xy) = x + y (x + y) = x y x y = x y + xy Truth table: x y (xy) x y (x+y) x y x y 0 0 1 0 1

More information

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications Discrete Mathematics and Its Applications Lecture 1: Proposition logic MING GAO DASE @ ECNU (for course related communications) mgao@dase.ecnu.edu.cn Sep. 12, 2017 Outline 1 Propositions 2 Connectives

More information

1 Boolean Algebra Simplification

1 Boolean Algebra Simplification cs281: Computer Organization Lab3 Prelab Our objective in this prelab is to lay the groundwork for simplifying boolean expressions in order to minimize the complexity of the resultant digital logic circuit.

More information

Building a Computer Adder

Building a Computer Adder Logic Gates are used to translate Boolean logic into circuits. In the abstract it is clear that we can build AND gates that perform the AND function and OR gates that perform the OR function and so on.

More information

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee ECE/CS 250: Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Alvin Lebeck, Daniel Sorin, Andrew Hilton, Amir Roth, Gershon Kedem Admin

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Describe and use algorithms for integer operations based on their expansions Relate algorithms for integer

More information

Numbers and Arithmetic

Numbers and Arithmetic Numbers and Arithmetic See: P&H Chapter 2.4 2.6, 3.2, C.5 C.6 Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University Big Picture: Building a Processor memory inst register file alu

More information

Unit 8A Computer Organization. Boolean Logic and Gates

Unit 8A Computer Organization. Boolean Logic and Gates Unit 8A Computer Organization Boolean Logic and Gates Announcements Bring ear buds or headphones to lab! 15110 Principles of Computing, Carnegie Mellon University - CORTINA 2 Representing and Manipulating

More information

Propositional Logic: Equivalence

Propositional Logic: Equivalence Propositional Logic: Equivalence Alice Gao Lecture 5 Based on work by J. Buss, L. Kari, A. Lubiw, B. Bonakdarpour, D. Maftuleac, C. Roberts, R. Trefler, and P. Van Beek 1/42 Outline Propositional Logic:

More information

Boolean circuits. Lecture Definitions

Boolean circuits. Lecture Definitions Lecture 20 Boolean circuits In this lecture we will discuss the Boolean circuit model of computation and its connection to the Turing machine model. Although the Boolean circuit model is fundamentally

More information

Definition 2. Conjunction of p and q

Definition 2. Conjunction of p and q Proposition Propositional Logic CPSC 2070 Discrete Structures Rosen (6 th Ed.) 1.1, 1.2 A proposition is a statement that is either true or false, but not both. Clemson will defeat Georgia in football

More information

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 3 for ENEL 353 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2016 SN s ENEL 353 Fall 2016 Slide Set 3 slide

More information

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL. 2017-18 XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL HALF ADDER 1. The circuit that performs addition within the Arithmetic and Logic Unit of the CPU are called adders. 2. A unit that adds two

More information

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173 Propositional Logic CSC 17 Propositional logic mathematical model (or algebra) for reasoning about the truth of logical expressions (propositions) Logical expressions propositional variables or logical

More information

Logic Gate Level. Part 2

Logic Gate Level. Part 2 Logic Gate Level Part 2 Constructing Boolean expression from First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result column of the truth table Works best for table with relatively

More information

A statement is a sentence that is definitely either true or false but not both.

A statement is a sentence that is definitely either true or false but not both. 5 Logic In this part of the course we consider logic. Logic is used in many places in computer science including digital circuit design, relational databases, automata theory and computability, and artificial

More information

Combinational Logic. Review of Combinational Logic 1

Combinational Logic. Review of Combinational Logic 1 Combinational Logic! Switches -> Boolean algebra! Representation of Boolean functions! Logic circuit elements - logic gates! Regular logic structures! Timing behavior of combinational logic! HDLs and combinational

More information

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations Chapter 1, Part I: Propositional Logic With Question/Answer Animations Chapter Summary Propositional Logic The Language of Propositions Applications Logical Equivalences Predicate Logic The Language of

More information

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms P Formula Simplification, Essential Laws, Normal Forms Lila Kari University of Waterloo P Formula Simplification, Essential Laws, Normal CS245, Forms Logic and Computation 1 / 26 Propositional calculus

More information

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary Number System Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary BOOLEAN ALGEBRA BOOLEAN LOGIC OPERATIONS Logical AND Logical OR Logical COMPLEMENTATION

More information

Computer organization

Computer organization Computer organization Levels of abstraction Assembler Simulator Applications C C++ Java High-level language SOFTWARE add lw ori Assembly language Goal 0000 0001 0000 1001 0101 Machine instructions/data

More information

Truth-Functional Logic

Truth-Functional Logic Truth-Functional Logic Syntax Every atomic sentence (A, B, C, ) is a sentence and are sentences With ϕ a sentence, the negation ϕ is a sentence With ϕ and ψ sentences, the conjunction ϕ ψ is a sentence

More information

Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.

Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1. Chapter 1 Chapter Summary Propositional Logic The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.3) Predicate Logic The Language of Quantifiers (1.4) Logical Equivalences (1.4)

More information

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System? Digital Operations and Computations Course Notes 0-Number Systems Text: Unit Winter 20 Professor H. Louie Department of Electrical & Computer Engineering Seattle University ECEGR/ISSC 20 Digital Operations

More information

THE LOGIC OF COMPOUND STATEMENTS

THE LOGIC OF COMPOUND STATEMENTS CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS Copyright Cengage Learning. All rights reserved. SECTION 2.4 Application: Digital Logic Circuits Copyright Cengage Learning. All rights reserved. Application:

More information

CSE 311: Foundations of Computing. Lecture 3: Digital Circuits & Equivalence

CSE 311: Foundations of Computing. Lecture 3: Digital Circuits & Equivalence CSE 311: Foundations of Computing Lecture 3: Digital Circuits & Equivalence Homework #1 You should have received An e-mail from [cse311a/cse311b] with information pointing you to look at Canvas to submit

More information

CSE20: Discrete Mathematics for Computer Science. Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication

CSE20: Discrete Mathematics for Computer Science. Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication CSE20: Discrete Mathematics for Computer Science Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication Disjunctive normal form Example: Let f (x, y, z) =xy z. Write this function in DNF. Minterm

More information

Compound Propositions

Compound Propositions Discrete Structures Compound Propositions Producing new propositions from existing propositions. Logical Operators or Connectives 1. Not 2. And 3. Or 4. Exclusive or 5. Implication 6. Biconditional Truth

More information

of Digital Electronics

of Digital Electronics 26 Digital Electronics 729 Digital Electronics 26.1 Analog and Digital Signals 26.3 Binary Number System 26.5 Decimal to Binary Conversion 26.7 Octal Number System 26.9 Binary-Coded Decimal Code (BCD Code)

More information

Latches. October 13, 2003 Latches 1

Latches. October 13, 2003 Latches 1 Latches The second part of CS231 focuses on sequential circuits, where we add memory to the hardware that we ve already seen. Our schedule will be very similar to before: We first show how primitive memory

More information

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops Module 2 asic Digital uilding locks Lecturer: Dr. Yongsheng Gao Office: Tech 3.25 Email: Web: Structure: Textbook: yongsheng.gao@griffith.edu.au maxwell.me.gu.edu.au 6 lecturers 1 tutorial 1 laboratory

More information

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations. EE 260: Introduction to Digital Design Number Systems Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Digital Computers n Number Systems n Representations n Conversions

More information

Sample Marking Scheme

Sample Marking Scheme Page 1 of 10 School of Computer Science 60-265-01 Computer Architecture and Digital Design Fall 2008 Midterm Examination # 1 B Wednesday, November 5, 2008 Sample Marking Scheme Duration of examination:

More information

Contents. Chapter 2 Digital Circuits Page 1 of 30

Contents. Chapter 2 Digital Circuits Page 1 of 30 Chapter 2 Digital Circuits Page 1 of 30 Contents Contents... 1 2 Digital Circuits... 2 2.1 Binary Numbers... 2 2.2 Binary Switch... 4 2.3 Basic Logic Operators and Logic Expressions... 5 2.4 Truth Tables...

More information

CSE 20 Discrete Math. Algebraic Rules for Propositional Formulas. Summer, July 11 (Day 2) Number Systems/Computer Arithmetic Predicate Logic

CSE 20 Discrete Math. Algebraic Rules for Propositional Formulas. Summer, July 11 (Day 2) Number Systems/Computer Arithmetic Predicate Logic CSE 20 Discrete Math Algebraic Rules for Propositional Formulas Equivalences between propositional formulas (similar to algebraic equivalences): Associative Summer, 2006 July 11 (Day 2) Number Systems/Computer

More information

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false. Section 1.2 Propositional Equivalences A tautology is a proposition which is always true. Classic Example: P P A contradiction is a proposition which is always false. Classic Example: P P A contingency

More information

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning. 3: Logic Why logic? Logic about inference or argument Start from assumptions or axioms Make deductions according to rules of reasoning Logic 3-1 Why logic? (continued) If I don t buy a lottery ticket on

More information

Midterm Examination # 1 Wednesday, February 25, Duration of examination: 75 minutes

Midterm Examination # 1 Wednesday, February 25, Duration of examination: 75 minutes Page 1 of 10 School of Computer Science 60-265-01 Computer Architecture and Digital Design Winter 2009 Semester Midterm Examination # 1 Wednesday, February 25, 2009 Student Name: First Name Family Name

More information

UNIVERSITI TENAGA NASIONAL. College of Information Technology

UNIVERSITI TENAGA NASIONAL. College of Information Technology UNIVERSITI TENAGA NASIONAL College of Information Technology BACHELOR OF COMPUTER SCIENCE (HONS.) FINAL EXAMINATION SEMESTER 2 2012/2013 DIGITAL SYSTEMS DESIGN (CSNB163) January 2013 Time allowed: 3 hours

More information

Lecture 2 Review on Digital Logic (Part 1)

Lecture 2 Review on Digital Logic (Part 1) Lecture 2 Review on Digital Logic (Part 1) Xuan Silvia Zhang Washington University in St. Louis http://classes.engineering.wustl.edu/ese461/ Grading Engagement 5% Review Quiz 10% Homework 10% Labs 40%

More information

Combinational Logic. By : Ali Mustafa

Combinational Logic. By : Ali Mustafa Combinational Logic By : Ali Mustafa Contents Adder Subtractor Multiplier Comparator Decoder Encoder Multiplexer How to Analyze any combinational circuit like this? Analysis Procedure To obtain the output

More information

Propositional Logic 1

Propositional Logic 1 Propositional Logic 1 Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth Tables 2 Propositions A proposition is

More information

SAMPLE ANSWERS MARKER COPY

SAMPLE ANSWERS MARKER COPY Page 1 of 12 School of Computer Science 60-265-01 Computer Architecture and Digital Design Fall 2012 Midterm Examination # 1 Tuesday, October 23, 2012 SAMPLE ANSWERS MARKER COPY Duration of examination:

More information

Tecniche di Verifica. Introduction to Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic Tecniche di Verifica Introduction to Propositional Logic 1 Logic A formal logic is defined by its syntax and semantics. Syntax An alphabet is a set of symbols. A finite sequence of these symbols is called

More information

Chapter 1 CSCI

Chapter 1 CSCI Chapter 1 CSCI-1510-003 What is a Number? An expression of a numerical quantity A mathematical quantity Many types: Natural Numbers Real Numbers Rational Numbers Irrational Numbers Complex Numbers Etc.

More information

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions Today s Topics Set identities Methods of proof Relationships to logical equivalences Functions Important definitions Relationships to sets, relations Special functions Set identities help us manipulate

More information

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook) Lecture 2 Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits Reading (Epp s textbook) 2.1-2.4 1 Logic Logic is a system based on statements. A statement (or

More information

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations Chapter 1, Part I: Propositional Logic With Question/Answer Animations Chapter Summary! Propositional Logic! The Language of Propositions! Applications! Logical Equivalences! Predicate Logic! The Language

More information

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways:

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: Boolean Algebra (1) Functions Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: An expression is finite but not unique f(x,y)

More information

Cs302 Quiz for MID TERM Exam Solved

Cs302 Quiz for MID TERM Exam Solved Question # 1 of 10 ( Start time: 01:30:33 PM ) Total Marks: 1 Caveman used a number system that has distinct shapes: 4 5 6 7 Question # 2 of 10 ( Start time: 01:31:25 PM ) Total Marks: 1 TTL based devices

More information

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra 4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra To design a digital circuit that will perform a required function, it is necessary to manipulate and combine the various input signals in certain

More information

Combinational logic. Possible logic functions of two variables. Minimal set of functions. Cost of different logic functions.

Combinational logic. Possible logic functions of two variables. Minimal set of functions. Cost of different logic functions. Combinational logic Possible logic functions of two variables Logic functions, truth tables, and switches NOT, ND, OR, NND, NOR, OR,... Minimal set xioms and theorems of oolean algebra Proofs by re-writing

More information

PHIL12A Section answers, 16 February 2011

PHIL12A Section answers, 16 February 2011 PHIL12A Section answers, 16 February 2011 Julian Jonker 1 How much do you know? 1. Show that the following sentences are equivalent. (a) (Ex 4.16) A B A and A B A B (A B) A A B T T T T T T T T T T T F

More information

Propositional Logic and Semantics

Propositional Logic and Semantics Propositional Logic and Semantics English is naturally ambiguous. For example, consider the following employee (non)recommendations and their ambiguity in the English language: I can assure you that no

More information

Numbers and Arithmetic

Numbers and Arithmetic Numbers and Arithmetic See: P&H Chapter 2.4 2.6, 3.2, C.5 C.6 Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University Big Picture: Building a Processor memory inst register file alu

More information

Chapter 1, Section 1.1 Propositional Logic

Chapter 1, Section 1.1 Propositional Logic Discrete Structures Chapter 1, Section 1.1 Propositional Logic These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 6 th ed., by Kenneth H. Rosen, published

More information

CSC9R6 Computer Design. Practical Digital Logic

CSC9R6 Computer Design. Practical Digital Logic CSC9R6 Computer Design Practical Digital Logic 1 References (for this part of CSC9R6) Hamacher et al: Computer Organization App A. In library Floyd: Digital Fundamentals Ch 1, 3-6, 8-10 web page: www.prenhall.com/floyd/

More information

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Digital Logic Our goal for the next few weeks is to paint a a reasonably complete picture of how we can go from transistor

More information

CSC Discrete Math I, Spring Propositional Logic

CSC Discrete Math I, Spring Propositional Logic CSC 125 - Discrete Math I, Spring 2017 Propositional Logic Propositions A proposition is a declarative sentence that is either true or false Propositional Variables A propositional variable (p, q, r, s,...)

More information

S C F F F T T F T T S C B F F F F F T F T F F T T T F F T F T T T F T T T

S C F F F T T F T T S C B F F F F F T F T F F T T T F F T F T T T F T T T EECS 270, Winter 2017, Lecture 1 Page 1 of 6 Use pencil! Say we live in the rather black and white world where things (variables) are either true (T) or false (F). So if S is Mark is going to the Store

More information

Number System conversions

Number System conversions Number System conversions Number Systems The system used to count discrete units is called number system. There are four systems of arithmetic which are often used in digital electronics. Decimal Number

More information

Computer Organization: Boolean Logic

Computer Organization: Boolean Logic Computer Organization: Boolean Logic Representing and Manipulating Data Last Unit How to represent data as a sequence of bits How to interpret bit representations Use of levels of abstraction in representing

More information

Solutions to Homework I (1.1)

Solutions to Homework I (1.1) Solutions to Homework I (1.1) Problem 1 Determine whether each of these compound propositions is satisable. a) (p q) ( p q) ( p q) b) (p q) (p q) ( p q) ( p q) c) (p q) ( p q) (a) p q p q p q p q p q (p

More information

Implementation of Boolean Logic by Digital Circuits

Implementation of Boolean Logic by Digital Circuits Implementation of Boolean Logic by Digital Circuits We now consider the use of electronic circuits to implement Boolean functions and arithmetic functions that can be derived from these Boolean functions.

More information

Equational Logic and Term Rewriting: Lecture I

Equational Logic and Term Rewriting: Lecture I Why so many logics? You all know classical propositional logic. Why would we want anything more? Equational Logic and Term Rewriting: Lecture I One reason is that we might want to change some basic logical

More information

Students should be able to (a) produce a truth table from a given logic diagram

Students should be able to (a) produce a truth table from a given logic diagram Truth tables Teacher s Notes Lesson Plan Length 60 mins Specification Link 2.1.2/f inary logic Learning objective Students should be able to (a) produce a truth table from a given logic diagram Time (min)

More information

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8 KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8 Q1. What is a Proposition? Q2. What are Simple and Compound Propositions? Q3. What is a Connective? Q4. What are Sentential

More information

Proof strategies, or, a manual of logical style

Proof strategies, or, a manual of logical style Proof strategies, or, a manual of logical style Dr Holmes September 27, 2017 This is yet another version of the manual of logical style I have been working on for many years This semester, instead of posting

More information

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks ECE 545 Digital System Design with VHDL Lecture Digital Logic Refresher Part A Combinational Logic Building Blocks Lecture Roadmap Combinational Logic Basic Logic Review Basic Gates De Morgan s Law Combinational

More information

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) September 5, 2002 John Wawrzynek Fall 2002 EECS150 Lec4-bool1 Page 1, 9/5 9am Outline Review of

More information

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives Logic Logic is study of abstract reasoning, specifically, concerned with whether reasoning is correct. Logic focuses on relationship among statements as opposed to the content of any particular statement.

More information

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3 Digital Logic: Boolean Algebra and Gates Textbook Chapter 3 Basic Logic Gates XOR CMPE12 Summer 2009 02-2 Truth Table The most basic representation of a logic function Lists the output for all possible

More information

Chapter 4, Logic using Propositional Calculus Handout

Chapter 4, Logic using Propositional Calculus Handout ECS 20 Chapter 4, Logic using Propositional Calculus Handout 0. Introduction to Discrete Mathematics. 0.1. Discrete = Individually separate and distinct as opposed to continuous and capable of infinitesimal

More information

Possible logic functions of two variables

Possible logic functions of two variables ombinational logic asic logic oolean algebra, proofs by re-writing, proofs by perfect induction logic functions, truth tables, and switches NOT, ND, OR, NND, NOR, OR,..., minimal set Logic realization

More information

Simple Interactions CS 105 Lecture 2 Jan 26. Matthew Stone

Simple Interactions CS 105 Lecture 2 Jan 26. Matthew Stone Simple Interactions CS 105 Lecture 2 Jan 26 Matthew Stone Rutgers University Department of Computer Science and Center for Cognitive Science Themes from the Preface 2 Computers are multimedia devices Text

More information

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) January 30, 2003 John Wawrzynek Outline Review of three representations for combinational logic:

More information

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Packet #1: Logic & Proofs. Applied Discrete Mathematics Packet #1: Logic & Proofs Applied Discrete Mathematics Table of Contents Course Objectives Page 2 Propositional Calculus Information Pages 3-13 Course Objectives At the conclusion of this course, you should

More information

EECS Variable Logic Functions

EECS Variable Logic Functions EECS150 Section 1 Introduction to Combinational Logic Fall 2001 2-Variable Logic Functions There are 16 possible functions of 2 input variables: in general, there are 2**(2**n) functions of n inputs X

More information

A crash course in Digital Logic

A crash course in Digital Logic crash course in Digital Logic Computer rchitecture 1DT016 distance Fall 2017 http://xyx.se/1dt016/index.php Per Foyer Mail: per.foyer@it.uu.se Per.Foyer@it.uu.se 2017 1 We start from here Gates Flip-flops

More information