|
设置两个时钟信号,希望在频率低的一个时钟周期内用高频率的时钟只采样一次
下面的代码好像不能综合
entity key is
port(k1,k2,k3,k4,k5,k6,k7,k8:in std_logic;
clk50m,clk:in std_logic;
key:out std_logic_vector(3 downto 0));
end key;
architecture Behavioral of key is
signal flag:integer:=0;
signal m:std_logic_vector(3 downto 0);
begin
key<=m;
process(clk50m,clk)
begin
if rising_edge(clk50m) then
if (k8='1' and flag=0) then
m<="1111";
flag<=1;
elsif (k7='1' and flag=0) then
m<="1110";
flag<=1;
elsif (k6='1' and flag=0) then
m<="1101";
flag<=1;
elsif (k5='1' and flag=0) then
m<="1100";
flag<=1;
elsif (k4='1' and flag=0) then
m<="1011";
flag<=1;
elsif (k3='1' and flag=0) then
m<="1010";
flag<=1;
elsif (k2='1' and flag=0) then
m<="1001";
flag<=1;
elsif (k1='1' and flag=0) then
m<="1000";
flag<=1;
else m<="0000";
end if;
end if;
if rising_edge(clk) then
flag<=0;
end if;
end process;
end Behavioral; |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|