博主福利:100G+电子设计学习资源包!

​http://mp.weixin.qq.com/mp/homepage?__biz=MzU3OTczMzk5Mg==&hid=7&sn=ad5d5d0f15df84f4a92ebf72f88d4ee8&scene=18#wechat_redirect​​ --------------------------------------------------------------------------------------------------------------------------

 

module multiplier
(
input [2:0] x,
input [2:0] y,
output [5:0] mult_out
);

wire [2:0] temp0 = y[0] ? x : 3'd0;
wire [2:0] temp1 = y[1] ? x : 3'd0;
wire [2:0] temp2 = y[2] ? x : 3'd0;

assign mult_out = temp0 + (temp1 << 1) + (temp2 << 2);

endmodule