Saturday, 20 July 2013

Design of 4 to 1 Multiplexer using if -else statement (Behavior Modeling Style) Verilog CODE-






Design of 4 to 1 Multiplexer using if - else statement (Behavior Modeling Style) -



Output Waveform :   4 to 1 Multiplexer



Verilog CODE -



//-----------------------------------------------------------------------------
//
// Title       : multiplexer4_1
// Design      : verilog upload 2
// Author      : Naresh Singh Dobal
// Company     : nsdobal@gmail.com
// Verilog Programs & Exercise by Naresh Singh Dobal.
//
//-----------------------------------------------------------------------------
//
// File        : 4 to 1 multiplexer using if else statements.v



module multiplexer4_1 ( din ,sel ,dout );

output dout ;
reg dout ;

input [3:0] din ;
wire [3:0] din ;
input [1:0] sel ;
wire [1:0] sel ;

always @ (din or sel) begin
if (sel==0)
dout = din[3];
else if (sel==1)
dout = din[2];
else if (sel==2)
dout = din[1];
else
dout = din[0];
end

endmodule


0 comments :

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes