功能仿真和时序仿真怎么不一样呢?
时间:10-02
整理:3721RD
点击:
很短的一个计数分频程序:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity fenpin is
port(
clk:in std_logic; --12M时钟信号
clk_scanut std_logic
);
end;
architecture abc of fenpin is
signal cnt:integer range 0 to 30;
begin
process(clk)
begin
if(rising_edge(clk))then
if(cnt=cnt'high)then
cnt<=0;
else
cnt<=cnt+1;
end if;
end if;
end process;
process(cnt,clk)
begin
if(rising_edge(clk))then
if(cnt>=cnt'high/2)then
clk_scan<='1';
else
clk_scan<='0';
end if;
end if;
end process;
end;
=====================================================
不知道程序有没有问题?我做功能仿真的时候能够看到cnt信号,但是做时序仿真的时候就没有了。怎么回事呢?
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity fenpin is
port(
clk:in std_logic; --12M时钟信号
clk_scanut std_logic
);
end;
architecture abc of fenpin is
signal cnt:integer range 0 to 30;
begin
process(clk)
begin
if(rising_edge(clk))then
if(cnt=cnt'high)then
cnt<=0;
else
cnt<=cnt+1;
end if;
end if;
end process;
process(cnt,clk)
begin
if(rising_edge(clk))then
if(cnt>=cnt'high/2)then
clk_scan<='1';
else
clk_scan<='0';
end if;
end if;
end process;
end;
=====================================================
不知道程序有没有问题?我做功能仿真的时候能够看到cnt信号,但是做时序仿真的时候就没有了。怎么回事呢?
Testbench中是否没有为cnt赋初始值?
建议引入全局复位信号,为cnt赋初值。
同意楼上的看法。
好的·我试试·
你是说在程序中加一段赋初始值的程序,还是在波形文件中对cnt赋值啊?
欧,原来如此。
建议使用Testbench,用辅助仿真的工具会有很多功能不好实现的。
新手··还不懂什么是testbench
是因为时序仿真时一些信号会被解释成连接线,被工具优化掉了吗?
lz请教一下你那个代码里面的cnt‘high是什么意思? 我是初学者!麻烦讲解
