2016-10-27 2 views
-1

これらはシングルサイクルプロセッサのさまざまな部分のコードですが、インスタンス生成で次の警告が表示されます。このミスはそれほど頻繁にVerilogのポートサイズエラー:[PCDPC] - ポートサイズがポートの接続サイズ(1)と一致しません

module reg_file(reg_addr_1,reg_addr_2,write_en,RD1,RD2,write_data,reg_addr_1,reg_addr_2,clk,wr_addr); 
input clk; 
input[3:0] reg_addr_1,reg_addr_2; 
input [3:0] wr_addr; 
input [15:0]write_data; 
input write_en; 
output [15:0]RD1,RD2; 
reg [15:0]rgs[0:15]; 

assign RD1=rgs[reg_addr_1]; 
assign R22=rgs[reg_addr_2]; 

[email protected](posedge clk) 
begin 
if(write_en) 
rgs[wr_addr] <= write_data; 
end 
endmodule 





module alu(cout,alu_output,input1,input2,alu_sel); 
input [15:0]input1,input2; 
input [3:0]alu_sel; 
output [15:0]alu_output; 
output cout; 
reg [15:0]alu_output; 
reg cout; 
[email protected](input1,input2,alu_sel) 
begin 
case(alu_sel) 
4'b0000 : {cout,alu_output}=input1+input2; 
4'b0001 : {cout,alu_output}=input1-input2; 
4'b0010 : alu_output=input2-1; 
4'b0011 : alu_output=input1*input2; 
4'b0100 : alu_output=input1&&input2; 
4'b0101 : alu_output=input1||input2; 
4'b0110 : alu_output= !input1; 
4'b0111 : alu_output=~input1; 
4'b1000 : alu_output=input1&input2; 
4'b1001 : alu_output=input1|input2; 
4'b1010 : alu_output=input1^input2; 
4'b1011 : alu_output=input1<<1; 
4'b1100 : alu_output=input1>>1; 
4'b1101 : alu_output=input1+1; 
4'b1110 : alu_output=input1-1; 
4'b1111 : alu_output=input2<<1; 
endcase 
end 
endmodule 




module reg_alu(clk,out); 
input clk; 
output [15:0] out; 

alu a1(cout,out,RD1,RD2,alu_sel); 
reg_file a2(reg_addr_1,reg_addr_2,write_en,RD1,RD2,alu_output,reg_addr_1,reg_addr_2,clk,wr_addr); 
endmodule 






module tb_aaaa; 
reg clk; 
wire alu_output; 
wire [15:0]out; 
reg write_en; 
reg [15:0]input1,input2; 
reg [3:0]alu_sel; 
reg_alu tb_aaaa(clk,out); 
initial 
begin 
#10 clk=1'b1;write_en=1'b0;input1=16'b0000000101010101;input2=16'b0000000000111111;alu_sel=4'b0010; 
#10 clk=1'b0;write_en=1'b1;input2=16'b0000000101010101;input2=16'b0000000000111100;alu_sel=4'b0011; 
end 
initial begin 
$monitor($time,"clk,out,write_data",clk,out); 
end 
initial 
begin 
#300 $stop; 
end 
endmodule 

を発生するので、親切にこの間違いを見つけることに私を助けて、これらは、私は、コンパイラ

 ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(5): [PCDPC] - Port size (16 or 16) does not match connection size (1) for port 'input1'. 
    #   Region: /tb_aaaa/tb_aaaa/a1 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(5): [PCDPC] - Port size (16 or 16) does not match connection size (1) for port 'input2'. 
    #   Region: /tb_aaaa/tb_aaaa/a1 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(5): [PCDPC] - Port size (4 or 4) does not match connection size (1) for port 'alu_sel'. 
    #   Region: /tb_aaaa/tb_aaaa/a1 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (4 or 4) does not match connection size (1) for port 'reg_addr_1'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (4 or 4) does not match connection size (1) for port 'reg_addr_2'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (16 or 16) does not match connection size (1) for port 'RD1'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (16 or 16) does not match connection size (1) for port 'RD2'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (16 or 16) does not match connection size (1) for port 'write_data'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (4 or 4) does not match connection size (1) for port 'reg_addr_1'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (4 or 4) does not match connection size (1) for port 'reg_addr_2'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 
    # ** Warning: (vsim-3015) C:/Users/Saeed/Desktop/project/reg_alu.v(6): [PCDPC] - Port size (4 or 4) does not match connection size (1) for port 'wr_addr'. 
    #   Region: /tb_aaaa/tb_aaaa/a2 

答えて

0

から取得しています警告しているあなたの問題の一つは、あなたがそれらの幅を宣言せずにワイヤーを使用していることです。 Verilogは、ポート接続で名前を宣言せずに名前を使用すると、1ビットの配線であるとみなしてしまうと厄介な動作をします。人々がゲートレベルの記述をしていて、ほとんどの配線が1ビットでしたが、RTLではそうではありませんでした。この指示を各ファイルの冒頭に置いてください

`default_nettype none 
+0

ありがとうございました。実際には私はすでに重大な間違いを発見しました。私はRD1とRD2をワイヤーと宣言していなかったので、ワイヤーとしてaluに出力として送られました。そして、私は実際に私の論理のために残っている警告に取り組んでいます。あなたの返信を高く感謝します。もう一度おねがいします。乾杯 – Saeed95

関連する問題