script async='async' crossorigin='anonymous' src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6016566166623052'/> Verilog coding: Verilog code for 2-to-4 line Decoder:

Friday 14 April 2017

Verilog code for 2-to-4 line Decoder:

How to program 2-to-4 line Decoder in verilog?
A Decoder is a simple logic gates diagram that changes a code into a set of different signals. Decoder is the reverse process of Encoders.
A simple/common  decoder is the line decoder which takes an n-digit binary number and decodes it into 2n data lines. The simplest decoder is the 1-to-2 line decoder. Following is the truth table of 1-to-2 line decoder,

Following is the truth table of 2-to-4 line decoder ;


when it developed into a logic circuit it looks like





Verilog code of 2 to 4 line decoder:

module decoder(d,A0,A1);
output [3:0] d;
input x,y;
assign d[0] = ~A0 & ~A1 ;
assign d[1] = A0 & ~A1;
assign d[2] = ~A0 & A1;
assign d[3] = A0 & A1 ;
endmodule





fpga verilog code example






No comments:

Post a Comment