运行 执行错误。是我编码错了吗?
run Implementation error. it's my coding wrong?
我在vivado 2018.2运行实现运行时出现错误
这是错误详细信息:
[地点30-494]设计为空
解决方案:检查 opt_design 是否已删除设计中的所有叶单元。检查您是否已经实例化并连接了所有顶级端口。
[Common 17-69] 命令失败:Placer 无法放置所有实例
我的代码如下:
`timescale 1ns/1ns
module fa_seq(a, b, cin, sum, cout);
input a, b, cin;
output reg sum, cout;
reg t1, t2, t3;
always
@(a or b or cin) begin
sum <= (a ^ b & cin);
t1 = a & cin;
t2 = b & cin;
t3 = a & b;
cout = (t1 | t2) | t3;
end
endmodule
module fa_top;
reg pa, pb, pci;
wire pco, psum;
fa_seq uf1(pa, pb, pci, psum, pco);
initial
begin: blk_only_once
reg[3:0] pal;
for(pal = 0; pal < 8; pal = pal + 1)
begin
{pa,pb,pci} <= pal;
#5 $display("pa,pb,pci = %b%b%b",pa,pb,pci,":::pco,psum=%b%b",pco,psum);
end
end
endmodule
感谢您的回答。
Check whether you have instantiated and connected all of the top level ports.
看起来您综合了您的实际设计和您的测试台。
测试台是顶层模块,没有端口,因此所有逻辑都被优化掉了。
您应该将您的设计拆分为包含 RTL 的文件和包含 test-bench/simulation 代码的文件。在 Vivado 中,如果你 'add a file' 这里是一个屏幕截图,你必须指定它是什么类型:
您的代码已推断出锁存器。此外,您在同一个 always 块中同时使用了阻塞和非阻塞赋值。
always
@(a or b or cin) begin //Not all dependencies are mentioned
sum <= (a ^ b & cin); //Non-blocking assignment
t1 = a & cin;
t2 = b & cin;
t3 = a & b;
cout = (t1 | t2) | t3;
end
我建议您重新编写 always 块,如下所示。
always
@(*) begin
sum = (a ^ b & cin);
t1 = a & cin;
t2 = b & cin;
t3 = a & b;
cout = (t1 | t2) | t3;
end
实际上,对于上述组合逻辑,您不需要 always 块。只需使用赋值语句。
module fa_seq(a, b, cin, sum, cout);
input a, b, cin;
output sum, cout;
wire t1, t2, t3;
assign sum = (a ^ b & cin);
assign t1 = a & cin;
assign t2 = b & cin;
assign t3 = a & b;
assign cout = (t1 | t2) | t3;
endmodule
然而,编写全加器代码的有效方法是:-
module fa_seq(a, b, cin, sum, cout);
input a, b, cin;
output sum, cout;
assign {cout,sum} = (a + b + cin);
endmodule
我在vivado 2018.2运行实现运行时出现错误
这是错误详细信息:
[地点30-494]设计为空 解决方案:检查 opt_design 是否已删除设计中的所有叶单元。检查您是否已经实例化并连接了所有顶级端口。 [Common 17-69] 命令失败:Placer 无法放置所有实例
我的代码如下:
`timescale 1ns/1ns
module fa_seq(a, b, cin, sum, cout);
input a, b, cin;
output reg sum, cout;
reg t1, t2, t3;
always
@(a or b or cin) begin
sum <= (a ^ b & cin);
t1 = a & cin;
t2 = b & cin;
t3 = a & b;
cout = (t1 | t2) | t3;
end
endmodule
module fa_top;
reg pa, pb, pci;
wire pco, psum;
fa_seq uf1(pa, pb, pci, psum, pco);
initial
begin: blk_only_once
reg[3:0] pal;
for(pal = 0; pal < 8; pal = pal + 1)
begin
{pa,pb,pci} <= pal;
#5 $display("pa,pb,pci = %b%b%b",pa,pb,pci,":::pco,psum=%b%b",pco,psum);
end
end
endmodule
感谢您的回答。
Check whether you have instantiated and connected all of the top level ports.
看起来您综合了您的实际设计和您的测试台。 测试台是顶层模块,没有端口,因此所有逻辑都被优化掉了。
您应该将您的设计拆分为包含 RTL 的文件和包含 test-bench/simulation 代码的文件。在 Vivado 中,如果你 'add a file' 这里是一个屏幕截图,你必须指定它是什么类型:
您的代码已推断出锁存器。此外,您在同一个 always 块中同时使用了阻塞和非阻塞赋值。
always
@(a or b or cin) begin //Not all dependencies are mentioned
sum <= (a ^ b & cin); //Non-blocking assignment
t1 = a & cin;
t2 = b & cin;
t3 = a & b;
cout = (t1 | t2) | t3;
end
我建议您重新编写 always 块,如下所示。
always
@(*) begin
sum = (a ^ b & cin);
t1 = a & cin;
t2 = b & cin;
t3 = a & b;
cout = (t1 | t2) | t3;
end
实际上,对于上述组合逻辑,您不需要 always 块。只需使用赋值语句。
module fa_seq(a, b, cin, sum, cout);
input a, b, cin;
output sum, cout;
wire t1, t2, t3;
assign sum = (a ^ b & cin);
assign t1 = a & cin;
assign t2 = b & cin;
assign t3 = a & b;
assign cout = (t1 | t2) | t3;
endmodule
然而,编写全加器代码的有效方法是:-
module fa_seq(a, b, cin, sum, cout);
input a, b, cin;
output sum, cout;
assign {cout,sum} = (a + b + cin);
endmodule