Code Monkey home page Code Monkey logo

experiment-08-encoders-and-decoders-'s Introduction

Name:ABINAYA S
Register Number: 212222230002

Exp 07 Encoders and decoders

AIM:

To implement 8 to 3 Encoder and 3to8 Decoder using verilog and validate its outputs

HARDWARE REQUIRED:

– PC, Cyclone II , USB flasher

SOFTWARE REQUIRED:

Quartus prime

THEORY:

Encoders

Binary code of N digits can be used to store 2N distinct elements of coded information. This is what encoders and decoders are used for. Encoders convert 2N lines of input into a code of N bits and Decoders decode the N bits into 2N lines.

  1. Encoders – An encoder is a combinational circuit that converts binary information in the form of a 2N input 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.

As an example, let’s consider Octal to Binary encoder. As shown in the following figure, an octal-to-binary encoder takes 8 input lines and generates 3 output lines.

image

Figure -01 3 to 8 Encoder

Implementation –

X = D4 + D5 + D6 + D7 Y = D2 +D3 + D6 + D7 Z = D1 + D3 + D5 + D7 Hence, the encoder can be realised with OR gates as follows:

image

Figure -02 3 to 8 Encoder implenentation

Decoders

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.

Let’s take an example of 3-to-8 line decoder. Implementation – D0 is high when X = 0, Y = 0 and Z = 0. Hence,

D0 = X’ Y’ Z’ Similarly,

D1 = X’ Y’ Z D2 = X’ Y Z’ D3 = X’ Y Z D4 = X Y’ Z’ D5 = X Y’ Z D6 = X Y Z’ D7 = X Y Z

image

Figure -03 8 to 3 Decoder

image

Figure -04 8 to 3 Decoder implementation

Procedure:

  1. Create a New Project:

    • Open Quartus and create a new project by selecting "File" > "New Project Wizard."
    • Follow the wizard's instructions to set up your project, including specifying the project name, location, and target device (FPGA).
  2. Create a New Design File:

    • Once the project is created, right-click on the project name in the Project Navigator and select "Add New File."
    • Choose "Verilog HDL File" or "VHDL File," depending on your chosen hardware description language.
  3. Write the Combinational Logic Code:

    • Open the newly created Verilog or VHDL file and write the code for your combinational logic.
  4. Compile the Project:

    • To compile the project, click on "Processing" > "Start Compilation" in the menu.
    • Quartus will analyze your code, synthesize it into a netlist, and perform optimizations based on your target FPGA device.
  5. Analyze and Fix Errors:

    • If there are any errors or warnings during the compilation process, Quartus will display them in the Messages window.
    • Review and fix any issues in your code if necessary.
    • View the RTL diagram.
  6. Verification:

    • Click on "File" > "New" > "Verification/Debugging Files" > "University Program VWF".
    • Once Waveform is created Right Click on the Input/Output Panel > " Insert Node or Bus" > Click on Node Finder > Click On "List" > Select All.
    • Give the Input Combinations according to the Truth Table amd then simulate the Output Waveform.

PROGRAM

Encoder:
module encoder(a0,a1,a2,y0,y1,y2,y3,y4,y5,y6,y7);
input y0,y1,y2,y3,y4,y5,y6,y7;
output a0,a1,a2;
or(a0,y7,y5,y3,y1);
or(a1,y7,y6,y3,y2);
or(a2,y7,y6,y5,y4);
endmodule

Decoder

module decoder(a0,a1,a2,y0,y1,y2,y3,y4,y5,y6,y7);
input a0,a1,a2;
output y0,y1,y2,y3,y4,y5,y6,y7;
wire a0bar,a1bar,a2bar;
not(a0bar,a0);
not(a1bar,a1);
not(a2bar,a2);
and(y0,a0bar,a1bar,a2bar);
and(y1,a0,a1bar,a2bar);
and(y2,a0bar,a1,a2bar);
and(y3,a0,a1,a2bar);
and(y4,a0bar,a1bar,a2);
and(y5,a0,a1bar,a2);
and(y6,a0bar,a1,a2);
and(y7,a0,a1,a2);
endmodule

RTL DIAGRAM:

Encoder-

image

Decoder-

image

TRUTH TABLE :

Encoder-

image

Decoder:

image

OUTPUT WAVEFORM:

Encoder-

image

Decoder-

image

RESULT:

Thus the program to design encoder and decoder is executed successfully .

experiment-08-encoders-and-decoders-'s People

Contributors

abinayasangeetha avatar vasanthkumarch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.