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. 请问这是什么意思?应该怎么修改?
可能是你的library没加全
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all
use ieee.std_logic_arith.all;
编译通过在11.0下!
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;