MY CITATIONS

  • https://scholar.google.com/citations?user=8ke1xVQAAAAJ&hl=en
  • PREVIOUS QUESTION PAPERS : https://sircrrengg.ac.in/index.php?option=com_content&view=article&id=131&Itemid=459
  • YOUTUBE LINKS

Wednesday, October 27, 2021

Decoders in Verilog


  Decoders in Verilog

The decoder has N inputs and 2N outputs to cover all input combinations

consider 2:4 decoders with two inputs and four outputs. The output corresponding to a given input will be at logic level 1 all other outputs will be at logic  0 as shown in functional table


The decoder can be constructed by AND and NOT gates. The circuit diagram of the two-to-four decoder as shown below
Circuit diagram of two-to-four decoder

Verilog Description of Two-to-Four Decoder:



Verilog Description of Three-to-Eight Decoder Using case Keyword



Additional example: 3:8 decoder with enable input:

if en= 1 then decoder will works

 

test bench:

module decoder_tb;
wire [7:0] out;
reg en;
reg [2:0] in;
integer i;
 
decoder3_to_8 dut(in,out,en);
 
initial begin  
$monitor( "en=%b, in=%d, out=%b ", en, in, out);
   for ( i=0; i<8; i=i+1)
        begin
           {en,in}  = i;
            #1;
        end
end

endmodule





👉 back to combination blocks

No comments:

Post a Comment

DICD MID-2 IMP QUESTION

   ̅ What is a bistable element? Design bistable device with the help of CMOS inverters and also discuss transient analysis . Design a...