ISE使用说明
Add Source :添加一项已经存在的文件。
本例中,首先选择VHDL Module项,我们file name命名为count。
下一步,进行管脚信号名称,位数和方向的设置。如下所示:
-6-
ISE使用说明
设置好相关管脚后,下一步:
单击“完成”。
-7-
ISE使用说明
上面对话框就是VHDL Module的编写界面,我们在此文档编写了如下的VHDL代码:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following lines to use the declarations that are -- provided for instantiating Xilinx primitive components. --library UNISIM;
--use UNISIM.VComponents.all;
entity count is
Port ( reset: in std_logic; flag : in std_logic; clk: in std_logic;
counter:out std_logic_vector(5 downto 0)); end count;
architecture Behavioral of count is
signal count:std_logic_vector(5 downto 0); signal flag1:std_logic;
-8-
ISE使用说明
begin
counter<=count;
process(reset,clk) begin
if reset='1' then
count<=\ flag1<='0';
elsif clk'event and clk='1' then flag1<=flag;
elsif flag='0' and flag1='0' then -- flag='0' ,则进行24进制计数 if count<23 then count<=count+1; elsif count>=23 then count<=\ end if;
elsif flag='1' and flag1='1' then -- flag='1' , 则进行60进制计数 if count<59 then count<=count+1; elsif count>=59 then count<=\ end if; end if;
end if;
end process;
end Behavioral;
在界面的Processes for Source一栏,是一系列综合工具。Synthesize XST工具一般可以分析代码的语法错误,查看错误报告和RTL级的电路设计图。 单击View Synthesis,出现如图所示对话框:
--flag状态切换时,将计数器清零;
if (flag='0' and flag1='1') or (flag='1' and flag1='0') then count<=\
-9-
ISE使用说明
单击ViewRTL Schemetic:
-10-