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のベクトルに来て、整数に切り替えられます。アーキテクチャ内では、上または下に移動するすべてのフロアからの入力用に2つのベクトルがあります。 最初のプロセスは、どの方向に行くかチェックし、2番目の入力を変換し、入力のあるフロアに「1」を入れます.3番目は移動プロセスです。 理論上はすべて問題ないが、波形上ではない –
質問を編集して明確化を提供する。 – Staszek