FPGA에서 구현되는 VHDL로 엘리베이터를 만들려고합니다. 0-12 층으로되어 있으며, 가고 싶은 방향과 안에있는 버튼에 따라 외부/외부 용 버튼이 있습니다. 나는 바깥 쪽 단추가 작동하는지 먼저 확인하고 내부 구현은 동일합니다. 지금은 컴파일되지만 시뮬레이션 파형은 충돌합니다.VHDL의 엘리베이터 프로젝트가 컴파일되지만 시뮬레이션에서 작동하지 않습니다.
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity lift is
port (
CLK: in bit; --clock initialized by the waveform, for now
iUP: in std_logic_vector (3 downto 0); --input from FPGA
iDOWN: in std_logic_vector (3 downto 0); --output
iBUTTON: in std_logic_vector (3 downto 0); --input from inside the elevator
W: in BIT; --weight s
DOOR: in BIT; --door opened or not
ETAJ: out std_logic_vector (12 downto 0):="0000000000001"); --output to LCD
end lift;
architecture mama of lift is
signal directie: bit := '1'; --direction of lift, 1 up/0 down
signal pozitie: natural := 0; --position of lift, 0-12
signal sus: bit; --up
signal jos: bit; --down
signal UP: std_logic_vector(12 downto 0) :="0000000000000"; --vector for the outside inputs that ask to go up
signal DOWN: std_logic_vector(12 downto 0) :="0000000000000"; --same as above, but down
begin
merge: process (UP, DOWN, pozitie) --process to determine if the lift goes up or down
variable i : std_ulogic; --the vector with the outside inputs has 1 if the button is pressed, 0 otherwise
variable j : std_ulogic;
begin
for i in pozitie+1 to 12 loop
if UP(i) = '1' then
sus <= '1';
end if;
end loop;
for j in pozitie-1 to 0 loop
if DOWN(j) = '1' then
jos <= '1';
end if;
end loop;
end process merge;
conv: process(iUP, iDOWN) --converts input from binary to int
begin
UP(to_integer(unsigned(iUP)))<='1';
DOWN(to_integer(unsigned(iDOWN)))<='1';
end process conv;
moovit: process (UP, DOWN, iBUTTON) --the moving process
variable i : std_ulogic;
begin
if directie='1' then --if direction is up and it has to go up
while sus='1' loop
if CLK'EVENT and CLK='1' and UP(pozitie)='1' then
UP(pozitie)<='0';
DOWN(pozitie)<='0';
end if;
pozitie <= pozitie + 1;
end loop;
else
while jos='1' loop
if CLK'EVENT and CLK='1' and DOWN(pozitie)='1' then
DOWN(pozitie)<='0';
UP(pozitie)<='0';
end if;
pozitie <= pozitie - 1;
end loop;
end if;
end process;
end mama;
StackOverflow에 오신 것을 환영합니다. 정확히 디자인이해야 할 일과 그렇지 않은 것은 무엇입니까? 테스트 벤치는 어떻게 생겼습니까? [mcve] – Staszek
을 제공하십시오.이 엘리베이터 프로젝트를 만들어야합니다. 나는 코드 위에 무엇이 있어야하는지 /해야 하는지를 설명했다. ACTIVE-HDL의 파형에 대한 시뮬레이션을 사용합니다. 나는 엘리베이터 외부에서 나오는 출력을 구현하려고 노력하고있다. 그들은 0에서 3 벡터에 와서 정수로 전환됩니다. 아키텍처 내부에는 UP 또는 DOWN을하려는 모든 층의 입력에 대한 두 개의 벡터가 있습니다. 첫 번째 프로세스는 진행 방향을 확인하고 두 번째는 입력을 변환하고 입력이있는 바닥에는 '1'을 넣고 세 번째 프로세스는 이동 프로세스입니다. 이론적으로는 모두 괜찮지 만 파형에서는 그렇지 않습니다 –
질문을 편집하여 설명을 제공하십시오. – Staszek