如果把shifter设置成wire就不可以综合,设置成reg仿真时候就
Illegal output port connection
- module test0(clk, mr, data,out,shifter);
- input clk;
- input data;
- input mr;
- output out;
- output [15:0] shifter;
- reg out;
- reg [4:0] cnt;
- wire [15:0] shifter;
- always @(posedge clk or negedge mr)
- begin
- if (!mr)
- begin
- cnt <= 16'b0;
- out <= 1'b0;
- end
- else if(cnt == 5'd7)
- begin
- out <= ~out;
- cnt <= 5'd0;
- end
- else
- begin
- cnt <= cnt + 5'd1;
- end
- end
- always@(posedge clk)
- begin
- if (!out)
- begin
- shifter[0]<=0;
- shifter[1]<=0;
- shifter[2]<=0;
- shifter[3]<=0;
- shifter[4]<=0;
- shifter[5]<=0;
- shifter[6]<=0;
- shifter[7]<=0;
- shifter[8]<=0;
- shifter[9]<=0;
- shifter[10]<=0;
- shifter[11]<=0;
- shifter[12]<=0;
- shifter[13]<=0;
- shifter[14]<=0;
- shifter[15]<=0;
- end
- else
- begin
- shifter[0]<=data;
- shifter[1]<=shifter[0];
- shifter[2]<=shifter[1];
- shifter[3]<=shifter[2];
- shifter[4]<=shifter[3];
- shifter[5]<=shifter[4];
- shifter[6]<=shifter[5];
- shifter[7]<=shifter[6];
- shifter[8]<=shifter[7];
- shifter[9]<=shifter[8];
- shifter[10]<=shifter[9];
- shifter[11]<=shifter[10];
- shifter[12]<=shifter[11];
- shifter[13]<=shifter[12];
- shifter[14]<=shifter[13];
- shifter[15]<=shifter[14];
- end
- end
- endmodule
复制代码
此帖出自
小平头技术问答
一周热门 更多>