# title=Fundamental Hardware Elements of Computers: Building circuits

 ← Boolean gate combinations Building circuits Boolean algebra →

A common question in the exam is to be given some boolean algebra and be asked to express it as logic gates. Let's take a look at an addition and subtraction example that you should be familiar with:

${\displaystyle 9-(7+1)}$


First we are going to deal with the inner-most brackets

${\displaystyle (7+1)=8}$


Finally we combine this answer with the ${\displaystyle 9-}$

${\displaystyle =9-(8)=1}$


It will work exactly in the same way for boolean algebra, but instead of using numbers to store our results, we'll use logic gates:

 Example: Building circuits ${\displaystyle C.(A+B)}$  As with any equation, we are going to deal with the inner-most brackets first${\displaystyle (A+B)}$, then combine this answer with the ${\displaystyle C.}$
 Exercise: Building circuits Draw the circuit diagrams for the following. (Remember: do we deal with AND or OR first?): ${\displaystyle A.B+C}$ Answer: ${\displaystyle ({\overline {A}}+{\overline {B}}).C}$ Answer: ${\displaystyle {\overline {(A+B)}}.C}$ Answer: ${\displaystyle (A.{\overline {B}})\oplus (B.C)}$ Answer: ${\displaystyle {\overline {(A.B).(C+{\overline {D}})}}}$ Answer:

A common question in the exam is to give you a description of a system. You'll then be asked to create a boolean statement from this description, and finally build a logic gate circuit to show this system:

Example: Building circuits

Using boolean algebra describe the following scenario:

 “ A car alarm is set off if a window is broken or if it senses something moving inside car, and the car is not being towed, or the engine is not on. ”

Where:

• A = being towed,
• B = window broken,
• C = engine on,
• D = senses movement

Before you rush into answering a question like this, let's try and break it down into its components. The questioner will often be trying to trick you. The two occasions that the alarm will sound are: ${\displaystyle B+D}$ but there is a caveat, the alarm will sound if either of these are true AND two things are also true, namely the engine is NOT on, and the car is NOT being towed: ${\displaystyle {\overline {A}}+{\overline {C}}}$

Combining both we get (remember the brackets!): ${\displaystyle (B+D).({\overline {A}}+{\overline {C}})}$

The next step is to create a diagram out of this:

 Exercise: Building circuits A security system allows people of two different clearance levels access to a building. Either they have low privileges and they have a card and they are not carrying a mobile. Alternatively they have a key and are allowed to carry a mobile. The inputs available are: A = carrying a card B = carrying a mobile phone C = carrying a key Write down the boolean equation to express this: Answer: ${\displaystyle (A.{\overline {B}})+(C)}$ If you wrote: ${\displaystyle (A.{\overline {B}})+(C.B)}$ You'd be wrong! The reason being the text says: Alternatively they have a key and are allowed to carry a mobile. This doesn't mean ${\displaystyle C.B}$, it means they can carry a mobile, or they can choose not to: ${\displaystyle C.(B+{\overline {B}})}$, which simplifies to: ${\displaystyle C.(B+{\overline {B}})=C.(1)=C}$. Draw the logic gate diagram to solve this: Answer: