4 To 16 Decoder Using 2 To 4 Decoder Verilog Code

Verilog

A decoder is a multiple input, multiple output logic circuit that converts coded inputs into coded outputs where the input and output codes are different. The enable inputs must be ON for the decoder to function, otherwise its outputs assumes a ‘disabled’ output code word. Decoding is necessary in applications such as data multiplexing, seven segment display and memory address decoding.

Objective: To design 2 to 4 line decoder using Verilog HDL, obtain the simulation and synthesis. Software and Hardware: Xilinx ISE 9.2i and FPGA Spartan-3E. Theory: Decoders are circuits with two or more inputs and 2 n outputs. Based on the input code, only one of the output is selected. The truth table of 2-to-4 line decoder is.

  1. 4 To 16 Decoder Using 2 To 4 Decoder Verilog Code For Windows A decoder is a multiple input, multiple output logic circuit that changes codes i/ps into coded o/ps, where both the inputs and outputs are dissimilar for instance n-to-2n, and binary coded decimal decoders.
  2. Verilog code for D Flip-Flop; Verilog code for D-Latch Active Low; Verilog code for D-Latch Active High; Verilog code for 2 to 4 line Decoder; Verilog code for 4 to 2 line Encoder; Verilog code for 1:2 DEMUX; Verilog code for 4:1 MUX; Verilog code for 2:1 MUX; Verilog code for Full-Adder; Verilog code for Half-Adder; Verilog code for XOR gate.
  3. Email This BlogThis! Share to Twitter Share to Facebook Share to Pinterest. August (2) Verilog code for 2 to 4 Decoder with Test Bench.
  4. Verilog Code for 2 to 4 Decoder Behavioral Modelling using Case Statement with Testbench Code. Module 24DEC( input 1:0din, output 3:0dout ); reg 3:0dout.

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_arith.all;

use ieee.std_logic_unsigned.all;

4 To 16 Decoder Using 2 To 4 Decoder Vhdl Code

module decoder(a, y);

input [1:0] a;

output [3:0] y;

4 to 16 decoder using 2 to 4 decoder with enable

reg [3:0] y;

always @ (a)

case(a)

2’b00: y<= 4’b1110;

2’b01: y<= 4’b1101;

2’b10: y<= 4’b1011;

2’b11: y<= 4’b0111;

end case;

endmodule

Decoder is a digital circuit that can select a line according to the input pattern. Decoder can be used as a control unit for a MCU,processor etc. 4 to 16 line decoder verilog code arr given bellow.

module decoder(x,y,z,w,e,d);
input w,x,y,z,e;
output [15:0]d;
assign d[0]= (~x) & (~y) &(~z) & (~w) & (e) ;
assign d[1]= (~x) & (~y) &(~z) & & (e) ;
assign d[2]= (~x) & (~y) &(z) & (~w) & (e) ;
assign d[3]= (~x) & (~y) &(z) & & (e) ;
assign d[4]= (~x) & (y) &(~z) & (~w) & (e) ;
assign d[5]= (~x) & (y) &(~z) & & (e) ;
assign d[6]= (~x) & (y) &(z) & (~w) & (e) ;
assign d[7]= (~x) & (y) &(z) & & (e) ;

assign d[8]= (x) & (~y) &(~z) & (~w) & (e) ;
assign d[9]= (x) & (~y) &(~z) & & (e) ;
assign d[10]= (x) & (~y) &(z) & (~w) & (e) ;
assign d[11]= (x) & (~y) &(z) & & (e) ;
assign d[12]= (x) & (y) &(~z) & (~w) & (e) ;
assign d[13]= (x) & (y) &(~z) & & (e) ;
assign d[14]= (x) & (y) &(z) & (~w) & (e) ;
assign d[15]= (x) & (y) &(z) & & (e) ;

endmodule

module decoder2();
reg x0,y0,z0,w0,e0;
wire [15:0]dd;

4 to 16 decoder using 2 to 4 decoder verilog codes

4 To 16 Decoder Using 2 To 4 Decoder Verilog Code Examples

initial
begin
e0=0;
x0=0;
y0=1;
z0=0;
w0=1;

#10 e0=1;
#00 x0=0;
#00 y0=0;
#00 z0=0;
#00 w0=0;

Verilog

#10 x0=0;
#00 y0=0;
#00 z0=1;
#00 w0=1;

4 To 16 Decoder Using 2 To 4 Decoder Verilog Code

#10 x0=0;
#00 y0=1;
#00 z0=0;
#00 w0=0;

4*16 Decoder Using 2*4 Decoder

#10 e0=0;
end
decoder s(.d(dd),.e(e0),.x(x0),.y(y0),.z(z0),.w(w0));
endmodule