저는 프로젝트에 VHDL을 배우려고하는 아날로그 엔지니어입니다. 이 프로젝트는 입력 신호의 상승 에지를 카운트하고 카운트를 더 작은 수로 프리 스케일합니다. 예를 들어 입력에 8 카운트가 있으면 1 카운트가 출력됩니다. 사전 설정 값은 사용자가 변경할 수 있습니다. 나는 prescale 부분을 작동시킬 수 있었지만 압박에서 출력은 끊임없이 높게 갈 것입니다.VHDL 500 ns pulse
내가하고자하는 것은 일단 prescale 카운트가 사용자 선택 값이면 = 500ns 펄스가 일정 로직보다 높게 출력된다는 것입니다.
저는 50 MHz clk를 가지고 있으므로 출력을 25 개의 잠금 사이클 동안 높게 유지할 필요가 있습니다. 그러나이를 수행하는 방법은 확실하지 않습니다.
도움이 될 것이다 큰 :)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter is
port (
pushbutton: in std_logic;
SW: in std_logic_vector(7 downto 0); -- user select switches
RESET: in std_logic;
OUTPUT: out std_logic;
LEDS: out std_logic_vector(8 downto 0) -- un used leds
);
end counter;
architecture Behavioral of counter is
signal COUNTER: std_logic;
signal PRESCALER: std_logic_vector(7 downto 0);
signal SWITCH: std_logic_vector(7 downto 0);
begin
CounterProcess: process(RESET, pushbutton)
begin
if rising_edge(pushbutton) then
if RESET = '0' then
PRESCALER <= (others => '0');
COUNTER <= '0';
else
if PRESCALER < SWITCH - 1 then
PRESCALER <= PRESCALER + 1;
else
PRESCALER <= (others => '0');
COUNTER <= '1';
end if;
end if;
end if;
end process;
LEDS <= (others => '0'); -- Turn off all unsed LEDs
SWITCH <= SW; -- Asign switch value into a signal
OUTPUT <= COUNTER;
end Behavioral;