Board logo

标题: VHDL 程序问题 [打印本页]

作者: 满天星    时间: 2007-11-22 10:47     标题: 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,请大家帮我看看是什么原因啊?


作者: 满天星    时间: 2007-11-22 10:59

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

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;

作者: caopengly    时间: 2007-11-22 11:49

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 了。


作者: zhuang305    时间: 2007-11-22 14:51

学习纯顶
作者: 满天星    时间: 2007-11-22 17:16

问题解决了 ,谢谢!


作者: 满天星    时间: 2007-11-22 17:25

现有程序:

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
这是为什么啊


作者: caopengly    时间: 2007-11-24 11:12

"可是还有错误: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。


作者: flanix    时间: 2007-12-19 11:34

你要问就把完整程序发出来了.
作者: joyfox    时间: 2007-12-20 11:14

7楼说的不是原因吧,它原来是异步复位,你改动后变成了同步复位,要把完整的程序发出来才能分析吧!!!!!
作者: caopengly    时间: 2007-12-20 18:09

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

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

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






欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0