我在单独的文件中有以下模块。当我尝试运行我的RC_ADD_SUB_32模块时,我得到错误实例化' inst'失败。区域:/ RC_ADD_SUB_32_TB / obj / rc_gen_loop [0] / FULL_ADDER未找到设计单元。加载设计时出错。 实例化Full Adder在生成块中不起作用。我在rc_add_sub_32.v文件中实例化Full Adder时遇到问题。有什么想法吗?
full_adder.v
module FULL_ADDER(S,CO,A,B, CI);
output S,CO;
input A,B, CI;
wire HF_1_Y, HF_1_C, HF_2_C; //Half Adder 1 Y, Half Adder 1 C and Half Adder 2 C
HALF_ADDER inst_01 (.A(A), .B(B), .Y(HF_1_Y), .C(HF_1_C));
HALF_ADDER inst_02 (.A(HF_1_Y), .B(CI), .Y(S), .C(HF_2_C));
or inst_03(CO, HF_2_C, HF_1_C);
endmodule;
rc_add_sub_32.v
module RC_ADD_SUB_32(Y, CO, A, B, SnA);
// output list
//output [63:0] Y;
output [`DATA_INDEX_LIMIT:0] Y; //Our result
output CO;
// input list
//input [63:0] A;
//input [63:0] B;
input [`DATA_INDEX_LIMIT:0] A;
input [`DATA_INDEX_LIMIT:0] B;
input SnA;
//full adder -> full adder connection
wire [`DATA_INDEX_LIMIT:0] CO_TO_CI;
wire [`DATA_INDEX_LIMIT:0] XOR_OUT;
genvar i;
generate
for(i=0; i<32; i=i+1)
begin: rc_gen_loop
/*
Cases:
Index 0: CI is SnA CO -> CI[1]
Index 31: CI is CO from index 30, CO is output CO,
Index 1-30: CI is from previous CO, CO points to next CI
*/
xor xors(XOR_OUT[i], SnA, B[i]);
if(i==0)
begin:
FULL_ADDER inst(.S(Y[i]), .CO(CO_TO_CI[i]), .A(A[i]), .B(XOR_OUT[i]), .CI(SnA));
end
else if(i==31)
begin:
FULL_ADDER inst(.S(Y[i]), .CO(CO), .A(A[i]), .B(XOR_OUT[i]), .CI(CO_TO_CI[i-1]));
end
else if(i!=31 && i!=0)
begin:
FULL_ADDER inst(.S(Y[i]), .CO(CO_TO_CI[i]), .A(A[i]), .B(XOR_OUT[i]), .CI(CO_TO_CI[i-1]));
end
end
endgenerate
endmodule
testbench文件rc_add_sub_tb.v
module RC_ADD_SUB_32_TB;
reg [`DATA_INDEX_LIMIT:0] A;
reg [`DATA_INDEX_LIMIT:0] B;
reg SnA;
wire [`DATA_INDEX_LIMIT:0] Y;
wire CO;
RC_ADD_SUB_32 obj(Y, CO, A, B, SnA);
initial
begin
#5 A = 0; B= 0; SnA = 0;
#5 A = 0; B= 0; SnA = 1;
#5 A = 0; B= 1; SnA = 0;
#5 A = 0; B= 1; SnA = 1;
#5 A = 1; B= 0; SnA = 0;
#5 A = 1; B= 0; SnA = 1;
#5 A = 1; B= 1; SnA = 0;
#5 A = 1; B= 1; SnA = 1;
#5;
end
endmodule
答案 0 :(得分:0)
条件语句的<html>
<head>
<style>
#logo img {
width: 120px;
margin-top: 20px;
margin-left:350px;
}
#footer img {
width: 450px;
margin-top: 20px;
margin-left:250px;
}
#girl img {
width: 450px;
margin-top: 20px;
margin-left:200px;
}
#follow_us img {
width: 250px;
margin-top: 20px;
margin-left:300px;
}
img.NICE {
position: absolute;
left: 200px;
top: 0px;
z-index: -1;
}
body, div, dl, dt, dd, h1, h2, h3, h4, h5, h6, p, pre, code, blockquote {
margin:0;
padding:0;
border-width:0;
}
body {
-epub-hyphens:auto;
}
div.Basic-Text-Frame {
border-style:solid;
}
p.Basic-Paragraph {
color:#000000;
font-family:"Minion Pro", serif;
font-size:12px;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:1.2;
margin-bottom:0;
margin-left:0;
margin-right:0;
margin-top:0;
orphans:1;
page-break-after:auto;
page-break-before:auto;
text-align:left;
text-decoration:none;
text-indent:0;
text-transform:none;
widows:1;
}
p.ParaOverride-1 {
text-align:justify;
text-align-last:center;
}
span.CharOverride-1 {
color:#525358;
font-family:Raleway, sans-serif;
font-size:16px;
font-style:normal;
font-weight:200;
}
span.CharOverride-2 {
font-family:Raleway, sans-serif;
font-size:16px;
font-style:normal;
font-weight:200;
}
span.CharOverride-3 {
color:#98c3d0;
font-family:Raleway, sans-serif;
font-size:16px;
font-style:normal;
font-weight:200;
}
span.CharOverride-4 {
color:#f9a05d;
font-family:Raleway, sans-serif;
font-size:16px;
font-style:normal;
font-weight:200;
}
span.CharOverride-5 {
color:#31373c;
font-family:Raleway, sans-serif;
font-size:8px;
font-style:normal;
font-weight:normal;
}
span.CharOverride-6 {
font-family:Raleway, sans-serif;
font-size:8px;
font-style:normal;
font-weight:normal;
}
span.CharOverride-7 {
color:#525358;
font-family:Raleway, sans-serif;
font-size:9px;
font-style:normal;
font-weight:600;
}
a.button {
background: url(http://i.imgur.com/tnWFc1M.png) 1px 5px no-repeat;
background-size: 100px 20px;
border: none;
color: white;
padding: 25px 35px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 6px;
margin: 9px 300px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
a.button1 {
background: url(http://i.imgur.com/Dh3VnPe.png) 2px 6px no-repeat;
background-size: 101px 22px;
border: none;
color: white;
padding: 25px 40px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 6px;
margin: -65px 400px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
</style>
</head>
<div id="logo_info">
<p id="logo"><img src="http://i.imgur.com/aukUVxR.png" alt="Bethan Rainforth a comedic dancer">
</p>
</div>
<body id="TEXT" lang="en-US">
<div id="_idContainer000" class="Basic-Text-Frame">
<div id="header">
<hr>
</div>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-1">our</span><span class="CharOverride-2"> </span><span class="CharOverride-3">name</span><span class="CharOverride-2"> </span><span class="CharOverride-1">is our</span><span class="CharOverride-2"> </span><span class="CharOverride-4">mission</span></p>
</div>
<div id="_idContainer001" class="Basic-Text-Frame">
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">We are a non-profit organization, founded by a medical doctor and eye surgeon. </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">Our mission is to help people access vision care more effectively and conveniently. </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">We prioritize low-income children and members of underserved communities by </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">delivering eyecare for free to pre-schools, after-school programs, community centers </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">and events. We also extend our services to individuals who are able to pay for </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">exceptional eyecare delivered with the ease and convenience of services like Uber </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">and Lyft. We will come to you and provide unprecedented levels of access to doctors. </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">Being a non-profit organization, money collected helps us increase awareness of health </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-5">and education and provide free services to those who otherwise cannot afford it. </span><span class="CharOverride-6"> </span></p>
<p class="Basic-Paragraph ParaOverride-1"><span class="CharOverride-7">To schedule an exam, please select from the following:</span></p>
</div>
<div id="buttonsz">
<a href="http://www.willgrantvision.com" class="button">Go to WillGrant</a>
<a href="http://www.willgrantvision.com" class="button1">Go to WillGrant</a>
</div>
<hr>
<div id="header">
<p id="girl"> <img src="http://i.imgur.com/ac4JwDA.png" alt="Bethan Rainforth a comedic dancer">
<p id="girl"> <img src="http://i.imgur.com/FXF5Ysh.png" alt="Bethan Rainforth a comedic dancer">
</p>
<p id="follow_us"> <img src="http://i.imgur.com/ZU53otY.png" alt="Bethan Rainforth a comedic dancer">
</p>
</div>
</body>
</html>
没有标签。因此,模拟器将其视为空白标签或换行并将FULL_ADDER作为标签名称。两者都是非法的。添加标签(首选)或摆脱结肠。
仅供参考,begin:
是不必要的,因为条件是在先前条件中捕获的。
标签示例:
if(i!=31 && i!=0)
或没有标签:
if(i==0)
begin: gen_first
FULL_ADDER inst(.S(Y[i]), .CO(CO_TO_CI[i]), .A(A[i]), .B(XOR_OUT[i]), .CI(SnA));
end
else if(i==31)
begin: gen_last
FULL_ADDER inst(.S(Y[i]), .CO(CO), .A(A[i]), .B(XOR_OUT[i]), .CI(CO_TO_CI[i-1]));
end
else
begin: gen_middle
FULL_ADDER inst(.S(Y[i]), .CO(CO_TO_CI[i]), .A(A[i]), .B(XOR_OUT[i]), .CI(CO_TO_CI[i-1]));
end