div.vhd

来自「本人学士时候用的本人学士时候用的本人学士时候用的」· VHDL 代码 · 共 32 行

VHD
32
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity div is
generic(duty:integer:=5);
port(clk: in std_logic;
	   q: out std_logic
	);
	
end div;
	
architecture div10 of div is
constant period : integer:=10;
signal count : integer range 0 to period-1;
begin
process(clk)	--jincheng
begin
 if rising_edge(clk) then
    q<='1';
    if count < duty then 
		q<='0';
		count<=count+1;
	elsif count<period-1 then
		count<=count+1;
	else 
	count <= 0;
	end if;
end if;
end process	;
end div10;	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?