NAV BAr

Wednesday, March 8, 2017

2 to 1 MUX


//Behavioral 2 to 1 Multiplexer

module mul2t1_beha(m,x,y,s);
reg m ;

output [1:0]m;
input [1:0] x,y;
 input s;

   always @ (x or y or s)
       begin
       if (s == 0)
            m=y;
       else m=x;
      end
endmodule 



//Gate Level 2to1 MUX

////////////////////////////////////////


module mux_2(m,x,s,y);
 output [1:0] m;
 input [1:0] x, y;
 input s;
 
wire c,d,e,f;
 
    and i(c, x[0], ~s);
    and j(d, s, y[0]);
     or o(m[0],c,d);
   
    and k(e, x[1], ~s);
    and l(f, s ,y[1]) ;
 
    or  p( m[1], e,f);
 
endmodule




No comments:

Post a Comment