module bin2gray (bin, gray); parameter SIZE = 4; input [SIZE-1:0] bin; output [SIZE-1:0] gray; assign gray = (bin>>1) ^ bin; endmodule