一、复数乘法器
算法:x=a+bi, y=c+di
x*y=(ac-bd)+(ad+bc)i
原理图:
代码实现:
module complex(a,b,c,d,out_real,out_im);
input [3:0] a,b,c,d;
output [8:0] out_real,out_im;
wire [7:0] sub1,sub2,add1,add2;
//乘法
mul_addtree U1(.a(a),.b(c),.out(sub1));
mul_addtree U2(.a(b),.b(d),.out(sub2));
mul_addtree U3(.a(a),.b(d),.out(add1));
mul_addtree U4(.a(b),.b(c),.out(add2));
//加/减法
assign out_real=sub1-sub2;<