Presentation is loading. Please wait.

Presentation is loading. Please wait.

D75P 34R - HNC Computer Architecture Week 8 More Boolean Logic © C Nyssen/Aberdeen College 2004 All images © Focus Clipart, used with permission except.

Similar presentations


Presentation on theme: "D75P 34R - HNC Computer Architecture Week 8 More Boolean Logic © C Nyssen/Aberdeen College 2004 All images © Focus Clipart, used with permission except."— Presentation transcript:

1 D75P 34R - HNC Computer Architecture Week 8 More Boolean Logic © C Nyssen/Aberdeen College 2004 All images © Focus Clipart, used with permission except Racecar, burglar, wedding © Microsoft Prepared 24/11/04

2 We looked already at Boolean Logic, which is of great importance to how computers manipulate data. Boolean logic is essentially very simple. You may have already used Boolean Search Expressions when using Internet Search Engines. When used in constructing a search expression, it can be very useful in specifying exactly what information you want.

3 When using AND in this search expression, results retrieved will contain both dog and cat information. The results will not include those documents containing only dog or cat information. In the diagram the documents retrieved by using this search expression are contained within the green area. Boolean 'AND' This is expressed as ‘dogs AND cats' in a search.

4 A scientist wishes to test the old adage “fighting like cat and dog”. To do this, he needs to find some people to interview who keep both cats and dogs. People who don’t have a pet at all, or have only a cat or only a dog, are useless for the purposes of his experiments.

5 We can show the logic in a diagram like this… Cat owner? Dog owner? Possible experimental subject? Cat? Dog?Suitable subject? 000 010 100 111 Remember the Truth Table for an AND gate works like this…

6 Such a search will not merely retrieve documents containing only dog information or only cat information. In the diagram the documents retrieved by using this search expression are contained within all the coloured areas. Boolean ‘OR' This is expressed as ‘dogs OR cats' in a search. All the results retrieved will contain either dog information, or cat information, or dog-and-cat information together.

7 An insurance company have introduced a new policy for Pet Owners. They have purchased a mailing list with information about peoples households; now they want to send a mail shot to potential customers. The insurance company needs to target those people who have a cat, or a dog, or both, but there is no point sending a mailshot to people who don’t keep a pet at all.

8 We can show the logic in a diagram like this… Cat owner? Dog owner? Try and sell a policy? Cat? Dog?Hard Sell? 000 011 101 111 Remember the Truth Table for an OR gate works like this…

9 When using NOT in this search expression, results will contain only dogs. The NOT operator will exclude cats completely and thus any dog-and-cat information will be excluded also. In this diagram the dog related information is contained within the blue area. Boolean ‘NOT’ This is expressed as ‘dogs NOT cats' in a search.

10 Pat is a Postman delivering mail to peoples houses......but unfortunately he just does not get along with dogs! So he only visits homes that have no dogs in residence…

11 We can show the logic in a diagram like this… Dog in residence?Deliver mail? Dog present? Deliver mail? 01 10 Remember the Truth Table for a NOT gate works like this…

12 Boolean ‘XOR’ This is expressed as ‘dogs XOR cats' in a search. It must include one, or the other, but not both, and not none!

13 A Vet’s surgery have to send out annual reminders for all cats and dogs to come in for their booster shots. They need to go through all their patient’s files and send out letters to all the dog owners and all the cat owners… …but not the owners of canaries, goldfish or hamsters…. … and owners with dogs AND cats would already have been counted!

14 We can show the logic in a diagram like this… Cat owner? Send reminder? Remember the Truth Table for an XOR gate works like this… Dog owner? 011 101 110 000 Reminder? Dog? Cat?

15 Try to draw the Logic Circuit for the following scenario. To ride the go-karts at the fairground, you have to be 16 or over, OR be 12 or over AND accompanied by a responsible adult. 12-15? Adult present? => 16? Allowed on the go- karts?

16 12-15? Adult present? => 16? Allowed on the go- karts? Complete the Truth Table.

17 A burglar alarm will go off if it has been set, AND the door is opened without the correct code number, OR someone breaks the infra-red beam by climbing in the window. Break beam? Open door without code? Alarm set? Alarm goes off?

18 Break beam? Open door without code? Alarm set? Alarm goes off? Complete the Truth Table.

19 To be legally married in Scotland, both parties must be 16 or over, not already married, and of different sexes. Person #2 married? Person #1 married? Person #2 => 16? Person #1 => 16? Person #1 is a man? Person #2 is a man? Marriage is legal?

20 There are many different ways to depict the circuit for this scenario. This is just one of them! Person 1 man? Person 2 man? Person 1 =>16? Person 2 =>16? Person 1 married? Person 2 Married? Outcome? 101110 101000 111100 011100 101010 Complete the Truth Table.

21 Your exam question will typically consist of a pair of binary numbers, and you will be asked to perform logical operations with them. 1010 0000 1111 0101 1111 1111 0000 0000 AND OR XOR NAND NOR XNOR 1111 1111 1111 0101 0101 1111 1111 0101 0101 1111 1111 1111 0000 0000 0000 1010 1010 0000 0000 1010 1010 0000 0000 0000

22 Another one? 1100 0011 0101 1101 1001 1001 0000 0010 AND OR XOR NAND NOR XNOR 1101 1011 0101 1111 0101 1010 0101 1111 0111 1110 1111 1111 0010 0100 1010 0000 1010 0101 1010 0000 1000 0001 0000 0000

23 Summary  NOT (inverter) reverses any input.  AND requires ALL inputs to be TRUE for a TRUE output.  OR requires only ONE input to be TRUE for a TRUE output.  XOR requires differences in the inputs for a TRUE output.  NAND is equivalent to an AND immediately followed by a NOT.  NOR is equivalent to an OR immediately followed by a NOT.  XNOR is equivalent to an XOR immediately followed by a NOT.


Download ppt "D75P 34R - HNC Computer Architecture Week 8 More Boolean Logic © C Nyssen/Aberdeen College 2004 All images © Focus Clipart, used with permission except."

Similar presentations


Ads by Google