初学者,请教问题!!!1

2019-03-25 09:38发布

entity cnt16 is
port(clk:in std_logic;
     dout:out std_logic_vector(3 downto 0);
          dclk1:out std_logic);
end cnt16;

architecture Behavioral of cnt16 is
     signal clk1:std_logic :='1';
          signal q:integer range 0 to 24000000:=0;
     signal w:std_logic_vector(3 downto 0):="0000";

begin
     dclk1<=clk1; dout<=not w;
          t1:process(clk)
            begin
                       if clk'event and clk='1' then
                                   if q=23999999 then
                                           q<=0;clk1<=not clk1;
                                        else
                                           q<=q+1;
                                        end if;
                                  end if;
                 end process;
                 
          t2:process(clk1)
            begin
                       if clk1'event and clk1='1' then
                                   if w=9 then
                                           w<="0000";
                                        else
                                           w<=w+1;
                                        end if;
                                  end if;
                 end process;
end Behavioral;


错误提示在if w=9 then
                                           w<="0000";
                                        else
                                           w<=w+1;
can not have such operands in this context. 请问这是什么意思?应该怎么修改? 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
7条回答
popcup512j
2019-03-26 02:31
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity test_fpga is
port(clk:in std_logic;
dout:out std_logic_vector(3 downto 0);
dclk1:out std_logic);
end test_fpga;

architecture Behavioral of test_fpga is
signal clk1:std_logic :='1';
signal q:integer range 0 to 24000000:=0;
signal w:std_logic_vector(3 downto 0):="0000";

begin
dclk1<=clk1; dout<=not w;
t1:process(clk)
begin
if clk'event and clk='1' then
if q=23999999 then
q<=0;clk1<=not clk1;
else
q<=q+1;
end if;
end if;
end process;

t2:process(clk1)
begin
if clk1'event and clk1='1' then
if w=9 then
w<="0000";
else
w<=w+1;
end if;
end if;
end process;
end Behavioral;

一周热门 更多>