在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2476|回复: 5

[求助] modelsim仿真出错了

[复制链接]
发表于 2011-3-8 18:47:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
untitled.bmp
这是quartus中的block图,我把它转为verilog在modelsim中仿真,结果却不对,如下图所示
untitled2.bmp
但是我自己写的verilog程序dff_3仿真就正确
module dff_3(in,clk,reset,out,cd);
input in;
input clk;
input reset;
output out;
reg out;
output reg cd;
reg out1;
always @(posedge clk or negedge reset)
  if(!reset)
    begin
      out1<=0;
      cd<=0;
      out<=0;
  end
else
    begin
     out1<=in;
      cd<=out1;
      out<=cd;
    end
endmodule
这是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有什么问题啊。。
发表于 2011-3-8 20:37:53 | 显示全部楼层
quartus转化的代码有问题,在时序逻辑描述(本例中是@(posedge clk)),这样的描述里面应该用非阻塞赋值,你看你自己写的都是非阻塞赋值的。
Quartus转化的Verilog代码或许综合后和你quartus绘制的block图功能一致,但是仿真的时候会导致不一样的结果。

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

你列出的这个问题是quartus工具的问题,quartus作为FPGA公司,其软件可能有一些不好的地方,我们需要掌握verilog和集成电路设计的基础知识,在使用它的工具后,自己要能发现,辨明,修复这些存在问题的地方。
发表于 2011-3-17 19:23:41 | 显示全部楼层
没看出来什么问题     非阻塞语句才会产生移位
发表于 2011-3-17 22:12:22 | 显示全部楼层
希望高手指点一下
发表于 2011-3-17 22:39:33 | 显示全部楼层
按时序仿真的理解好像这个仿真结果是对的
发表于 2011-3-18 15:54:34 | 显示全部楼层
你的代码能不能搞点缩进啊!看着头大!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2024-6-29 08:38 , Processed in 0.158512 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表