module mask #(parameter w = 32)(input [w-1:0] in, input [$clog2(w)-1:0] m, output [w-1:0] out);assign out = in & (({{w-1{1'b0}},1'b1} << m) - 1'b1);endmodule
If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org
no subject
Date: 2013-04-23 07:34 (UTC)module mask #(parameter w = 32)(input [w-1:0] in, input [$clog2(w)-1:0] m, output [w-1:0] out);
assign out = in & (({{w-1{1'b0}},1'b1} << m) - 1'b1);
endmodule