testboth.v

来自「verilog编写的16qam调制程序」· Verilog 代码 · 共 36 行

V
36
字号
module testboth(clk, nrst, inbit,i);
    input	clk,nrst,inbit;		
    wire[3:0] inbit;
    output[10:0] i	;		// 8-bit output

    		// ROM address
 
    wire[7:0]	d1,d2;
    reg[10:0] i;	
	sine2	i1(.clk(clk), .nrst(nrst),.doutsin(d2));
	cos2    q1(.clk(clk), .nrst(nrst),.doutcos(d1));
	always @(posedge clk)
	if(!nrst)
	i<=0;
	else
	begin
    case(inbit)//00:-3;01:-1;11:+1;10:+3;
    4'b0000:i=-(d1+d1+d1+d2+d2+d2-768);
    4'b0001:i=-(d1+d1+d1-384)-(d2-128);
    4'b0010:i=-(d1+d1+d1-384)+(d2+d2+d2-384);
    4'b0011:i=-(d1+d1+d1-384)+(d2-128);
    4'b0100:i=-(d1-128)-(d2+d2+d2-384);
    4'b0101:i=-(d1-128)-(d2-128);
    4'b0110:i=-(d1-128)+(d2+d2+d2-384);
    4'b0111:i=-(d1-128)+(d2-128);
    4'b1000:i=(d1+d1+d1-384)-(d2+d2+d2-384);
    4'b1001:i=(d1+d1+d1-384)-(d2-128);
    4'b1010:i=(d1+d1+d1-384)+(d2+d2+d2-384);
    4'b1011:i=(d1+d1+d1-384)+(d2-128);
    4'b1100:i=(d1-128)-(d2+d2+d2-384);
    4'b1101:i=(d1-128)-(d2-128);
    4'b1110:i=(d1-128)+(d2+d2+d2-384);
    4'b1111:i=(d1-128)+(d2-128);
    endcase
    end
    endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?