菜鸟求助,verilog综合问题,十万火急
begin
if(done)
max_buff <= max;
else
max_buff <= 0;
end
错误显示: ERROR:Xst:899 -: The logic for <max_buff> does not match a known FF or Latch template.
查了不少资料,也不知道该怎么改,还请各位高手帮忙,小弟在此多谢了
在使用XST对设计进行综合的时候,多次出现下列错误:
"ERROR:Xst:899 - "file_name", line #: The logic for "net_name" does not match a known FF or Latch template"
其实这与编码风格有关,在写代码的时候,不光要考虑逻辑的正确性,还要清楚其硬件可实现性,这样,即使综合工具弱点也不至于影响设计本身。
下文是对上诉错误的解决办法:
General Description:
What type of clock statements does XST support?
XST does not support the use of a complex condition check inside an always block in Verilog. For example, the following code results in the error below:
always @( negedge input1 or negedge input2 or posedge clock )
begin
if ( ~input1 | ~input2 )
begin
output1 <= 1'b1;
output2 <= 1'b0;
end
else
begin
output1 <= input1;
output2 <= input2 & input1;
end
end
"ERROR:Xst:899 - "file_name", line #: The logic for "net_name" does not match a known FF or Latch template."
When you infer hardware from HDL, it is important to keep the type of hardware you want in mind. The XST User Guide contains basic templates for the various types of FPGA/CPLD hardware that can be inferred with HDL code:
If your HDL code is modeled after the templates provided, you should be able to infer the desired hardware.
解决方案 1:
To avoid this error, perform the combinatorial logic outside the always block to remove the complex clock statement from the sensitivity list, and then use that intermediate signal in the sensitivity list of the always block, as follows:
assign temp = ~input1 | ~input2;
always @( posedge temp or posedge clock )
begin
if ( temp )
begin
output1 <= 1'b1;
output2 <= 1'b0;
end
else
begin
output1 <= input1;
output2 <= input2 & input1;
end
end
解决方案 2:
Another situation that causes this error (which is unrelated to the first example) is when the reset function in the always block has no effect on the register that will be inferred:
module misc(clk,rst,in1,out1);
input clk,rst,in1;
output[1:0] out1;
reg[1:0] out1;
always @(posedge clk or posedge rst)
begin
if (rst)
out1[1] = in1;
else
out1 = {in1,in1};
end
endmodule
change to:
module misc(clk,rst,in1,out1);
input clk,rst,in1;
output[1:0] out1;
reg[1:0] out1;
always @(posedge clk or posedge rst)
begin
if (rst)
out1[1] = 0;
else
out1 = {in1,in1};
end
endmodule
解决方案 3:
The error message also appears when a dual-edge triggered FF is inferred in any device other than a CoolRunner-II. The CoolRunner-II is the only Xilinx device that contains dual-edge triggered FFs:
:
always @(posedge clk or negedge clk)
:
//-----------------------end-----------------------
多谢~ 这篇文章我也看过
但按照他说的方法 把触发条件改为两个 但还是不行 哎
always@(posedge clk or negedge rst or posedge act)
一定是这句话有问题,你想,哪有flop能够有3个边沿触发的呢?ASIC方面很少的。FPGA也很少有这种的。
你应该学一下D触发器结构的,莫非是半路出家?
在standard cell library中很少有两个边沿触发的dff 或者latch,一般都是clk边缘触发,其他都是电平触发。
所以dc综合工具找不到对应的cell去map
这样写法工具无法确定三个边沿信号哪个是时钟,三个都是按时钟对待,而库里没有带三个时钟的触发器的
always@(posedge clk or negedge rst or posedge act) 这句话本身来说没有什么问题的,你这么写了,如果你下面写对了,就会综合出一个带置位和复位的D触发器。
错误的关键是小编在always的敏感列表里面给出的是边沿触发的触发器,但下面并没有描述这个触发器的正常工作方式。其实我们应该明白:
(1)如果敏感列表没有posedge或negedge,综合出的就是组合逻辑的东西,
(2)如果有一个边沿事件,就会综合出一个没有异步复位或异步置位的D触发器;
(3)如果写了两个边沿事件,其实只是综合出一个带有异步复位或异步置位的D触发器,DC目前不支持多时钟的触发器的。
(4)如果有三个边沿事件,其实就是综合出带复位和置位的D触发器。
但小编写的代码似乎想要一个多时钟触发的D触发器,显然不可能的,虽然有多边沿触发的触发器,但不是用一个always块描述出来的。
楼上说的很有道理,顶一下!
assign Clk_=clk | act | (~ rst);
always@(posedge Clk_ )
begin
if(done)
max_buff <= max;
else
max_buff <= 0;
end
学C语言出身的?我刚开始写verilog时也类似这样的风格,被师傅狠批
该看看书
学习了……
我想知道你的act信号是什么信号?、
系统信号还是你自己随机产生的?
DDDDDDDDDD
楼上说的有道理 赞一下
请问一下小编,这种异步清零异步置位的D触发器,在FPGA或DC时,该怎么处理呢?我是入行不久,第一次碰到。谢谢了!
过来学习一下
