📄 testfreq.vhd
字号:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.ALL;
entity testfreq is
port( clk :in std_logic;
clock: in std_logic;
freq: out integer range 0 to 999999);
end testfreq;
ARCHITECTURE zx OF testfreq IS
signal clk1,clr: std_logic;
signal freq1:integer range 0 to 999999;
begin
process(clk)
variable count : integer range 0 to 50000002;
begin
if(clk'event and clk='1') then
if(count=50000002) then count:=0; clr<='1';
else count:=count+1; clr<='0';
end if;
end if;
end process;
process(clk)
variable count1 : integer range 0 to 49999999;
begin
if(clk'event and clk='1') then
if(count1=49999999) then count1:=0; clk1<='1';
else count1:=count1+1; clk1<='0';
end if;
end if;
end process;
process(clock)
variable count2: integer range 0 to 999999;
begin
if(clr='1') then count2:=0;
elsif(clk1='1') then freq1<=count2;
elsif(clock'event and clock='1') then
count2:=count2+1;
end if;
end process;
process(clk1)
begin
if(clk'event and clk='1') then freq<=freq1;
end if;
end process;
end zx;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -