📄 chengxing1.v
字号:
module chengxing1(mcu_reset,clk_code_eight,chong_i_out,chong_q_out,
chong_valid,chong_end,
cheng_valid,end_send,
Tx_I,
Tx_Q);
input mcu_reset;
input clk_code_eight;
input [1:0]chong_i_out;
input [1:0]chong_q_out;
input chong_valid;
input chong_end;
output cheng_valid;
output end_send;
output [7:0]Tx_I;
output [7:0]Tx_Q;
reg [7:0] Tx_I;
reg [7:0] Tx_Q;
reg cheng_valid;
reg end_send;
reg [31:0] saowei_i;
wire [7:0] tempA0,tempA1,tempA2,tempA3,tempA4,tempA5,tempA6,tempA7,tempA8,tempA9,
tempA10,tempA11,tempA12,tempA13,tempA14,tempA15,tempA16,tempA17,tempA18,tempA19,
tempA20,tempA21,tempA22,tempA23,tempA24,tempA25,tempA26,tempA27,tempA28,tempA29,
tempA30,tempA31,tempA32,tempA33,tempA34,tempA35,tempA36,tempA37,tempA38,tempA39,
tempA40,tempA41,tempA42,tempA43,tempA44,tempA45,tempA46,tempA47,tempA48,
tempB0,tempB1,tempB2,tempB3,tempB4,tempB5,tempB6,tempB7,tempB8,tempB9,
tempB10,tempB11,tempB12,tempB13,tempB14,tempB15,tempB16,tempB17,tempB18,tempB19,
tempB20,tempB21,tempB22,tempB23,tempB24,tempB25,tempB26,tempB27,tempB28,tempB29,
tempB30,tempB31,tempB32,tempB33,tempB34,tempB35,tempB36,tempB37,tempB38,tempB39,
tempB40,tempB41,tempB42,tempB43,tempB44,tempB45,tempB46,tempB47,tempB48;
reg [1:0] yB48,yB47,yB46,yB45,yB44,yB43,yB42,yB41,yB40,
yB39,yB38,yB37,yB36,yB35,yB34,yB33,yB32,yB31,yB30,
yB29,yB28,yB27,yB26,yB25,yB24,yB23,yB22,yB21,yB20,
yB19,yB18,yB17,yB16,yB15,yB14,yB13,yB12,yB11,yB10,
yB9,yB8,yB7,yB6,yB5,yB4,yB3,yB2,yB1,yB0;
reg [1:0] y48,y47,y46,y45,y44,y43,y42,y41,y40,
y39,y38,y37,y36,y35,y34,y33,y32,y31,y30,
y29,y28,y27,y26,y25,y24,y23,y22,y21,y20,
y19,y18,y17,y16,y15,y14,y13,y12,y11,y10,
y9,y8,y7,y6,y5,y4,y3,y2,y1,y0;
parameter
h0= 8'b 00000000 ,
h1= 8'b 00000001 ,
h2= 8'b 00000010 ,
h3= 8'b 00000011 ,
h4= 8'b 00000100 ,
h5= 8'b 00000100 ,
h6= 8'b 00000011 ,
h7= 8'b 00000010 ,
h8= 8'b 00000000 ,
h9= 8'b 11111101 ,
h10= 8'b 11111010 ,
h11= 8'b 11111000 ,
h12= 8'b 11110110 ,
h13= 8'b 11110101 ,
h14= 8'b 11110110 ,
h15= 8'b 11111010 ,
h16= 8'b 00000000 ,
h17= 8'b 00001000 ,
h18= 8'b 00010010 ,
h19= 8'b 00011101 ,
h20= 8'b 00101000 ,
h21= 8'b 00110001 ,
h22= 8'b 00111001 ,
h23= 8'b 00111110 ,
h24= 8'b 01000000 ,
h25= 8'b 00111110 ,
h26= 8'b 00111001 ,
h27= 8'b 00110001 ,
h28= 8'b 00101000 ,
h29= 8'b 00011101 ,
h30= 8'b 00010010 ,
h31= 8'b 00001000 ,
h32= 8'b 00000000 ,
h33= 8'b 11111010 ,
h34= 8'b 11110110 ,
h35= 8'b 11110101 ,
h36= 8'b 11110110 ,
h37= 8'b 11111000 ,
h38= 8'b 11111010 ,
h39= 8'b 11111101 ,
h40= 8'b 00000000 ,
h41= 8'b 00000010 ,
h42= 8'b 00000011 ,
h43= 8'b 00000100 ,
h44= 8'b 00000100 ,
h45= 8'b 00000011 ,
h46= 8'b 00000010 ,
h47= 8'b 00000001 ,
h48= 8'b 00000000 ;
always @(posedge mcu_reset or negedge clk_code_eight)
begin
if(mcu_reset==1)
begin
y48<=2'b0;
y47<=2'b0;
y46<=2'b0;
y45<=2'b0;
y44<=2'b0;
y43<=2'b0;
y42<=2'b0;
y41<=2'b0;
y40<=2'b0;
y39<=2'b0;
y38<=2'b0;
y37<=2'b0;
y36<=2'b0;
y35<=2'b0;
y34<=2'b0;
y33<=2'b0;
y32<=2'b0;
y31<=2'b0;
y30<=2'b0;
y29<=2'b0;
y28<=2'b0;
y27<=2'b0;
y26<=2'b0;
y25<=2'b0;
y24<=2'b0;
y23<=2'b0;
y22<=2'b0;
y21<=2'b0;
y20<=2'b0;
y19<=2'b0;
y18<=2'b0;
y17<=2'b0;
y16<=2'b0;
y15<=2'b0;
y14<=2'b0;
y13<=2'b0;
y12<=2'b0;
y11<=2'b0;
y10<=2'b0;
y9<=2'b0;
y8<=2'b0;
y7<=2'b0;
y6<=2'b0;
y5<=2'b0;
y4<=2'b0;
y3<=2'b0;
y2<=2'b0;
y1<=2'b0;
y0<=2'b0;
cheng_valid<=0;
end_send<=0;
saowei_i<=0;
Tx_I<=0;
end
else
begin
if(chong_valid==0 && chong_end==0)
begin
cheng_valid<=0;
end_send<=0;
end
else
begin
if(chong_end==0)
begin
cheng_valid<=1;
y48<=y47;
y47<=y46;
y46<=y45;
y45<=y44;
y44<=y43;
y43<=y42;
y42<=y41;
y41<=y40;
y40<=y39;
y39<=y38;
y38<=y37;
y37<=y36;
y36<=y35;
y35<=y34;
y34<=y33;
y33<=y32;
y32<=y31;
y31<=y30;
y30<=y29;
y29<=y28;
y28<=y27;
y27<=y26;
y26<=y25;
y25<=y24;
y24<=y23;
y23<=y22;
y22<=y21;
y21<=y20;
y20<=y19;
y19<=y18;
y18<=y17;
y17<=y16;
y16<=y15;
y15<=y14;
y14<=y13;
y13<=y12;
y12<=y11;
y11<=y10;
y10<=y9;
y9<=y8;
y8<=y7;
y7<=y6;
y6<=y5;
y5<=y4;
y4<=y3;
y3<=y2;
y2<=y1;
y1<=y0;
y0<=chong_i_out;
Tx_I<=tempA0+
tempA1+
tempA2+
tempA3+
tempA4+
tempA5+
tempA6+
tempA7+
tempA8+
tempA9+
tempA10+
tempA11+
tempA12+
tempA13+
tempA14+
tempA15+
tempA16+
tempA17+
tempA18+
tempA19+
tempA20+
tempA21+
tempA22+
tempA23+
tempA24+
tempA25+
tempA26+
tempA27+
tempA28+
tempA29+
tempA30+
tempA31+
tempA32+
tempA33+
tempA34+
tempA35+
tempA36+
tempA37+
tempA38+
tempA39+
tempA40+
tempA41+
tempA42+
tempA43+
tempA44+
tempA45+
tempA46+
tempA47+
tempA48;
end
else
begin
if(saowei_i<48)
begin
saowei_i<=saowei_i+1;
y48<=y47;
y47<=y46;
y46<=y45;
y45<=y44;
y44<=y43;
y43<=y42;
y42<=y41;
y41<=y40;
y40<=y39;
y39<=y38;
y38<=y37;
y37<=y36;
y36<=y35;
y35<=y34;
y34<=y33;
y33<=y32;
y32<=y31;
y31<=y30;
y30<=y29;
y29<=y28;
y28<=y27;
y27<=y26;
y26<=y25;
y25<=y24;
y24<=y23;
y23<=y22;
y22<=y21;
y21<=y20;
y20<=y19;
y19<=y18;
y18<=y17;
y17<=y16;
y16<=y15;
y15<=y14;
y14<=y13;
y13<=y12;
y12<=y11;
y11<=y10;
y10<=y9;
y9<=y8;
y8<=y7;
y7<=y6;
y6<=y5;
y5<=y4;
y4<=y3;
y3<=y2;
y2<=y1;
y1<=y0;
y0<=0;
Tx_I<=tempA0+
tempA1+
tempA2+
tempA3+
tempA4+
tempA5+
tempA6+
tempA7+
tempA8+
tempA9+
tempA10+
tempA11+
tempA12+
tempA13+
tempA14+
tempA15+
tempA16+
tempA17+
tempA18+
tempA19+
tempA20+
tempA21+
tempA22+
tempA23+
tempA24+
tempA25+
tempA26+
tempA27+
tempA28+
tempA29+
tempA30+
tempA31+
tempA32+
tempA33+
tempA34+
tempA35+
tempA36+
tempA37+
tempA38+
tempA39+
tempA40+
tempA41+
tempA42+
tempA43+
tempA44+
tempA45+
tempA46+
tempA47+
tempA48;
end
else
begin
end_send<=1;
cheng_valid<=0;
end
end
end
end
end
assign tempA0=Mulitiply(y0,h0);
assign tempA1=Mulitiply(y1,h1);
assign tempA2=Mulitiply(y2,h2);
assign tempA3=Mulitiply(y3,h3);
assign tempA4=Mulitiply(y4,h4);
assign tempA5=Mulitiply(y5,h5);
assign tempA6=Mulitiply(y6,h6);
assign tempA7=Mulitiply(y7,h7);
assign tempA8=Mulitiply(y8,h8);
assign tempA9=Mulitiply(y9,h9);
assign tempA10=Mulitiply(y10,h10);
assign tempA11=Mulitiply(y11,h11);
assign tempA12=Mulitiply(y12,h12);
assign tempA13=Mulitiply(y13,h13);
assign tempA14=Mulitiply(y14,h14);
assign tempA15=Mulitiply(y15,h15);
assign tempA16=Mulitiply(y16,h16);
assign tempA17=Mulitiply(y17,h17);
assign tempA18=Mulitiply(y18,h18);
assign tempA19=Mulitiply(y19,h19);
assign tempA20=Mulitiply(y20,h20);
assign tempA21=Mulitiply(y21,h21);
assign tempA22=Mulitiply(y22,h22);
assign tempA23=Mulitiply(y23,h23);
assign tempA24=Mulitiply(y24,h24);
assign tempA25=Mulitiply(y25,h25);
assign tempA26=Mulitiply(y26,h26);
assign tempA27=Mulitiply(y27,h27);
assign tempA28=Mulitiply(y28,h28);
assign tempA29=Mulitiply(y29,h29);
assign tempA30=Mulitiply(y30,h30);
assign tempA31=Mulitiply(y31,h31);
assign tempA32=Mulitiply(y32,h32);
assign tempA33=Mulitiply(y33,h33);
assign tempA34=Mulitiply(y34,h34);
assign tempA35=Mulitiply(y35,h35);
assign tempA36=Mulitiply(y36,h36);
assign tempA37=Mulitiply(y37,h37);
assign tempA38=Mulitiply(y38,h38);
assign tempA39=Mulitiply(y39,h39);
assign tempA40=Mulitiply(y40,h40);
assign tempA41=Mulitiply(y41,h41);
assign tempA42=Mulitiply(y42,h42);
assign tempA43=Mulitiply(y43,h43);
assign tempA44=Mulitiply(y44,h44);
assign tempA45=Mulitiply(y45,h45);
assign tempA46=Mulitiply(y46,h46);
assign tempA47=Mulitiply(y47,h47);
assign tempA48=Mulitiply(y48,h48);
always @(posedge mcu_reset or negedge clk_code_eight)
begin
if(mcu_reset==1)
begin
yB48<=2'b0;
yB47<=2'b0;
yB46<=2'b0;
yB45<=2'b0;
yB44<=2'b0;
yB43<=2'b0;
yB42<=2'b0;
yB41<=2'b0;
yB40<=2'b0;
yB39<=2'b0;
yB38<=2'b0;
yB37<=2'b0;
yB36<=2'b0;
yB35<=2'b0;
yB34<=2'b0;
yB33<=2'b0;
yB32<=2'b0;
yB31<=2'b0;
yB30<=2'b0;
yB29<=2'b0;
yB28<=2'b0;
yB27<=2'b0;
yB26<=2'b0;
yB25<=2'b0;
yB24<=2'b0;
yB23<=2'b0;
yB22<=2'b0;
yB21<=2'b0;
yB20<=2'b0;
yB19<=2'b0;
yB18<=2'b0;
yB17<=2'b0;
yB16<=2'b0;
yB15<=2'b0;
yB14<=2'b0;
yB13<=2'b0;
yB12<=2'b0;
yB11<=2'b0;
yB10<=2'b0;
yB9<=2'b0;
yB8<=2'b0;
yB7<=2'b0;
yB6<=2'b0;
yB5<=2'b0;
yB4<=2'b0;
yB3<=2'b0;
yB2<=2'b0;
yB1<=2'b0;
yB0<=2'b0;
Tx_Q<=0;
end
else
begin
yB48<=yB47;
yB47<=yB46;
yB46<=yB45;
yB45<=yB44;
yB44<=yB43;
yB43<=yB42;
yB42<=yB41;
yB41<=yB40;
yB40<=yB39;
yB39<=yB38;
yB38<=yB37;
yB37<=yB36;
yB36<=yB35;
yB35<=yB34;
yB34<=yB33;
yB33<=yB32;
yB32<=yB31;
yB31<=yB30;
yB30<=yB29;
yB29<=yB28;
yB28<=yB27;
yB27<=yB26;
yB26<=yB25;
yB25<=yB24;
yB24<=yB23;
yB23<=yB22;
yB22<=yB21;
yB21<=yB20;
yB20<=yB19;
yB19<=yB18;
yB18<=yB17;
yB17<=yB16;
yB16<=yB15;
yB15<=yB14;
yB14<=yB13;
yB13<=yB12;
yB12<=yB11;
yB11<=yB10;
yB10<=yB9;
yB9<=yB8;
yB8<=yB7;
yB7<=yB6;
yB6<=yB5;
yB5<=yB4;
yB4<=yB3;
yB3<=yB2;
yB2<=yB1;
yB1<=yB0;
yB0<=chong_q_out;
Tx_Q<=tempB0+
tempB1+
tempB2+
tempB3+
tempB4+
tempB5+
tempB6+
tempB7+
tempB8+
tempB9+
tempB10+
tempB11+
tempB12+
tempB13+
tempB14+
tempB15+
tempB16+
tempB17+
tempB18+
tempB19+
tempB20+
tempB21+
tempB22+
tempB23+
tempB24+
tempB25+
tempB26+
tempB27+
tempB28+
tempB29+
tempB30+
tempB31+
tempB32+
tempB33+
tempB34+
tempB35+
tempB36+
tempB37+
tempB38+
tempB39+
tempB40+
tempB41+
tempB42+
tempB43+
tempB44+
tempB45+
tempB46+
tempB47+
tempB48;
end
end
assign tempB0=Mulitiply(yB0,h0);
assign tempB1=Mulitiply(yB1,h1);
assign tempB2=Mulitiply(yB2,h2);
assign tempB3=Mulitiply(yB3,h3);
assign tempB4=Mulitiply(yB4,h4);
assign tempB5=Mulitiply(yB5,h5);
assign tempB6=Mulitiply(yB6,h6);
assign tempB7=Mulitiply(yB7,h7);
assign tempB8=Mulitiply(yB8,h8);
assign tempB9=Mulitiply(yB9,h9);
assign tempB10=Mulitiply(yB10,h10);
assign tempB11=Mulitiply(yB11,h11);
assign tempB12=Mulitiply(yB12,h12);
assign tempB13=Mulitiply(yB13,h13);
assign tempB14=Mulitiply(yB14,h14);
assign tempB15=Mulitiply(yB15,h15);
assign tempB16=Mulitiply(yB16,h16);
assign tempB17=Mulitiply(yB17,h17);
assign tempB18=Mulitiply(yB18,h18);
assign tempB19=Mulitiply(yB19,h19);
assign tempB20=Mulitiply(yB20,h20);
assign tempB21=Mulitiply(yB21,h21);
assign tempB22=Mulitiply(yB22,h22);
assign tempB23=Mulitiply(yB23,h23);
assign tempB24=Mulitiply(yB24,h24);
assign tempB25=Mulitiply(yB25,h25);
assign tempB26=Mulitiply(yB26,h26);
assign tempB27=Mulitiply(yB27,h27);
assign tempB28=Mulitiply(yB28,h28);
assign tempB29=Mulitiply(yB29,h29);
assign tempB30=Mulitiply(yB30,h30);
assign tempB31=Mulitiply(yB31,h31);
assign tempB32=Mulitiply(yB32,h32);
assign tempB33=Mulitiply(yB33,h33);
assign tempB34=Mulitiply(yB34,h34);
assign tempB35=Mulitiply(yB35,h35);
assign tempB36=Mulitiply(yB36,h36);
assign tempB37=Mulitiply(yB37,h37);
assign tempB38=Mulitiply(yB38,h38);
assign tempB39=Mulitiply(yB39,h39);
assign tempB40=Mulitiply(yB40,h40);
assign tempB41=Mulitiply(yB41,h41);
assign tempB42=Mulitiply(yB42,h42);
assign tempB43=Mulitiply(yB43,h43);
assign tempB44=Mulitiply(yB44,h44);
assign tempB45=Mulitiply(yB45,h45);
assign tempB46=Mulitiply(yB46,h46);
assign tempB47=Mulitiply(yB47,h47);
assign tempB48=Mulitiply(yB48,h48);
function [11:0]Mulitiply;
input [1:0] a;
input [11:0] b;
begin
case(a)
2'b00 :Mulitiply=12'b0;
2'b01 :Mulitiply=b;
2'b11: Mulitiply = (b ^ 12'hfff)+1'b1;
default:Mulitiply=16'b0;
endcase
end
endfunction
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -