SlideShare a Scribd company logo
1 of 8
Download to read offline
BSCS fall-2017
Assignment Submitted To:
Mam Amna Dilawar
Assignment Submitted By:
Shefa Idrees # 101631049
Assignment Submitted By:
NAND, NOR implementation & Scenario Study
Department of Computer Science
Post Graduate College for Women
Samanabad, Lahore.
Universal logic gates
‘Universal logic gates’ are NAND gate and NOR gates. The reason behind this is,
NAND gate and NOR gate can perform (or can function like) all the 3 basic gates,
such as AND gate, OR gate and NOT gate. We can design any basic logic gate by
using NAND gate or NOR gate. This is why they are called as “Universal gates”.
NAND Gate or AND Invert:
In digital electronics, a NAND gate (negative-AND) is a logic gate which produces
an output which is false only if all its inputs are true; thus its output is complement to
that of the AND gate.
The sum of product or SOP form is represented by using basic logic gates like NAND
gate and NOR gate. The SOP form implementation will have the AND/NAND gate at
its input side and as the output of the function is the sum of all product terms, it has an
OR/NOR gate at its output side.
Any logic function can be implemented using NAND gates. To achieve this first logic
function has to be written in Sum Of Product (SOP) form.Once logic function is
converted to SOP, then it is very easy to implement using NAND gate. And it is easy
to derive SOP when diagram is there. For instance:
Implementation of Boolean functions using NAND gates
The important thing to remember about NAND gate is this is the inverse of basic
AND gate. This means the output of the NAND gate is equal to the complement of
the output of the AND gate.
Let’s see an example to understand the implementation.
Implement the Boolean function by using a NAND logic gate.
F (A, B, C, D, E) = A + (B’ + C) (D’ + BE’)
NOR Gate or Invert-AND:
NOR is the result of the negation of the OR operator. A HIGH output (1) results if
both the inputs to the gate are LOW (0); if one or both input is HIGH (1), a LOW
output (0) results.
AND-Invert Invert-OR
The product of sums or POS form can be represented by using basic logic gates like
NAND/AND gate and NOR/OR gates. The POS form implementation will have the
NOR/OR gate at its input side and as the output of the function is product of all sum
terms, it has NAND/AND gate at its output side. In POS form implementation, we use
NOT gate to represent the inverse or complement of the variables.
Any logic function can be implemented using NOR gates. To achieve this, first the
logic function has to be written in Product of Sum (POS) form. Once it is converted to
POS, then it's very easy to implement using NOR gate. And it is easy to derive SOP
when diagram is there. For instance:
Implementation of Boolean functions using NOR gates
NOR gate is the combination of OR gate and NOT gate and this can function like
AND gate, OR gate and NOT gate. So we use NOR gate to implement the Boolean
functions. The important thing to remember about NOR gate is this is the inverse of
basic OR gate. This means the output of the NOR gate is equal to the output of the
OR gate.
Let’s see an example to understand the implementation.
Implement the Boolean function by using NOR logic gate.
g (A, B, C, D, E, F) = (A E) + (B D E) + (B C E F)
We can solve the given equation as
g (A, B, C, D, E, F) = AE + BDE + BCEF
= (A + BD + BCF) E
= (A + B (D + CF)) E
In NOR gate implementation, we use NOR gates at both input and output side.
Observe the designed logic diagram below.
Scenario:
Three friends are trying to decide what to do Saturday night (combine study or
combine assignment). They settle the issue by a vote (everyone gets a single vote, the
ACTIVIY with the most votes wins.)Assume you want a computer to automatically
compile the votes and declare the winning activity.
Input logic variables:
V1 = Vote of person 1 (T=Combine assignment, F=Combine study)
V2 = Vote of person 2 (T=Combine assignment, F=Combine study)
V3 = Vote of person 3 (T=Combine assignment, F=Combine study)
Output logical variables:
ACTIVIY = Choice of ACTIVIY (T=Combine assignment, F=Combine study)
Logical expression:
ACTIVIY = (V1 AND V2) OR (V1 AND V3) OR (V2 AND V3)
To check if the logical expression is correct computer must be ready for any input,
and must compute correct results in all cases.
Must go through all possible input combinations:
Its truth table is given below:
INPUTS:
V1 V2 V3
OUPUTS:
ACTIVIY
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
Diagram for example:
Reference
http://www.electronicshub.org/implementation-of-boolean-functions-usin
g-logic-gates/
http://homepages.cae.wisc.edu/~ece352/fall01_kime/lectures/Lecture_2-7
_f01.pdf
http://www.asic-world.com/digital/gates3.html
https://en.wikipedia.org/wiki/NOR_gate
https://en.wikipedia.org/wiki/NAND_gate

More Related Content

What's hot

Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
Shashwat Shriparv
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Abhiraj Bohra
 

What's hot (20)

Logic Gates
Logic GatesLogic Gates
Logic Gates
 
Logic gates and NAND and NOR univarsal gates
Logic gates and NAND and NOR univarsal gatesLogic gates and NAND and NOR univarsal gates
Logic gates and NAND and NOR univarsal gates
 
Modeling Style and Delay Model of VHDL By Ap
Modeling Style and Delay Model of VHDL By ApModeling Style and Delay Model of VHDL By Ap
Modeling Style and Delay Model of VHDL By Ap
 
Introduction to Boolean Algebra
Introduction to Boolean AlgebraIntroduction to Boolean Algebra
Introduction to Boolean Algebra
 
Computer circuit logic
Computer circuit logicComputer circuit logic
Computer circuit logic
 
Edc
EdcEdc
Edc
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
Basic Logic gates
Basic Logic gatesBasic Logic gates
Basic Logic gates
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
C formatted and unformatted input and output constructs
C  formatted and unformatted input and output constructsC  formatted and unformatted input and output constructs
C formatted and unformatted input and output constructs
 
Digital Circuit Verification Hardware Descriptive Language Verilog
Digital Circuit Verification Hardware Descriptive Language VerilogDigital Circuit Verification Hardware Descriptive Language Verilog
Digital Circuit Verification Hardware Descriptive Language Verilog
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Logic gates 07 11-2014
Logic gates 07 11-2014Logic gates 07 11-2014
Logic gates 07 11-2014
 
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational CircuitsCOMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
 
Octal encoding
Octal encodingOctal encoding
Octal encoding
 
Technical aptitude Test 1 CSE
Technical aptitude Test 1 CSETechnical aptitude Test 1 CSE
Technical aptitude Test 1 CSE
 
Logic gates
Logic gatesLogic gates
Logic gates
 
investagatory PHYSICS-LOGIC GATES
investagatory PHYSICS-LOGIC GATESinvestagatory PHYSICS-LOGIC GATES
investagatory PHYSICS-LOGIC GATES
 
Lec 2 digital basics
Lec 2 digital basicsLec 2 digital basics
Lec 2 digital basics
 

Similar to Digital Logic & Design

Similar to Digital Logic & Design (20)

ECAD lab manual
ECAD lab manualECAD lab manual
ECAD lab manual
 
e CAD lab manual
e CAD lab manuale CAD lab manual
e CAD lab manual
 
Chap 3
Chap 3Chap 3
Chap 3
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
 
Deld lab manual
Deld lab manualDeld lab manual
Deld lab manual
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
Basic Logic Gates
Basic Logic GatesBasic Logic Gates
Basic Logic Gates
 
Physics investigatory project { LOGIC GATES} CLASS XII
Physics investigatory project  { LOGIC GATES} CLASS XIIPhysics investigatory project  { LOGIC GATES} CLASS XII
Physics investigatory project { LOGIC GATES} CLASS XII
 
Assignment#1a
Assignment#1aAssignment#1a
Assignment#1a
 
M. FLORENCE DAYANA/unit - II logic gates and circuits.pdf
M. FLORENCE DAYANA/unit - II logic gates and circuits.pdfM. FLORENCE DAYANA/unit - II logic gates and circuits.pdf
M. FLORENCE DAYANA/unit - II logic gates and circuits.pdf
 
Combinational logic circuits
Combinational logic circuitsCombinational logic circuits
Combinational logic circuits
 
Logic circuits and design PART 3.pptx
Logic circuits and  design PART 3.pptxLogic circuits and  design PART 3.pptx
Logic circuits and design PART 3.pptx
 
Basic Logic Gates with Truth Tables.pdf
Basic Logic Gates with Truth Tables.pdfBasic Logic Gates with Truth Tables.pdf
Basic Logic Gates with Truth Tables.pdf
 
NAND AND NOR IMPLEMENTATION.pptx
NAND AND NOR IMPLEMENTATION.pptxNAND AND NOR IMPLEMENTATION.pptx
NAND AND NOR IMPLEMENTATION.pptx
 
NAND and NOR implementation and Other two level implementation
NAND and NOR implementation and  Other two level implementationNAND and NOR implementation and  Other two level implementation
NAND and NOR implementation and Other two level implementation
 
chapter 3 Boolean algebra (2).pptx
chapter 3 Boolean algebra (2).pptxchapter 3 Boolean algebra (2).pptx
chapter 3 Boolean algebra (2).pptx
 
Combinational logic circuits design and implementation
Combinational logic circuits design and implementationCombinational logic circuits design and implementation
Combinational logic circuits design and implementation
 
Unit 07
Unit 07Unit 07
Unit 07
 
logic gates
logic gateslogic gates
logic gates
 

More from Shefa Idrees

Pakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and PrinciplesPakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and Principles
Shefa Idrees
 

More from Shefa Idrees (20)

Tele Communications - IEEE 802.11
Tele Communications - IEEE 802.11Tele Communications - IEEE 802.11
Tele Communications - IEEE 802.11
 
Data Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Data Communication IPv6, Ethernet, OSI Model, Transmission ImpairmentsData Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Data Communication IPv6, Ethernet, OSI Model, Transmission Impairments
 
Interrupts in CPU
Interrupts in CPUInterrupts in CPU
Interrupts in CPU
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 
Query trees
Query treesQuery trees
Query trees
 
Description of everything necessary for startup
Description of everything necessary for startupDescription of everything necessary for startup
Description of everything necessary for startup
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation Skills
 
File Handling in Assembly Prezi slides
File Handling in Assembly Prezi slidesFile Handling in Assembly Prezi slides
File Handling in Assembly Prezi slides
 
Paragraph Types and Ways to Write Them
Paragraph Types and Ways to Write ThemParagraph Types and Ways to Write Them
Paragraph Types and Ways to Write Them
 
Memo Writing
Memo WritingMemo Writing
Memo Writing
 
Cover letters
Cover lettersCover letters
Cover letters
 
Pakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and PrinciplesPakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and Principles
 
The constitution of pakistan
The constitution of pakistanThe constitution of pakistan
The constitution of pakistan
 
Report & its types
Report & its typesReport & its types
Report & its types
 
Project proposal
Project proposalProject proposal
Project proposal
 
Model abstract
Model abstractModel abstract
Model abstract
 
Importance & Significance of Islamic Civilization
Importance & Significance of Islamic CivilizationImportance & Significance of Islamic Civilization
Importance & Significance of Islamic Civilization
 
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
 
The Complete Diode Model
The Complete Diode ModelThe Complete Diode Model
The Complete Diode Model
 
Computer Network & Types
Computer Network & TypesComputer Network & Types
Computer Network & Types
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Recently uploaded (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 

Digital Logic & Design

  • 1. BSCS fall-2017 Assignment Submitted To: Mam Amna Dilawar Assignment Submitted By: Shefa Idrees # 101631049 Assignment Submitted By: NAND, NOR implementation & Scenario Study Department of Computer Science Post Graduate College for Women Samanabad, Lahore.
  • 2. Universal logic gates ‘Universal logic gates’ are NAND gate and NOR gates. The reason behind this is, NAND gate and NOR gate can perform (or can function like) all the 3 basic gates, such as AND gate, OR gate and NOT gate. We can design any basic logic gate by using NAND gate or NOR gate. This is why they are called as “Universal gates”. NAND Gate or AND Invert: In digital electronics, a NAND gate (negative-AND) is a logic gate which produces an output which is false only if all its inputs are true; thus its output is complement to that of the AND gate. The sum of product or SOP form is represented by using basic logic gates like NAND gate and NOR gate. The SOP form implementation will have the AND/NAND gate at its input side and as the output of the function is the sum of all product terms, it has an OR/NOR gate at its output side. Any logic function can be implemented using NAND gates. To achieve this first logic function has to be written in Sum Of Product (SOP) form.Once logic function is converted to SOP, then it is very easy to implement using NAND gate. And it is easy to derive SOP when diagram is there. For instance:
  • 3. Implementation of Boolean functions using NAND gates The important thing to remember about NAND gate is this is the inverse of basic AND gate. This means the output of the NAND gate is equal to the complement of the output of the AND gate. Let’s see an example to understand the implementation. Implement the Boolean function by using a NAND logic gate. F (A, B, C, D, E) = A + (B’ + C) (D’ + BE’) NOR Gate or Invert-AND: NOR is the result of the negation of the OR operator. A HIGH output (1) results if both the inputs to the gate are LOW (0); if one or both input is HIGH (1), a LOW output (0) results. AND-Invert Invert-OR
  • 4. The product of sums or POS form can be represented by using basic logic gates like NAND/AND gate and NOR/OR gates. The POS form implementation will have the NOR/OR gate at its input side and as the output of the function is product of all sum terms, it has NAND/AND gate at its output side. In POS form implementation, we use NOT gate to represent the inverse or complement of the variables. Any logic function can be implemented using NOR gates. To achieve this, first the logic function has to be written in Product of Sum (POS) form. Once it is converted to POS, then it's very easy to implement using NOR gate. And it is easy to derive SOP when diagram is there. For instance: Implementation of Boolean functions using NOR gates NOR gate is the combination of OR gate and NOT gate and this can function like AND gate, OR gate and NOT gate. So we use NOR gate to implement the Boolean functions. The important thing to remember about NOR gate is this is the inverse of basic OR gate. This means the output of the NOR gate is equal to the output of the OR gate. Let’s see an example to understand the implementation.
  • 5. Implement the Boolean function by using NOR logic gate. g (A, B, C, D, E, F) = (A E) + (B D E) + (B C E F) We can solve the given equation as g (A, B, C, D, E, F) = AE + BDE + BCEF = (A + BD + BCF) E = (A + B (D + CF)) E In NOR gate implementation, we use NOR gates at both input and output side. Observe the designed logic diagram below. Scenario: Three friends are trying to decide what to do Saturday night (combine study or combine assignment). They settle the issue by a vote (everyone gets a single vote, the ACTIVIY with the most votes wins.)Assume you want a computer to automatically compile the votes and declare the winning activity. Input logic variables: V1 = Vote of person 1 (T=Combine assignment, F=Combine study) V2 = Vote of person 2 (T=Combine assignment, F=Combine study)
  • 6. V3 = Vote of person 3 (T=Combine assignment, F=Combine study) Output logical variables: ACTIVIY = Choice of ACTIVIY (T=Combine assignment, F=Combine study) Logical expression: ACTIVIY = (V1 AND V2) OR (V1 AND V3) OR (V2 AND V3) To check if the logical expression is correct computer must be ready for any input, and must compute correct results in all cases. Must go through all possible input combinations: Its truth table is given below:
  • 7. INPUTS: V1 V2 V3 OUPUTS: ACTIVIY 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 Diagram for example: