DC_A4
DC_A4
DC_A4
EXPERIMENT-4
VERILOG HDL CODE TO REALIZE 3 TO 8 DECODER AND 8
TO 3 ENCODER.
Aim: To realize 3 to 8 decoder and 8 to 3 encoder Xilinx with Verilog HDL programming
language.
Apparatus: ISE Xilinx 9.2i.
Theory:
Binary code of N digits can be used to store 2 distinct elements of coded information. This is
N
what encoders and decoders are used for. Encoders convert 2 lines of input into a code of N bits
N
An encoder is a combinational circuit that converts binary information in the form of a 2 input
N
lines into N output lines, which represent N bit code for the input. For simple encoders, it is
assumed that only one input line is active at a time.
A decoder does the opposite job of an encoder. It is a combinational circuit that converts n lines
of input into 2n lines of output.
Source Code: (3 to 8 Decoder)
Data flow Model:
module decoder38(
input [2:0] a,
output [7:0] d
);
assign d[0]=(~a[2])&(~a[1])&(~a[0]);
assign d[1]=(~a[2])&(~a[1])&(a[0]);
assign d[2]=(~a[2])&(a[1])&(~a[0]);
assign d[3]=(~a[2])&(a[1])&(a[0]);
assign d[4]=(a[2])&(~a[1])&(~a[0]);
assign d[5]=(a[2])&(~a[1])&(a[0]);
assign d[6]=(a[2])&(a[1])&(~a[0]);
assign d[7]=(a[2])&(a[1])&(a[0]);
endmodule
Procedure:
1. Open Xilinx Vivado software tool and click on new project.
2. Select Verilog HDL language and proceed to next.
3. Select the Constraints inputs and outputs used for design.
4. Select Zedboard. A file will be selected write the code and save the file.
5. Check for errors, if any correct them.
6. Now add a source file for writing test bench code.
7. Write Test bench code and run synthesis.
8. Now run behavioral simulation for output waveform.
Applications:
1. Speed synchronization of multiple motors in industries.
2.War field flying robot with a night vision flying camera.
Result: 3 to 8 decoder and 8 to 3 encoder using Verilog HDL is realized in Xilinx ISE 9.2i
Software tool.
Output:(3 to 8 Decoder)
8 to 3 Encoder: