Diferență între revizuiri ale paginii „The Decoder”
Cbira (discuție | contribuții) (Pagină nouă: The decoder is a combinational circuit which is used to identify the specified input value by setting the output of the bit on the corresponding index to the input. The decoder is...) |
Cbira (discuție | contribuții) |
||
(Nu s-au afișat 4 versiuni intermediare efectuate de același utilizator) | |||
Linia 4: | Linia 4: | ||
{| class = "wikitable" | {| class = "wikitable" | ||
− | | - bgcolor = "# ddeeff" align = "center" | + | |- bgcolor = "#ddeeff" align = "center" |
− | | '' ' | + | |'''INPUT''' || '''OUTPUT''' |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0000 || 0000_0000_0000_0001 | + | |0000 || 0000_0000_0000_0001 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0001 || 0000_0000_0000_0010 | + | |0001 || 0000_0000_0000_0010 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0010 || 0000_0000_0000_0100 | + | |0010 || 0000_0000_0000_0100 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0011 || 0000_0000_0000_1000 | + | |0011 || 0000_0000_0000_1000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0100 || 0000_0000_0001_0000 | + | |0100 || 0000_0000_0001_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0101 || 0000_0000_0010_0000 | + | |0101 || 0000_0000_0010_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0110 || 0000_0000_0100_0000 | + | |0110 || 0000_0000_0100_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 0111 || 0000_0000_1000_0000 | + | |0111 || 0000_0000_1000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1000 || 0000_0001_0000_0000 | + | |1000 || 0000_0001_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1001 || 0000_0010_0000_0000 | + | |1001 || 0000_0010_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1010 || 0000_0100_0000_0000 | + | |1010 || 0000_0100_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1011 || 0000_1000_0000_0000 | + | |1011 || 0000_1000_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1100 || 0001_0000_0000_0000 | + | |1100 || 0001_0000_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1101 || 0010_0000_0000_0000 | + | |1101 || 0010_0000_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1110 || 0100_0000_0000_0000 | + | |1110 || 0100_0000_0000_0000 |
− | | - bgcolor = "# ddffdd" align = "center" | + | |- bgcolor = "#ddffdd" align = "center" |
− | | 1111 || 1000_0000_0000_0000 | + | |1111 || 1000_0000_0000_0000 |
|} | |} | ||
Linia 44: | Linia 44: | ||
The interface of a decoder is made up of two signals: | The interface of a decoder is made up of two signals: | ||
* input of '' n '' bits; | * input of '' n '' bits; | ||
− | * output of 2 <sup> n </ sup> bits. | + | * output of 2 <sup> n </sup> bits. |
== Implementation == | == Implementation == | ||
There are several possible implementations for the decoder: | There are several possible implementations for the decoder: | ||
− | * using blocks ''' | + | * using blocks '''generate for'''; |
* using blocks '''always''' combinational and '''case'''; | * using blocks '''always''' combinational and '''case'''; | ||
* using a block '''assign''' and the left shift operator. | * using a block '''assign''' and the left shift operator. | ||
Although the last variant is not optimal from the point of view of the synthesized circuit, we will use this method because of the ease and short dimension of the description. | Although the last variant is not optimal from the point of view of the synthesized circuit, we will use this method because of the ease and short dimension of the description. |
Versiunea curentă din 10 mai 2018 07:00
The decoder is a combinational circuit which is used to identify the specified input value by setting the output of the bit on the corresponding index to the input. The decoder is equivalent to a 1-bit multiplexer and the constant data input of 1.
For example, for a 4-bit decoder, the port table is shown below (the _ character can be used in Verilog to separate bits or numbers belonging to a base in writing a constant, for ease of reading; 16'b0100_0011_0100_0111)
INPUT | OUTPUT |
0000 | 0000_0000_0000_0001 |
0001 | 0000_0000_0000_0010 |
0010 | 0000_0000_0000_0100 |
0011 | 0000_0000_0000_1000 |
0100 | 0000_0000_0001_0000 |
0101 | 0000_0000_0010_0000 |
0110 | 0000_0000_0100_0000 |
0111 | 0000_0000_1000_0000 |
1000 | 0000_0001_0000_0000 |
1001 | 0000_0010_0000_0000 |
1010 | 0000_0100_0000_0000 |
1011 | 0000_1000_0000_0000 |
1100 | 0001_0000_0000_0000 |
1101 | 0010_0000_0000_0000 |
1110 | 0100_0000_0000_0000 |
1111 | 1000_0000_0000_0000 |
Interface
The interface of a decoder is made up of two signals:
- input of n bits;
- output of 2 n bits.
Implementation
There are several possible implementations for the decoder:
- using blocks generate for;
- using blocks always combinational and case;
- using a block assign and the left shift operator.
Although the last variant is not optimal from the point of view of the synthesized circuit, we will use this method because of the ease and short dimension of the description.