Skip to content

2. Circuits and Plexers

Adders

Let's say we want to add two numbers, first we need to make the truth table for each bit addition.

alt text

Notice that We must consider a carry in and a carry out.

$C_{out}=\bar{A}BC_{in}+A\bar{B}C_{in}+AB\bar{C_{in}}+ABC_{in}$

$S=\bar{A}\bar{B}C_{in}+\bar{A}B\bar{C_{in}}+A\bar{B}\bar{C_{in}}+ABC_{in}$

We have a one-bit full adder at our use.

alt text

Now let's chain them together to make them useful.

alt text

alt text

For substraction, just negate B and add one to the carry in.

alt text

Plexers

A multiplexer (mux) outputs one of its inputs based on the select.

alt text

alt text

Think of a multiplexer as a hardware if-else statement.

A demux does the opposite. Sending an input to one of the outputs.

alt text

An encoder takes $2^n$ inputs into n outputs. So, it tells you which input is one.

alt text

But wait, this could result in an invalid result, so it has an additional output valid.

We could just use a priority encoder!

alt text

X means we don't care what the result is.

All zeros is still an invalid input!

A decoder is like a 1-bit demux with an input of 1.

alt text

Next Page →