下面的VHDL中时钟clk是变量,不是输入量,结果出现错误?为什么啊?怎么编啊?

2019-03-25 09:58发布

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity shift1 is
    Port ( d : in  std_logic;
           a : in  STD_LOGIC;
           b : in  STD_LOGIC;
           s : in  STD_LOGIC;
                          
           q : out  STD_LOGIC);
end shift1;

architecture Behavioral of shift1 is
begin
a0:process(a,b,s)
variable clk:std_logic;
variable clk1:std_logic;
variable temp:std_logic;
begin
if(s='0')then
clk:=a;
clk1:=not a;
elsif(s='1')then
clk:=b;
clk1:=not b;
end if;
if(clk'event and clk='1')then
temp:=d;
end if;
if(clk1'event and clk1='1')then
q<=temp;
end if;
end process a0; 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
3条回答
eeleader
1楼-- · 2019-03-25 13:57
 精彩回答 2  元偷偷看……
xuel0532
2楼-- · 2019-03-25 16:06
event能对变量用吗?
eeleader
3楼-- · 2019-03-25 17:48

使用了EVENT ,编译器就认为该信号是时钟!

一周热门 更多>