現在、VHDL で画面バッファを作成しようとしています (VGA 経由でビデオ データを送信するデバイス用)。Xilinx ISE 13.1 を使用しており、VHDL の初心者です。
私の考えは、各ピクセルの RGB 値 (8 ビット) を含む大きな二次元配列を作成することでした。
問題なく配列に書き込むことはできますが、読み取る必要がある場合はさらに複雑になります。合成は非常に長くなり、コンピューターが自動的にシャットダウンするまで、XST はメモリを完全に飽和させます。
これは私のコードの簡略版で、赤い 45° の線を描こうとしているだけです:
entity Pilotage_ecran is
port(clk25 : in std_logic; --25MHz clock
red_out : out std_logic; --Untill the problem is solved, i use only 1 bit to set colors
green_out : out std_logic;
blue_out : out std_logic;
hs_out : out std_logic;
vs_out : out std_logic);
end Pilotage_ecran;
architecture Behavioral of Pilotage_ecran is
signal horizontal_counter : std_logic_vector (9 downto 0);
signal vertical_counter : std_logic_vector (9 downto 0);
signal drawing : std_logic; --Signal that is set to 1 when the active video area is reached
signal busy : std_logic; --Signal to avoid launching the drawing process twice in parallel
--The array (actually containing single bits instead of vectors untill I solve the problem)
type TAB_BUFFER is array(0 to 1023, 0 to 1023) of std_logic;
signal Ecran : TAB_BUFFER := (others=>'0');
begin
主な工程:
process (clk25)
variable coordX : integer;
variable coordY : integer;
begin
if clk25'event and clk25 = '1' then
if (horizontal_counter >= "0010010000" ) -- 144 : limits of active video area
and (horizontal_counter < "1100010000" ) -- 784
and (vertical_counter >= "0000100111" ) -- 39
and (vertical_counter < "1100010000" ) -- 519
then
drawing <= '1';
coordX := conv_integer (horizontal_counter);
coordY := conv_integer (vertical_counter);
if Ecran(coordX,coordY) = '1' then --Here is the problem
red_out <= '1';
green_out <= '0';
blue_out <= '0';
else
red_out <= '0';
green_out <= '0';
blue_out <= '0';
end if;
else
drawing <= '0';
end if;
--Hsync and Vsync come after, but the code is safe and tested
end if;
end process;
描画プロセス(実際には醜い方法で線を描画しますが、バッファに何かを入れたかっただけです)。
draw :
process (drawing, clk25, busy)
--Coordinates of the starting point (actually random values...)
variable i : integer;
variable j : integer;
begin
if (drawing = '1') and clk25 = '1' and busy = '0' then
busy <= '1';
i :=300;
j :=300;
--The loop setting the coordinates of the line to '1'
loopx : while (i<=350) loop
Ecran(i,j) <= '1';
i := i+1;
j := j+1;
end loop loopx;
busy <='0';
end if;
end process draw;
end Behavioral;
問題を引き起こす行は、バッファ内のいくつかの座標で値にアクセスしようとする行です:
Ecran(coordX,coordY) = '1' の場合
私もこのようにしようとしました:
red_out <= Ecran(coordX,coordY);
coordX または coordY のいずれかを整数値に置き換えると、正常に動作します (表示はバッファーと一致しませんが動作します) が、両方に変数を使用すると、合成中にクラッシュします。いくつかの作業コードと一致しているように見えても、配列に何か問題があったと確信しています (配列の使用方法を学んだばかりです)。また、(そしておそらく)大きすぎる配列を使用している可能性もあります。
私が何を間違えたのか、またはvhdlでスクリーンバッファを作成する方法についてより良い方法を知っている人がいれば、どんな助けでも大歓迎です。
事前にどうもありがとうございました。