• No results found

Variables and Functions

N/A
N/A
Protected

Academic year: 2022

Share "Variables and Functions"

Copied!
49
0
0

Loading.... (view fulltext now)

Full text

(1)

CS 226: Digital Logic Design

Lecture 4: Introduction to Logic Circuits Ashutosh Trivedi

0 1

0

1

0

1 IS

S0

Department of Computer Science andEngineering,

(2)

Ashutosh Trivedi – 2 of 29

Objectives

In this lecture we will introduce:

1. Logic functions and circuits,

2. Boolean algebrafor manipulating with logic functions, 3. Logic gates, and

4. Synthesisof simple logic circuits.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(3)

Objectives

Logic functions and circuits

Boolean Algebra

Synthesis of Simple Circuits

Introduction to CAD tools

(4)

Ashutosh Trivedi – 4 of 29

Variables and Functions

– Logic circuits form the foundation ofdigital systems – Binary logic circuitsperform operations of binary signals

– Let’s consider the simplest element logic circuit:switch. – A switch can be in two states: “open” and “close”. – Graphical symbol for a switch

– A simple application using a switch : “lightbulb” – State of the switch can be given as abinary variablexs.t.:

x=0 when switch is open, and x=1 when switch is closed. – The function of a switch:

F=0 whenx=0 and F=1 whenx=1. – In other wordsF(x) =x.

– Keywords: Logic expression defining output, logic function, and input variable.

– Let’s use two switches to control the lightbulb by connecting them in series and parallel.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(5)

Variables and Functions

– Logic circuits form the foundation ofdigital systems – Binary logic circuitsperform operations of binary signals – Let’s consider the simplest element logic circuit:switch.

– A switch can be in two states: “open” and “close”.

– Graphical symbol for a switch

– A simple application using a switch : “lightbulb”

– State of the switch can be given as abinary variablexs.t.: x=0 when switch is open, and

x=1 when switch is closed. – The function of a switch:

F=0 whenx=0 and F=1 whenx=1. – In other wordsF(x) =x.

– Keywords: Logic expression defining output, logic function, and input variable.

– Let’s use two switches to control the lightbulb by connecting them in series and parallel.

(6)

Ashutosh Trivedi – 4 of 29

Variables and Functions

– Logic circuits form the foundation ofdigital systems – Binary logic circuitsperform operations of binary signals – Let’s consider the simplest element logic circuit:switch.

– A switch can be in two states: “open” and “close”.

– Graphical symbol for a switch

– A simple application using a switch : “lightbulb”

– State of the switch can be given as abinary variablexs.t.:

x=0 when switch is open, and x=1 when switch is closed.

– The function of a switch:

F=0 whenx=0 and F=1 whenx=1.

– In other wordsF(x) =x.

– Keywords: Logic expression defining output, logic function, and input variable.

– Let’s use two switches to control the lightbulb by connecting them in series and parallel.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(7)

Variables and Functions

– Logic circuits form the foundation ofdigital systems – Binary logic circuitsperform operations of binary signals – Let’s consider the simplest element logic circuit:switch.

– A switch can be in two states: “open” and “close”.

– Graphical symbol for a switch

– A simple application using a switch : “lightbulb”

– State of the switch can be given as abinary variablexs.t.:

x=0 when switch is open, and x=1 when switch is closed.

– The function of a switch:

F=0 whenx=0 and F=1 whenx=1.

– In other wordsF(x) =x.

– Keywords: Logic expression defining output, logic function, and input variable.

– Let’s use two switches to control the lightbulb by connecting them in series and parallel.

(8)

Ashutosh Trivedi – 4 of 29

Variables and Functions

– Logic circuits form the foundation ofdigital systems – Binary logic circuitsperform operations of binary signals – Let’s consider the simplest element logic circuit:switch.

– A switch can be in two states: “open” and “close”.

– Graphical symbol for a switch

– A simple application using a switch : “lightbulb”

– State of the switch can be given as abinary variablexs.t.:

x=0 when switch is open, and x=1 when switch is closed.

– The function of a switch:

F=0 whenx=0 and F=1 whenx=1.

– In other wordsF(x) =x.

– Keywords: Logic expression defining output, logic function, and input variable.

– Let’s use two switches to control the lightbulb by connecting them in series and parallel.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(9)

Introducing AND nd OR

– Logical AND operation (series connection) – We write the expression

L(x,y) =x·y to sayL(x,y) =xANDywhen

L =

(1 ifx=1 andy=1.

0 otherwise.

– Logical OR operation (parallel connection) – We write the expression

L(x,y) =x+y to sayL(x,y) =xORywhen

L =

(0 ifx=0 andy=0. 0 otherwise. – A series-parallel connection

(10)

Ashutosh Trivedi – 5 of 29

Introducing AND nd OR

– Logical AND operation (series connection) – We write the expression

L(x,y) =x·y to sayL(x,y) =xANDywhen

L =

(1 ifx=1 andy=1.

0 otherwise.

– Logical OR operation (parallel connection) – We write the expression

L(x,y) =x+y to sayL(x,y) =xORywhen

L =

(0 ifx=0 andy=0.

0 otherwise.

– A series-parallel connection

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(11)

Introducing AND nd OR

– Logical AND operation (series connection) – We write the expression

L(x,y) =x·y to sayL(x,y) =xANDywhen

L =

(1 ifx=1 andy=1.

0 otherwise.

– Logical OR operation (parallel connection) – We write the expression

L(x,y) =x+y to sayL(x,y) =xORywhen

L =

(0 ifx=0 andy=0.

0 otherwise.

– A series-parallel connection

(12)

Ashutosh Trivedi – 6 of 29

Inversion

– Can we use a switch to implement an “inverted switch”?

– We would like to implement the following function:

L(x) =x

to sayL(x) = NOTxor “complement” ofxwhen

L =

(0 ifx=1.

1 ifx=0

– The inverting circuit

– We can complement not only variables but also expressions, s.t. f(x,y) =x+y.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(13)

Inversion

– Can we use a switch to implement an “inverted switch”?

– We would like to implement the following function:

L(x) =x

to sayL(x) = NOTxor “complement” ofxwhen

L =

(0 ifx=1.

1 ifx=0

– The inverting circuit

– We can complement not only variables but also expressions, s.t. f(x,y) =x+y.

(14)

Ashutosh Trivedi – 6 of 29

Inversion

– Can we use a switch to implement an “inverted switch”?

– We would like to implement the following function:

L(x) =x

to sayL(x) = NOTxor “complement” ofxwhen

L =

(0 ifx=1.

1 ifx=0

– The inverting circuit

– We can complement not only variables but also expressions, s.t.

f(x,y) =x+y.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(15)

Specification of a logical function: Truth tables

– The specification of a logical function can be enumerate as a truth-table

– Since input variables are finite, there are only finitely many possible combinations for a finite set of inputs.

– Example of truth table forx·y,x+yandx.

– Truth-table forn-input AND, OR, or NOT operations

(16)

Ashutosh Trivedi – 8 of 29

Logic Gates

– A “switch” can be implemented using a transistor.

– Also other Boolean operations can be implemented using various combinations of switches.

– AND gate, OR gate, NOT gate represent encapsulation of transistor circuits implementing Boolean function

xy x·y x

y x+y x x

xy

z x·y·z x

yy x+y

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(17)

Logic Gates

– A “switch” can be implemented using a transistor.

– Also other Boolean operations can be implemented using various combinations of switches.

– AND gate, OR gate, NOT gate represent encapsulation of transistor circuits implementing Boolean function

xy x·y x

y x+y x x

xy

z x·y·z x

yy x+y

(18)

Ashutosh Trivedi – 9 of 29

Analysis and Synthesis of a Logic Network

– Tasks of a designer of a digital system: analysis and synthesis

– Let’s analyze the logic networkf(x1,x2,x3) =x1+x2·x3. – Construct its Truth-Table

– Timing diagram of a circuit

– Functionally equivalent circuits: consider the network that implement Boolean functiong(x1,x2) =x1+x2. and compare with the function f(x1,x2).

– How do we know if two functions are logically equivalent?

– How many different logically equivalent functions overn-variables? – How to minimize circuit complexity (and cost)?

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(19)

Analysis and Synthesis of a Logic Network

– Tasks of a designer of a digital system: analysis and synthesis – Let’s analyze the logic networkf(x1,x2,x3) =x1+x2·x3. – Construct its Truth-Table

– Timing diagram of a circuit

– Functionally equivalent circuits: consider the network that implement Boolean functiong(x1,x2) =x1+x2. and compare with the function f(x1,x2).

– How do we know if two functions are logically equivalent?

– How many different logically equivalent functions overn-variables? – How to minimize circuit complexity (and cost)?

(20)

Ashutosh Trivedi – 9 of 29

Analysis and Synthesis of a Logic Network

– Tasks of a designer of a digital system: analysis and synthesis – Let’s analyze the logic networkf(x1,x2,x3) =x1+x2·x3. – Construct its Truth-Table

– Timing diagram of a circuit

– Functionally equivalent circuits: consider the network that implement Boolean functiong(x1,x2) =x1+x2. and compare with the function f(x1,x2).

– How do we know if two functions are logically equivalent?

– How many different logically equivalent functions overn-variables? – How to minimize circuit complexity (and cost)?

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(21)

Analysis and Synthesis of a Logic Network

– Tasks of a designer of a digital system: analysis and synthesis – Let’s analyze the logic networkf(x1,x2,x3) =x1+x2·x3. – Construct its Truth-Table

– Timing diagram of a circuit

– Functionally equivalent circuits: consider the network that implement Boolean functiong(x1,x2) =x1+x2. and compare with the function f(x1,x2).

– How do we know if two functions are logically equivalent?

– How many different logically equivalent functions overn-variables? – How to minimize circuit complexity (and cost)?

(22)

Ashutosh Trivedi – 9 of 29

Analysis and Synthesis of a Logic Network

– Tasks of a designer of a digital system: analysis and synthesis – Let’s analyze the logic networkf(x1,x2,x3) =x1+x2·x3. – Construct its Truth-Table

– Timing diagram of a circuit

– Functionally equivalent circuits: consider the network that implement Boolean functiong(x1,x2) =x1+x2. and compare with the function f(x1,x2).

– How do we know if two functions are logically equivalent?

– How many different logically equivalent functions overn-variables?

– How to minimize circuit complexity (and cost)?

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(23)

Analysis and Synthesis of a Logic Network

– Tasks of a designer of a digital system: analysis and synthesis – Let’s analyze the logic networkf(x1,x2,x3) =x1+x2·x3. – Construct its Truth-Table

– Timing diagram of a circuit

– Functionally equivalent circuits: consider the network that implement Boolean functiong(x1,x2) =x1+x2. and compare with the function f(x1,x2).

– How do we know if two functions are logically equivalent?

– How many different logically equivalent functions overn-variables?

– How to minimize circuit complexity (and cost)?

(24)

Ashutosh Trivedi – 10 of 29

Objectives

Logic functions and circuits

Boolean Algebra

Synthesis of Simple Circuits

Introduction to CAD tools

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(25)

Boolean Algebra

– In 1849 George Boole introduced algebra for manipulating processes involvinglogical thoughts and reasoning

– This scheme, with some refinements, is not know asBoolean algebra.

– Claude Shannon in 1930 showed that Boolean algebra is awesome for describing circuits with switches!

– It is, then, of course awesome to describe logical circuits.

(26)

Ashutosh Trivedi – 12 of 29

Boolean Algebra: Axioms

1.

0·0 = 0 (1)

1+1 = 1 (2)

2.

1·1 = 1 (3)

0+0 = 0 (4)

3.

0·1 = 1·0=0 (5)

0+1 = 1+0=1 (6)

4.

Ifx=0 then x=1 (7)

Ifx=1 then x=0 (8)

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(27)

Boolean Algebra: Single variable Theorems

1.

x·0 = 0 (9)

x+1 = 1 (10)

2.

x·1 = x (11)

x+0 = x (12)

3.

x·x = x (13)

x+x = x (14)

4.

x·x = 0 (15)

x+·x = 1 (16)

5.

(28)

Ashutosh Trivedi – 14 of 29

Boolean Algebra: 2- and 3- Variable Properties

1. Commutativity:

x·y = y·x (18)

x+y = y+x (19)

2. Associativity:

x·(y·z) = (x·y)·z (20) x+ (y+z) = (x+y) +z (21) 3. Distributivity:

x·(y·z) = (x·y)·z (22) x+ (y+z) = (x+y) +z (23) 4. Absorption:

x+x·y = x (24)

x·(x+y) = x (25)

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(29)

Boolean Algebra: 2- and 3- Variable Properties

1. Combining:

x·y+x·y = x (26)

(x+y)·(x+y) = x (27) 2. Consensus:

x·y+y·z+x·z = x·y+x·z (28) (x+y)·(y+z)·(x+z) = (x+y)·(x+z) (29)

(30)

Ashutosh Trivedi – 16 of 29

Boolean Algebra: DeMorgan’s theorem

Augustus De Morgan (27 June 1806 — 18 March 1871)

x·y = x+y (30)

x+y = x·y (31)

Proof byPerfect Induction(Truth-tables)

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(31)

Boolean Algebra: DeMorgan’s theorem

Augustus De Morgan (27 June 1806 — 18 March 1871)

x·y = x+y (30)

x+y = x·y (31)

Proof byPerfect Induction(Truth-tables)

(32)

Ashutosh Trivedi – 17 of 29

Other Remarks

– Venn diagram are quite useful proving theorems in Boolean algebra

– Common symbols to represent OR:x∨yandx+y – Common symbols to represent AND:x∧yandx·y – Common symbols to represent NOT:¬xandx – Precedence of Operations:

NOT>AND>OR

Example

– x1·x2+x1·x2

– (x1·x2) + ((x1)·(x2)) – x1·(x2+x1)·x2

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(33)

Other Remarks

– Venn diagram are quite useful proving theorems in Boolean algebra – Common symbols to represent OR:x∨yandx+y

– Common symbols to represent AND:x∧yandx·y – Common symbols to represent NOT:¬xandx

– Precedence of Operations:

NOT>AND>OR

Example

– x1·x2+x1·x2

– (x1·x2) + ((x1)·(x2)) – x1·(x2+x1)·x2

(34)

Ashutosh Trivedi – 17 of 29

Other Remarks

– Venn diagram are quite useful proving theorems in Boolean algebra – Common symbols to represent OR:x∨yandx+y

– Common symbols to represent AND:x∧yandx·y – Common symbols to represent NOT:¬xandx – Precedence of Operations:

NOT>AND>OR

Example

– x1·x2+x1·x2

– (x1·x2) + ((x1)·(x2)) – x1·(x2+x1)·x2

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(35)

Objectives

Logic functions and circuits

Boolean Algebra

Synthesis of Simple Circuits

Introduction to CAD tools

(36)

Ashutosh Trivedi – 19 of 29

Synthesis of simple circuits

Definition (Synthesis)

Given a description of the desiredfunctional behavior, the synthesis is the process to generate a circuit that realizes this behavior.

Commonly Used logic Gates:

xy x·y x

y x+y x x

xy x·y x

y x+y x

y x⊕y

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(37)

Synthesis of simple circuits

Theorem

Any Boolean function can be synthesized using only AND, OR, and NOT gates.

xy x·y x

y x+y x x

Theorem

Any Boolean function can be synthesized using only NAND gates.

xy x·y

Theorem

Any Boolean function can be synthesized using only NOR gates.

xy x+y

(38)

Ashutosh Trivedi – 20 of 29

Synthesis of simple circuits

Theorem

Any Boolean function can be synthesized using only AND, OR, and NOT gates.

xy x·y x

y x+y x x

Theorem

Any Boolean function can be synthesized using only NAND gates.

xy x·y

Theorem

Any Boolean function can be synthesized using only NOR gates.

xy x+y

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(39)

Synthesis of simple circuits

Theorem

Any Boolean function can be synthesized using only AND, OR, and NOT gates.

xy x·y x

y x+y x x

Theorem

Any Boolean function can be synthesized using only NAND gates.

xy x·y

Theorem

Any Boolean function can be synthesized using only NOR gates.

xy x+y

(40)

Ashutosh Trivedi – 21 of 29

Synthesis using AND, OR, and NOT gates

Given a Boolean functionf given in the form of a truth table, the expression that realizesf can be obtained:

– (SUM-OF-PRODUCTS) by considering rows for whichf =1, or – (PRODUCTS-OF-SUMS) by considering rows for whichf =0.

Example:

x1 x2 f(x1,x2)

0 0 0

0 1 1

1 0 0

1 1 1

f(x1,x2) = x1x2+x1x2=m1+m3

f(x1,x2) = (x1x2+x1x2) = (x1x2)·(x1x2) = (x1+x2)·(x1+x2) =M0·M2

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(41)

Synthesis using AND, OR, and NOT gates

Given a Boolean functionf given in the form of a truth table, the expression that realizesf can be obtained:

– (SUM-OF-PRODUCTS) by considering rows for whichf =1, or – (PRODUCTS-OF-SUMS) by considering rows for whichf =0.

Example:

x1 x2 f(x1,x2)

0 0 0

0 1 1

1 0 0

1 1 1

f(x1,x2) = x1x2+x1x2=m1+m3

f(x1,x2) = (x1x2+x1x2) = (x1x2)·(x1x2) = (x1+x2)·(x1+x2) =M0·M2

(42)

Ashutosh Trivedi – 22 of 29

Sum-of-Product Canonical Form

– For a function ofnvariables amintermis a product term in which each of the variable occur exactly once. For example:x0·x1·x2and x0·x1·x2.

– A functionf can be represented by an expression that is sum of minterms.

– A logical expression that consists of product terms that are summed (ORed) together is called asum-of-productform.

– If each of the product term is a minterm, then the expression is called canonical sum-of-productexpression.

– Notice that two logically equivalent functions will have the same canonical representation.

– For a truth-table ofnvariables, we represent the minterm corresponding to thei-th row asmiwherei∈ {0,2n−1}.

– A unique representation of a function can be given as an explicit sum of minterms for rows for which function istrue.

– For example

f(x1,x2) =x1x2+x1x2=m1+m3=P

(m1,m3) =P

m(1,3).

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(43)

Sum-of-Product Canonical Form

– For a function ofnvariables amaxtermis a sum term in which each of the variable occur exactly once. For example

(x0+x1+x2)and(x0+x1+x2).

– A functionf can be represented by an expression that is product of maxterms.

– A logical expression that consists of sum terms that are factors of logical product (AND) is called aproduct-of-sumform.

– If each of the sum term is a maxterm, then the expression is called canonical product-of-sumexpression.

– Notice that two logically equivalent functions will have the same canonical product-of-sum representation.

– For a truth-table ofnvariables, we represent the maxterm

corresponding to complement of the minterm of thei-th row asMi

wherei∈ {0,2n−1}.

– A unique representation of a function can be given as an explicit product of maxterms for rows for which function isfalse.

(44)

Ashutosh Trivedi – 24 of 29

Questions

– Give SOP form of the functionf(x1,x2,x3) =P

m(2,3,4,6,7)and simplify it.

– Give POS for of the functionf(x1,x2,x3) =Q

M(0,1,5)and simplify it.

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(45)

NAND and NOR logic networks

– De Morgan’s theorem in terms of logic gates

– Using NAND gates to implement a sum-of-products – Using NOR gates to implement a product-of-sums

(46)

Ashutosh Trivedi – 26 of 29

Examples

Design the logic circuits for the following problems:

– Three-way light control – Multiplexer circuit

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(47)

Objectives

Logic functions and circuits

Boolean Algebra

Synthesis of Simple Circuits

Introduction to CAD tools

(48)

Ashutosh Trivedi – 28 of 29

Steps in Design process

1. Design Entry

– Schematic capture

– Hardware description language 2. Synthesis (or translating/ compiling) 3. Functional Simulation

4. Physical Design 5. Timing Simulation

6. Chip configuration (programming)

Ashutosh Trivedi Lecture 4: Introduction to Logic Circuits

(49)

Introduction to VHDL

References

Related documents

Unit I Basics: MATLAB environment, Variables, Basic data types, Relational and Logic operators, Conditional statements, Input and Output, Loops and branching.. Unit II

• The second function is to automate the manufacturing process by integrating advanced regulatory control, logic and sequential control, and procedural languages into a

➢ In digital circuit theory, combinational logic is a type of digital logic circuit where the output is a pure function of the present input only. ➢ This is in contrast to

- Function of the Digital Logic Circuits can be represented by Logic Operations, i.e., Boolean Function(s). - From a Boolean function, a logic diagram can be constructed

 In digital circuit theory, combinational logic is a type of digital logic circuit where the output is a pure function of the present input only.  This is in contrast to

– 74AUC (Advanced Ultra-Low-Voltage CMOS) series is optimized to operate at 1.8-V logic levels. – 74AUP (Advanced Ultra-low Power) is the very low power logic series—used

The schematic of 16-bit Ripple counter connected with modified logic, for example, Control Combinational Logic (CCL), Voltage Selector (VS) and Modified Clock Gating (MICG) to

The comparator circuit used after filter circuit gave either high or low output, which facilitated to use the Boolean logic (dictated in Formulation Section)