VHDLで円を描くにはどうすればよいですか?私のBDFデザインがあり ます
さて、半径100ピクセルまでの赤い円を描く必要があります。ベクトルを使うべきだと思いますが、どうやって?
entity VGAFrameTest is
port( yrow, xcolumn : in unsigned(9 downto 0); -- row and column number of VGA video
VGA_CLK : in std_logic; -- pixel clock
VGA_R, VGA_G, VGA_B: out std_logic_vector(9 downto 0)); -- color information
end;
architecture rtl of VGAFrameTest is
constant COLOR_ON : std_logic_vector(9 downto 0) := (others=>'1');
constant COLOR_OFF : std_logic_vector(9 downto 0) := (others=>'0');
constant ROW_HEIGHT : integer := 480; -- number of visible rows
-- A test of visible range is recommended -- VGA 640x480@60Hz resolution is not natural for LCD monitors -- They support it but some monitors do not display all columns -- 1 or 2 last columns can be missing
constant COLUMN_WIDTH : integer := 640 -1 ; -- number of visible columns - correction
begin
frame:process(VGA_CLK)
begin
if rising_edge(VGA_CLK) then
VGA_R<=COLOR_ON;VGA_G<=COLOR_ON;VGA_B<=COLOR_ON; --initilize color to white
if (yrow = 240 and xcolumn = 320) then
VGA_B<=COLOR_OFF; VGA_G<=COLOR_OFF;
elsif yrow = 1 or yrow = ROW_HEIGHT-2 or xcolumn=1 or xcolumn = COLUMN_WIDTH-2 then
VGA_R<=COLOR_OFF; VGA_G<=COLOR_OFF; VGA_B<=COLOR_OFF; -- black frame
elsif yrow = ROW_HEIGHT-1 then
VGA_B<=COLOR_OFF; VGA_G<=COLOR_OFF; --last column is red
end if;
end if;
end process;
end;