sp3ctrm5tr

8 to 3 Multiplexer

Mar 18th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*=================================================
  2. 8 to 1 Multiplexer
  3. =================================================*/
  4.    
  5. module mux8to1 (
  6.     input [7:0] I, // Mux 8-bits input
  7.     input [2:0] S, // Selector 3-bits
  8.     output reg Y);
  9.  
  10. always @ (*)
  11.     if (S==0) Y=I[0];
  12.     else if (S==1) Y=I[1];
  13.     else if (S==2) Y=I[2];
  14.     else if (S==3) Y=I[3];
  15.     else if (S==4) Y=I[4];
  16.     else if (S==5) Y=I[5];
  17.     else if (S==6) Y=I[6];
  18.     else if (S==7) Y=I[7];
  19.    
  20. endmodule
Advertisement
Add Comment
Please, Sign In to add comment