Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Octal full adder How to

I have this project listen below and im not sure where to start maybe someone can give me a few pointers or perhaps point me in the right direction of starting this? Thanks!!

Input: A, B = octal digits (see representation below); Cin = binary digit

Output: S = octal digit (see representation below); Cout = binary digit

Task: Using binary FAs, design a circuit that acts as an octal FA. More specifically, this circuit would input the two octal digits A, B, convert them into binary numbers, add them using only binary FAs, convert the binary result back to octal, and output the sum as an octal digit, and the binary carry out.

Input/Output binary representation of octal digits

Every octal digit will be represented using the following 8-bit binary representation:

Octal 8-bit Input Lines:

Digit: 0 1 2 3 4 5 6 7
0       1 0 0 0 0 0 0 0
1       0 1 0 0 0 0 0 0
2       0 0 1 0 0 0 0 0
3       0 0 0 1 0 0 0 0
4       0 0 0 0 1 0 0 0
5       0 0 0 0 0 1 0 0
6       0 0 0 0 0 0 1 0
7       0 0 0 0 0 0 0 1

You are required to design the circuit in a structured way.

like image 933
soniccool Avatar asked May 07 '12 21:05

soniccool


1 Answers

Ok, so essentially you're being asked to design a 8-to-3 encoder and a 3-to-8 decoder. Because you're given FAs to work with that's not the point of the assignment.

First we need to define how an encoder and decoder function. So we construct a truth table:

Encoder:

Input    | Output
01234567 | 421
-----------------
10000000 | 000
01000000 | 001
00100000 | 010
00010000 | 011
00001000 | 100
00000100 | 101
00000010 | 110
00000001 | 111

and the decoder is just the reverse of that.

Next, how do we construct our encoder? Well, we can simply attack it one bit at a time.

So for the 1s digit we have if input bit 1, 3, 5 or 7 is set then it's 1, otherwise it's 0. So we just need a giant OR with 4 inputs connected to 1, 3, 5 and 7.

For the 2s digit we need the OR gate connected to 2, 3, 6, 7. Finally for the 4s gate, connect them to 4, 5, 6, 7. This doesn't do any error checking to make sure extra bits aren't set. Though, the behavior in that case seems to be undefined by spec, so it's probably OK.

Then you take your three lines and feed them to your adders. This is easy so I won't get into it.

Finally you need a decoder, this is a bit more tricky than the encoder.

Let's look at the decoder truth table:

Input | Output
421   | 01234567 
----------------
000   | 10000000
001   | 01000000
010   | 00100000
011   | 00010000
100   | 00001000
101   | 00000100
110   | 00000010
111   | 00000001

This time we can't just use 3 or gates and call it a day.

Let's write this down in C-like code:

if (!input[0] && !input[1] && !input[2])
  output[0] = 1
if (input[0]  && !input[1] && !input[2])
  output[1] = 1
if (!input[0] && input[1]  && !input[2])
  output[2] = 1
if (input[0]  && input[1]  && !input[2])
  output[3] = 1
if (!input[0] && !input[1] && input[2])
  output[4] = 1
if (input[0]  && !input[1] && input[2])
  output[5] = 1
if (!input[0] && input[1]  && input[2])
  output[6] = 1
if (input[0]  && input[1]  && input[2])
  output[7] = 1

So, it looks like we're going to be using 8 3 input AND gates, and three NOT gates!

This one is a bit more complicated, so I made an example implementation:

3-to-8 decoder

like image 126
OmnipotentEntity Avatar answered Sep 19 '22 11:09

OmnipotentEntity