首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

VHDL 程序问题

VHDL 程序问题

if reset='1' and rising_edge(clk) then

if h="001" then
s1<='1'; ------------------s1,s2,s3为信号的
end if;
if h="010" then
s2<='1';
end if;
if h="011" then
s3<='1';
end if; end if;

上面的程序可以实现功能仿真,但是时序仿真s1,s2,s3始终为0,请大家帮我看看是什么原因啊?

补充一下:
模块的引脚定义是这样的:

entity test is
port
(

reset ,clk : in std_logic;

s1,s2,s3 : out std_logic ;
h:in std_logic_vector(2 downto 0)

);
end test;

if reset='1' and rising_edge(clk) then

if h="001" then
s1<='1'; ------------------s1,s2,s3为信号的
end if;
if h="010" then
s2<='1';
end if;
if h="011" then
s3<='1';
end if; end if;

上面的程序可以实现功能仿真,但是时序仿真s1,s2,s3始终为0,请大家帮我看看是什么原因啊?

从程序上看没有问题,你需要reset=1,上升沿并h满足条件时才为1,而且你的if不完整,没有else,所以会生成latch,锁存else的条件。故一旦满足条件对应的s就会为1 了。

这个版主不太冷 =========================== 我的中电网博客:http://blog.chinaecnet.com/u/20/index.htm
学习纯顶

问题解决了 ,谢谢!

现有程序:

if reset='0' then
d1<="000000";
elsif rising_edge(s1) then
d1<=q;

end if;

d1为输出端口,s1,reset,q为输入引脚,进程中就它一个process


可是还有错误:Error (10629): VHDL error at b.vhd(25): can't synthesize logic for statement with conditions that test for the edges of multiple clocks
这是为什么啊

"可是还有错误:Error (10629): VHDL error at b.vhd(25): can't synthesize logic for statement with conditions that test for the edges of multiple clocks图片点击可在新窗口打开查看
这是为什么啊"

你将rising_edge(s1)放在reset=‘0’条件的外面,这相当于将同步信号条件放在外层if中,就可以了。

你这样的设计会让系统产生edges of multiple clocks。

这个版主不太冷 =========================== 我的中电网博客:http://blog.chinaecnet.com/u/20/index.htm
你要问就把完整程序发出来了.
真诚让沟通更简单! QQ:767914192
7楼说的不是原因吧,它原来是异步复位,你改动后变成了同步复位,要把完整的程序发出来才能分析吧!!!!!

恩,我觉得程序的外围应该还有一个同步信号的上升沿驱动,不然不会有edges of multiple clocks的警告。

而我在7楼的回复的意思是使用同步信号可以减少系统的误解,因为如果在

的程序中,如果其触发条件为@(posedge reset or posedge s1)的话,reset从0变到1就会比系统综合为另一个时钟,也会有edges of multiple clocks的警告。

这个版主不太冷 =========================== 我的中电网博客:http://blog.chinaecnet.com/u/20/index.htm
返回列表