写的是一个十进制转六进制,再转成8421码的代码,但是仿真时出现了,# ** Error: G:/FPGA/test/work_1_3/Convert_6BCD_tb.v(23): (vopt-2135) Too many port connections. Expected 2, found 4.
#
# Optimization failed
# Error loading design
这个问题,端口太多是哪里的端口太多,实在搞不懂,百度也百度不到问题,请各位帮帮忙,代码如下
- `timescale 1ns / 1ns
- module Convert_6BCD(numInput, numOutput);
- input [2:0] numInput;
- output [11:0] numOutput;
- reg [2:0] munsix;
- reg [11:0] numOutput;
- reg [1:0] tempi;
- always@(numInput)
- begin
- munsix[0]<=numInput[0]%6;
- munsix[1]<=(numInput[0]/6)%6;
- munsix[2]<=((numInput[0]/6)/6)%6;
- end
- always@(numInput)
- begin
- #10 numOutput[0]<=munsix[0]%2;
- #10 numOutput[1]<=(munsix[0]/2)%2;
- #10 numOutput[2]<=((munsix[0]/2)/2)%2;
- #10 numOutput[3]<=(((munsix[0]/2)/2)/2)%2;
- #10 numOutput[4]<=munsix[1]%2;
- #10 numOutput[5]<=(munsix[1]/2)%2;
- #10 numOutput[6]<=((munsix[1]/2)/2)%2;
- #10 numOutput[7]<=(((munsix[1]/2)/2)/2)%2;
- #10 numOutput[8]<=munsix[2]%2;
- #10 numOutput[9]<=(munsix[2]/2)%2;
- #10 numOutput[10]<=((munsix[2]/2)/2)%2;
- #10 numOutput[11]<=(((munsix[2]/2)/2)/2)%2;
- end
- endmodule
复制代码- `timescale 1ns / 1ns
- module Convert_6BCD_tb;
- reg [2:0] numInput;
- reg [2:0] munsix;
- wire [11:0] numOutput;
- reg [1:0] tempi;
- initial
- begin
- numInput=3'd0;
- munsix=3'd0;
- for(tempi=2'd1;tempi<11;tempi=tempi+1)
- #10 numInput={$random}%100;
- end
- Convert_6BCD dut
- (
- .numInput (numInput),
- .munsix (munsix),
- .numOutput (numOutput),
- .tempi (tempi)
- );
- endmodule
复制代码
input [2:0] numInput;
output [11:0] numOutput;
输入输出一共两个
例化的时候
Convert_6BCD dut
(
.numInput (numInput),
.munsix (munsix),
.numOutput (numOutput),
.tempi (tempi)
);
用到了四个
所以会有Expected 2, found 4. 这个错误。
最佳答案
一周热门 更多>