请教关于vdhl的问题
上课的时候学习vhdl都是用电脑仿真的。测试的时候也只是在电脑模拟结果。现在因为要做一个project,需要用到xilinx vertix4开发板。真正接触实物。
现在想先编一个简单的程序实验一下。但出现问题了。编了一个binary counter。用开发板上用4个led灯显示。但程序传到板上的时候,应该是时钟太快了,根本看不清灯的闪烁。想问问,如何能在程序里面加入一个空转的命令,使之闪烁的速度慢点?可以用肉眼看得请。 wait for 的命令只能在仿真中用。所以不知道应该怎么做。
clock的频率是100MHz的,输出到led的时候闪得很快。肉眼完全看不出led在闪。我想能不能用loop什么的,可以让时钟空转,达到减慢时钟的频率,看得清闪烁。
记得学汇编的时候就有让alu空转的方法。但vhdl不知道应该怎么办
请高手指教。谢谢!
源程序
entity counter is
Port ( clock : in STD_LOGIC;
direction : in STD_LOGIC;
count_out : out STD_LOGIC_VECTOR (3 downto 0));
end counter;
architecture Behavioral of counter is
signal count_int : std_logic_vector(3 downto 0) := "0000" ;
begin
process (clock)
begin
if clock='1' and clock'event then
if direction='1' then
count_int <= count_int + 1;
else
count_int <= count_int - 1;
end if;
end if;
end process;
count_out <= count_int;
end Behavioral; 先看你板子的外部时钟是多少,然后用循环几千次处理一次的方法,等效的放慢时钟。 原帖由 eisenstange 于 2007-7-6 17:09 发表 http://www.dolc.de/forum/images/common/back.gif
先看你板子的外部时钟是多少,然后用循环几千次处理一次的方法,等效的放慢时钟。
这也是我想到的。但我应该怎么做呢? 你可以这样干。
entity Divider is
Port ( clock_in : in STD_LOGIC;
clock_out : out STD_LOGIC);
end Divider;
architecture Behavioral of Divider is
signal cnt : std_logic_vector(15 downto 0) := "0000_0000_0000_0000" ;
begin
process (clock_in)
begin
if clock='1' and clock'event then
cnt <= cnt_int + 1;
if cnt>"0111_1111_1111_1111";
clock_in<='1';
else
clock_in<='0';
end if;
end if;
end process;
end Behavioral;
然后再写一个顶层模块,把这个模块和你的模块连起来就可以了。 原帖由 aileute 于 2007-7-6 20:40 发表 http://www.dolc.de/forum/images/common/back.gif
你可以这样干。
entity Divider is
Port ( clock_in : in STD_LOGIC;
clock_out : out STD_LOGIC);
end Divider;
architecture Behavioral of Divider is
signal cnt : std_logic_vector(15 d ...
这是一个办法,但是有点不明白的是,为什么要用Std_logic_vector呢,用整型不是更方便么,而且可以用Gernic在接口定义,这样可以在知道了线路传输延迟以后再传进去。
不知道这种想法对不对。
页:
[1]