📄 time_div.vhd
字号:
------------------------------------------------------------------------------------ Company: -- Engineer: -- -- Create Date: 22:50:24 10/07/2008 -- Design Name: -- Module Name: time_div - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: ---- Dependencies: ---- Revision: -- Revision 0.01 - File Created-- Additional Comments: ------------------------------------------------------------------------------------library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity time_div is generic( CNT:integer:=25000); --set divide number Port ( clkin : in STD_LOGIC; rst_n : in STD_LOGIC; clkout : out STD_LOGIC);end time_div;architecture Behavioral of time_div issignal clktmp:std_logic:='0';beginprocess(clkin,rst_n)variable counter:integer range 0 to CNT;begin if(rst_n = '0')then counter := 0; clktmp <= '0'; elsif(clkin'event and clkin = '1')then if(counter = CNT-1)then --counter is full flip the output counter := 0; clktmp <= not clktmp; --output else counter := counter + 1; --counter is accumlate end if; end if;end process;clkout <= clktmp;end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -