acgoal的个人空间 https://blog.eetop.cn/553746 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

EETOP论坛发现和回复的问题集锦2011/03/08/04

已有 1647 次阅读| 2011-3-8 21:40 |个人分类:经验集锦

问题:

一段很简单的两级flop代码,用quartus转的

这是quartus转的verilog代码
// Copyright (C) 1991-2009 Altera Corporation
// Your use of Altera Corporation's design tools, logic functions
// and other software and tools, and its AMPP partner logic
// functions, and any output files from any of the foregoing
// (including device programming or simulation files), and any
// associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License
// Subscription Agreement, Altera MegaCore Function License
// Agreement, or other applicable license agreement, including,
// without limitation, that your use is for the sole purpose of
// programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors.  Please refer to the
// applicable agreement for further details.
// PROGRAM  "Quartus II"
// VERSION  "Version 9.1 Build 222 10/21/2009 SJ Full Version"
// CREATED  "Tue Mar 08 17:59:23 2011"
module gg(
in,
clk,
reset,
out,
cd
);

input in;
input clk;
input reset;
output out;
reg out;
output cd;
reg cd_ALTERA_SYNTHESIZED;
reg DFF_inst;


always@(posedge clk or negedge reset)
begin
if (!reset)
begin
DFF_inst = 0;
end
else
begin
DFF_inst = in;
end
end

always@(posedge clk or negedge reset)
begin
if (!reset)
begin
cd_ALTERA_SYNTHESIZED = 0;
end
else
begin
cd_ALTERA_SYNTHESIZED = DFF_inst;
end
end

always@(posedge clk or negedge reset)
begin
if (!reset)
begin
out = 0;
end
else
begin
out = cd_ALTERA_SYNTHESIZED;
end
end
assign cd = cd_ALTERA_SYNTHESIZED;
endmodule
没看出quartus转的verilog有什么问题啊。

用modelsim仿真的结果出问题,仿真发现只有一级flop

 

我的解答:

quartus转化的代码有问题,在时序逻辑描述(本例中是@(posedge clk)),这样的描述里面应该用非阻塞赋值,你看你自己写的都是非阻塞赋值的。
Quartus转化的Verilog代码或许综合后和你quartus绘制的block图功能一致,但是仿真的时候会导致不一样的结果。

这个问题就是我们在设计中经常说的“simulation mismatch with synthesis",也就是说,仿真器和综合器对这种verilog语句的解释原理不一样,会导致解释出来的结果不一样,所以仿真和综合的结果不一样。因为我们都是通过仿真来模拟模块功能的,如果仿真和综合的结果不一样,那么仿真就无效,这样可能会导致非常严重的设计问题。所以综上所述,这种verilog代码在设计千万不要使用。

你列出的这个问题是quartus工具的问题,quartus作为FPGA公司,其软件可能有一些不好的地方,我们需要掌握verilog和集成电路设计的基础知识,在使用它的工具后,自己要能发现,辨明,修复这些存在问题的地方。

 

我的评论:请大家在写verilog代码的时候一定要避免simulation和synthesis不一样的情况出现。学好verilog和集成电路设计基础。

注1:如果各位觉得我包含在自己日志里面对您不妥,或者涉及隐私的话,请告知我,我删除。

注2:问题的解答我只列举我自己的想法,不保证可以一直追踪到真正正确的解答,所以请如果有看客的话,解答仅作参考之用,也欢迎大家在blog里留言评论。


点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 0

    获赞
  • 20

    评论
  • 2997

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-22 23:52 , Processed in 0.014967 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部