# Basic Logic Circuits#

## Learning Goals#

be comfortable in creating new projects in Vivado

be able to derive logic functions from truth tables

be able to define sum of products (SOP) and product of sums (POS) logic functions in Verilog

be able to translate a worded problem description into Verilog

## Background#

### Overview of the Design Process#

Source: Overview of the Design Process

#### A High Level View of the Design Process#

You are asked to engineer an entertainment system for a student room that should have the following functions:

if the emergency button is pressed:

the motor should unroll the window curtain

the spotlight targeting the disco ball is activated

if humidity is too high:

the window opening motor is activated

if the back-to-normal button is pressed:

…

How is the compilation of the above functions called? In other words: imagine you got the instructions above in a document. How is this document called?

Solution to Exercise 36

Compiling together the required functions of system in a functional requirements document is a typical component of a system design process.

A functional requirement defines a behavior between the inputs and outputs of a system; it usually describes what the system should *do*. This is in contrast to non-functional requirements which usually define how a system should *be*.

For example:

a car airbag (

do) shall create a soft surface in case of an accident.

This is a functional specification.

The airbag’s reaction time shall

beone millisecond.

This in turn is non-functional.

Name three methods for describing the requirements or design of a digital system?

Solution to Exercise 37

Block diagram for an overview

Schematic, focuses in details in contrast to a block diagram.

Boolean function \(f:\{0,1\}^{k}\to \{0,1\}\) represented by:

using an HDL

We can describe a digital circuit using various methods. How many of these are behavioral descriptions?

Block diagram

Schematic

Boolean function

Truth table

A) 0 B) 1 C) 2 D) 3 E) I don’t know

Solution to Exercise 38

Depends.

In the HDL world structural and behavioral descriptions are two main abstractions of a digital system. We can understand *behavioral* better by differentiating it from *structural*.

(My opinion) There is no strict definition for the term structural. A structural description builds a structure by connecting substructures together. In a digital design the structures are mainly basic building blocks like logic gates (e.g., AND, XOR), multiplexers or other primitives (e.g., clock manager, transceiver). On the other hand connecting many modules of behavioral descriptions (e.g., connecting a processor, memory and input/output modules with signals) could also be seen as a structural description.

In the choices everything but the schematic (circuit diagram) of a digital circuit describes its functions and thus behavior. A schematic of a circuit consists of interconnected logic gates which is a pure structural description and does not convey any direct functional information for the untrained eye.

A block diagram could also be seen as a structural description if the blocks are modules and the connections are signals. On the other hand a UML block diagram could be seen as a behavioral description if the connections define relations like *uses*, *inherits from*, etc.

A Boolean function is probably at the intersection of behavioral of structural, as the Boolean operations can directly be translated to logic gates.

#### The Design Process#

What are the typical steps of designing a digital circuit?

Solution to Exercise 39

Requirements

functional requirements which answer the question

*What should the design do?*non-functional requirements

*How a system supposed to be?*, e.g., performance, security, reliability, testability (also called*ilities*)

Design capture, e.g., schematic capture, which can comprise of^hdl_designer:

state diagram

block diagram

flow chart

truth table

Making sure to meet both functional and non-functional requirements.

Implementation using synthesis of, e.g.:

HDL

generated code

Note that nowadays step 2. and 3. are intertwined because the tools can generate programming code, FPGA configuration or the circuit for an ASIC directly from the captured design.

Verification can be done after various stages:

behavioral level

logic gate level (after synthesis)

after mapping (using device-specific primitives)

after routing (including interconnect latencies)

on device

### Representations of Logic Operations#

Source: Representations of Logic Operations

Using which Boolean operator/s can we construct every logical function?

Solution to Exercise 40

NOT and AND (a single NAND gate would be sufficient)

or:

NOT and OR (a single NOR gate would be sufficient)

For example, not (`a`

and `b`

) equals to (not `a`

or not `b`

). So we see that we can transform a Boolean `AND`

to an `OR`

.

We can build a computer using only NAND gates.

Exclusive or, abbreviated as `XOR`

is one of the Boolean operators.

What does it mean?

Describe it using:

`AND`

,`OR`

,`NOT`

Solution to Exercise 41

The output is true if and only if one of the two inputs is (

*exclusively*) true(i1 AND not i2) OR (not i1 AND i2)

#### SOP and POS Circuits#

What are *sum of products* and *products of sums* good for?

Solution to Exercise 42

POS and SOP are two ways of describing logical functions using the inputs of the logical function.

For example they allow us to express every logical function in a *canonical normal form*.

There are two forms:

*disjunctive*– the canonical disjunctive normal form (CDNF), which uses*maxterm*s chained by`OR`

s.*conjunctive*– the c. conjunctive n. f. (CCNF), which uses*minterm*s chained by`AND`

s.

CDNF is in SOP form and CCNF in POS.

What does *product* and *sum* mean in product of sums and sum of products?

Solution to Exercise 43

Because `AND`

and `OR`

are depicted using a multiplication (`.`

, `*`

) and addition symbol (`+`

), respectively[1]

Imagine that you have a truth table with many inputs and a single output.

On which rows of the truth table would you focus if you want to derive the logical function in CDNF?

Why do we focus on these rows?

Solution to Exercise 44

Rows where the output is

`True`

.CDNF contains the conditions (

`AND`

-chained input conditions) which individually cause the output to be`True`

. These conditions are connected together with an`OR`

, because any of the conditions lead to a`True`

output. We do not involve the conditions with the output`False`

, because they cannot effect the result of an`OR`

-chain.

#### Logic Functions#

A total of 16 logic functions are possible if we have two binary inputs a single binary output.

Why?

Solution to Exercise 45

With two binary inputs there are four different conditions. A logical function maps every condition to a binary output. Consequently, we have \(2^4\) different outcomes describing the four different conditions of a logical function.

How many logic functions are possible if we have three inputs and a single output?

Solution to Exercise 46

With three inputs we have eight different conditions and each condition leads to a binary output.

We can have \(2^8\) different functions.

#### Minterms and Maxterms#

We already mentioned the terms

maxterm

product of sums

A sum is a logical expression of some Boolean variables chained by `OR`

s.

What is the difference between a maxterm and a sum?

Solution to Exercise 47

A maxterm contains all input variables of a logical function. A sum does not necessarily contains all the input variables.

Note that the canonical conjunctive normal form is derived from a truth table and contains all possible inputs. CCNF is also called *maxterm canonical form*. *Canonical* and *normal* imply a standard representation of a mathematical expression. So a term in a canonical normal form contains all the input variables. This can be done by transforming all the lines of a truth table line by line.

### Electric and Electronic Switches for Logic Circuits#

Source: Electric and Electronic Switches for Logic Circuits

#### Switching Circuits#

#### Semiconductor-based Electronic Switches#

Where does the name transistor come from?

Solution to Exercise 48

It seems to be a combination of *transfer* and *resistor*[2].

And why does a transistor transfer a resistor? A transistor can be used both as a switch (that is how we typically use it digital design) or in general as an amplifier. If we apply a constant voltage between the gate and source of a field-effect transistor, then we get a constant current flowing through source and drain regardless of the voltage between source and drain. If we increase the voltage between gate and source, the current through source and drain also changes. From the user perspective the device seems to transfer a resistor to its output. That is where the name probably comes from.

Another observation: If we model a transistor as a two-port network we have a transfer resistor value of $\frac{V_2}(I_1}.

More information:

### Introduction to CMOS Technology#

Source: Introduction to CMOS Technology