Solved

# Decoder

Posted on 2006-11-15
1,393 Views
How do make a 8 to 128 bit decoder at gate level?
0
Question by:rgdicoch
• 2

LVL 9

Accepted Solution

lombardp earned 125 total points
ID: 17958271
Hi  rgdicoch,
actually it should be a 7-to-128 bit decoder, since 2^7 = 128 ... i.e. with 7 bits you can obtain 128 different  bit patterns.

A gate level description of such a decoder could be given with a Hardware Description Language, such as Verilog HDL or VHDL, for example using verilog:

wire [6:0] a;                              // this is the encoded input
wire [127:0] decoded_output;     // this is the decoded output

// The decoded output line #0 is 1 if input is 0000000
assign decoded_output[0] = !a[7] & !a[6] & !a[5] & !a[4] & !a[3] & !a[2] & !a[1] & !a[0];

// The decoded output line #1 is 1 if input is 0000001
assign decoded_output[1] = !a[7] & !a[6] & !a[5] & !a[4] & !a[3] & !a[2] & !a[1] & a[0];

....

// The decoded output line #127 is 1 if input is 1111111
assign decoded_output[1] = a[7] & a[6] & a[5] & a[4] & a[3] & a[2] & a[1] & a[0];

(there is a more compact way to write the decoder, without explicitly write down a row for each output)

If you want the graphical representation of the decoder, you have only yo substitute the NOT operator (!) in the above equation with a NOT gate, and the AND operator (&) with a AND gate.

Let me know if I have understood your question

0

Author Comment

ID: 17959215
Lombardp,

Thanks for your response...yes this is exactly what I was looking for.  The 8 to 128 part was really 8 to 256... but I am only representing 128 different charcaters so that leaves me an extra input bit.  The input is fixed at 8 bits.  We are trying to implement the AES algorithm where processing is done 8 bits at a time...hence the 8 bits of input.  We are then taking those 8 bits and coming up with the ASCII character....and there are only 128 chars that we are interested in. Hope this makes sense.  But we are doing this at transisor level...custom layout.  But I wanted a "NAND GATE" representation of the decoder...that way I know internally what Im dealing with.  Thanks so much

Rigo
0

LVL 9

Expert Comment

ID: 17961413
Ok, the above logical equations still remain valid. What you need is a way to express boolean operator with a proper combination of NAND gates.

First of all, a NAND is a NOT AND, so if I write c = NAND (a,b) = NOT (a AND b)

a NOT operator can be obtained with a NAND, using the same input value for both the NAND input.

b = NOT a = NOT (a AND a) = NAND(a,a)

so replace NOT operators with the NAND connected as above

a AND operator can be obtained with a NAND and a NOT, so

c = AND(a,b) = NOT NAND(a,b) = NAND( NAND(a,b) , NAND(a,b) )

a OR operator can be obtained with the following:

c = OR(a,b) = NOT ( AND(NOT a, NOT b) ) = (replace AND and NOT operators with the above NAND-based espressions)

Now you have the NAND equivalent expression for every boolean operator (AND, OR, NOT), so you can virtually express any boolean equation in terms of NANDs. Actually this work is performed by the so-called "logic synthsizer", a software that "maps" general boolean equations onto the "physical" operators of your technology (NAND gate in your case). The synthesizer performs also a sort of "reduction" of the final net, in order to minimize the number of gates used.

0

LVL 22

Expert Comment

ID: 18204788
I might be misunderstanding (I don't know AES), but it sounds to me like you just want a special-purpose 256x8 ROM.  Implementing decoders and such is probably overkill.
0

## Featured Post

This article applies to This article will be of use if you are the owner / supporter of any computer that comes with a discrete graphics card from nVidia / ATI Radeon (Now owned by AMD) or any embedded graphics solution and need to upgrade the gr…
A little history Back in 1997 when I built my first custom computer using the revolutionary Gateway website I didn’t have much to choose from except for the CPU. The race between computer manufacturers was held back by processor manufacturers. They…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.