Advertisement
regzarr

mux

Oct 31st, 2019
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module mux # ( parameter k = 8 )
  2. (
  3.   input [k-1:0]d0, [k-1:0]d1, [k-1:0]d2, [k-1:0]d3,
  4.   input [1:0]s,
  5.   output reg [k-1:0]o );
  6.  
  7.   always @(*) begin
  8.     if (s == 0)
  9.       o <= d0;
  10.     else if (s == 1)
  11.       o <= d1;
  12.     else if (s == 2)
  13.       o <= d2;
  14.     else
  15.       o <= d3;
  16.     end
  17.  
  18. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement