155107149 发表于 2009-5-12 22:13:42

初学VHDL,请教寄存器多驱动的错误问题

我想实现如图的时钟b
http://cache.amobbs.com/bbs_upload782111/files_15/ourdev_444505.jpg
(原文件名:clk.jpg)
思路是clk_in上升沿时clk_out输出0
      clk_in下降沿时clk_out输出1
但是编译的时候出现以下错误
Error (10822): HDL error at clk.vhd(15): couldn't implement registers for assignments on this clock edge
哪位大侠说说这是什么问题呢?

附程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity clk is
port(clk_in:in std_logic;
   clk_out:out std_logic);
end clk;

architecture clk1 of clk is
begin
process(clk_in)
begin   

if(clk_in'event and clk_in='0')then
   clk_out<='1';
end if;

if(clk_in'event and clk_in='0')then
   clk_out<='0';
end if;
end process;

end clk1;

cicnx 发表于 2009-5-13 09:17:12

直接 clk_out <= not clk_in; 不就可以了?

155107149 发表于 2009-5-14 07:55:28

是可以啊,但是我在这里实验的是上升沿和下降沿都作为敏感信号触发,但是就是不行,似乎只能用一个边沿啊

ZIRPON 发表于 2011-3-16 14:41:14

回复【2楼】155107149 北桥少年
----------------------------------------------------------------------
请问你后来怎样解决的

catzl7 发表于 2011-3-16 14:45:41

if(clk_in'event and clk_in='0')then
   clk_out<='1';
end if;
   
if(clk_in'event and clk_in='0')then
   clk_out<='0';
end if;
你是要它等于1还是0啊?、

asma 发表于 2011-3-16 16:39:40

Can you draw a sch. like your thought. it is hardware description language

quanqiuy 发表于 2011-3-18 18:26:09

假如这 if(clk_in'event and clk_in='0')then
       clk_out<='1';
end if;
成立,你以为clk_out<='1' ,但你记住你设计的是硬件,不是软件,而这if(clk_in'event and clk_in='0')then
   clk_out<='0';
end if;
不成立, clk_out<='0'保持不变,这与“ clk_out<='1'”不矛盾啦吗?!

quanqiuy 发表于 2011-3-18 18:27:35

不懂call我,QQ1247652780
页: [1]
查看完整版本: 初学VHDL,请教寄存器多驱动的错误问题