X(2) | X(1) | X(0) | Y(0) | Y(1) | Y(2) | Y(3) | Y(4) | Y(5) | Y(6) | Y(7) |
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 |
1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 |
1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
3: 8 Decoder using basic logic gates Here is the code for 3: 8 Decoder using basic logic gates such as AND,NOT,OR etc.The module has one 3-bit input which is decoded as a 8-bit output.libraries to be used are specified here. For a 3: 8 decoder, total number of input lines is 3 and total number of output lines is 8. Based on the input, only one output line will be at logic high. The verilog code for 3:8 decoder with enable logic is given below. 3:8 Decoder Verilog Code. Module decoder3to8( in,out, en);input 2:0 in;input en;output 7:0 out; reg 7:0 out; always @( in or en)begin if (en) begin out=8'd0; case (in) 3'b000: out0=1'b1.
Entity decoder is port ( x : in std_logic_vector (2 down too)
Y : out std_logic_vector ( 0 down to 7 )
en : in std_logic) ;
End decoders;
Architecture behavioral of decoder is signal Y 1 : std_logic_vector (7 down to 0) ;
BeginY1 < = '0111 111' when z = ' 000 ' else
'10111111' when x = '001' else
'11011111' when x = '010' else
'11101111' when x = 011' else
'11110111' when x = '100' else
'11111011' when x = '101' else
'11111101' when x = '110' else
'11111110' when x = '111' else
'11111111' when others;
Y < = y, when en = ‘0' else '1111 1111' ;
End behavioral.
Just as Multiplexer, Decoder is also a Combinational circuit which transforms given inputs to a maximum number of outputs (maximum outputs equal to 2n and n are given inputs ).
A block diagram of decoder consists of input lines, one or more enable inputs and a maximum number of output lines.
To construct a decoder, we require to know the number of all possible output lines that totally depends on the given input.
So, if n represents given input lines then possible output lines would be 2n.
Decoder with three inputs would give 8 outputs (n=2,23 that is 8).
Here are the steps to construct 3 to 8 decoder
Step 1. Now we know possible outputs for 3 inputs, so construct 3 to 8 decoder, having 3 input lines, a enable input and 8 output lines. In the below diagram, given input represented asI2, I1 and I0 , all possible outputs named as O0, O1, O2,O3, O4, O5,O6& O7 and a E were represented by Enable input.
With Enable input
Without Enable input
Step 2. Now, it turns to construct the truth table for 3 to 8 decoder. E input can be considered as a control input. Mean to say, If E equals to 0 then the decoder would be considered as disabled regardless of what inputs are, If E equals to 1 then the decoder would work as per inputs.
Truth table without E input
Inputs | Outputs | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
I2 | I1 | I0 | O7 | O6 | O5 | O4 | O3 | O2 | O1 | O0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3 To 8 Decoder Vhdl
We can represent the following output as:
O0 = I0‘.I1‘.I2‘
O1 = I0.I1‘.I2‘
O3 = I0.I1.I2‘
O4 = I0‘.I1‘.I2
O5 = I0.I1‘.I2
O6 = I0‘.I1.I2
O7 = I0.I1.I2
Truth table with E input
Inputs | Outputs | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
E | I2 | I1 | I0 | O7 | O6 | O5 | O4 | O3 | O2 | O1 | O0 |
0 | - | - | - | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Decoder with E
Vhdl Code For 3 To 8 Decoder Using Structural Modelling
Explanation:
In above diagram, there were three input lines along with their complements using Inverters. Each and every AND gate were holding four inputs from E, I1, I1 and I0 and producing 8 outputs.
3: 8 Decoder using basic logic gates Here is the code for 3: 8 Decoder using basic logic gates such as AND,NOT,OR etc.The module has one 3-bit input which is decoded as a 8-bit output.libraries to be used are specified here. For a 3: 8 decoder, total number of input lines is 3 and total number of output lines is 8. Based on the input, only one output line will be at logic high. The verilog code for 3:8 decoder with enable logic is given below. 3:8 Decoder Verilog Code. Module decoder3to8( in,out, en);input 2:0 in;input en;output 7:0 out; reg 7:0 out; always @( in or en)begin if (en) begin out=8'd0; case (in) 3'b000: out0=1'b1.
Entity decoder is port ( x : in std_logic_vector (2 down too)
Y : out std_logic_vector ( 0 down to 7 )
en : in std_logic) ;
End decoders;
Architecture behavioral of decoder is signal Y 1 : std_logic_vector (7 down to 0) ;
BeginY1 < = '0111 111' when z = ' 000 ' else
'10111111' when x = '001' else
'11011111' when x = '010' else
'11101111' when x = 011' else
'11110111' when x = '100' else
'11111011' when x = '101' else
'11111101' when x = '110' else
'11111110' when x = '111' else
'11111111' when others;
Y < = y, when en = ‘0' else '1111 1111' ;
End behavioral.
Just as Multiplexer, Decoder is also a Combinational circuit which transforms given inputs to a maximum number of outputs (maximum outputs equal to 2n and n are given inputs ).
A block diagram of decoder consists of input lines, one or more enable inputs and a maximum number of output lines.
To construct a decoder, we require to know the number of all possible output lines that totally depends on the given input.
So, if n represents given input lines then possible output lines would be 2n.
Decoder with three inputs would give 8 outputs (n=2,23 that is 8).
Here are the steps to construct 3 to 8 decoder
Step 1. Now we know possible outputs for 3 inputs, so construct 3 to 8 decoder, having 3 input lines, a enable input and 8 output lines. In the below diagram, given input represented asI2, I1 and I0 , all possible outputs named as O0, O1, O2,O3, O4, O5,O6& O7 and a E were represented by Enable input.
With Enable input
Without Enable input
Step 2. Now, it turns to construct the truth table for 3 to 8 decoder. E input can be considered as a control input. Mean to say, If E equals to 0 then the decoder would be considered as disabled regardless of what inputs are, If E equals to 1 then the decoder would work as per inputs.
Truth table without E input
Inputs | Outputs | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
I2 | I1 | I0 | O7 | O6 | O5 | O4 | O3 | O2 | O1 | O0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3 To 8 Decoder Vhdl
We can represent the following output as:
O0 = I0‘.I1‘.I2‘
O1 = I0.I1‘.I2‘
O3 = I0.I1.I2‘
O4 = I0‘.I1‘.I2
O5 = I0.I1‘.I2
O6 = I0‘.I1.I2
O7 = I0.I1.I2
Truth table with E input
Inputs | Outputs | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
E | I2 | I1 | I0 | O7 | O6 | O5 | O4 | O3 | O2 | O1 | O0 |
0 | - | - | - | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Decoder with E
Vhdl Code For 3 To 8 Decoder Using Structural Modelling
Explanation:
In above diagram, there were three input lines along with their complements using Inverters. Each and every AND gate were holding four inputs from E, I1, I1 and I0 and producing 8 outputs.
4 To 16 Decoder Using 3 To 8 Decoder Vhdl Code
Decoder Without E
2 4 Decoder Verilog Code
Explanation:
In the above diagram, there were three input lines with their respective complements using Inverters. Each and every AND gate were holding three inputs from I1, I1 and I0 and producing 8 outputs.