Hab hier ein Problem, will hier die Vektoren hochzählen. Jedoch kommt
dann bei der Simulation das angehängte Bild. Ich danke schon mal im
Voraus. :)
library ieee;
use ieee.std_logic_1164.ALL;
use ieee.numeric_std.ALL;
entity pixel_generator is
port( p_col: in integer;
p_row: in integer;
takt: in bit;
p_gruen: out std_logic_vector(3 downto 0);
p_blau: out std_logic_vector(3 downto 0);
p_rot: out std_logic_vector(3 downto 0)
);
end pixel_generator;
architecture behaviour of pixel_generator is
signal gruen, rot, blau: unsigned(3 downto 0):="0000";
begin
process(p_col,p_row, takt)
begin
if(takt'event and takt='1') then
if(p_col<=640 and p_col>=1) then
if(p_row<=479) then
gruen<=gruen+"0001";
rot<=rot+"0010";
blau<=blau+"0011";
end if;
else
p_gruen<="0000";
p_rot<="0000";
p_blau<="0000";
end if;
end if;
end process;
p_gruen<=std_logic_vector(gruen);
p_rot<=std_logic_vector(rot);
p_blau<=std_logic_vector(blau);
end behaviour;
hier ein besserer dateianhang nun aber mit signed statt unsigned
hab das problem gefunden. es muss so aussehen, der fehler war beim
else..
library ieee;
use ieee.std_logic_1164.ALL;
use ieee.numeric_std.ALL;
entity pixel_generator is
port( p_col: in integer;
p_row: in integer;
takt: in bit;
p_gruen: out std_logic_vector(3 downto 0);
p_blau: out std_logic_vector(3 downto 0);
p_rot: out std_logic_vector(3 downto 0)
);
end pixel_generator;
architecture behaviour of pixel_generator is
signal gruen, rot, blau: unsigned(3 downto 0):="0000";
begin
process(p_col,p_row, takt)
begin
if(takt'event and takt='1') then
if(p_col<=640 and p_col>=1) then
if(p_row<=479) then
gruen<=gruen+"0001";
rot<=rot+"0010";
blau<=blau+"0011";
end if;
else
gruen<="0000";
rot<="0000";
blau<="0000";
end if;
end if;
end process;
p_gruen<=std_logic_vector(gruen);
p_rot<=std_logic_vector(rot);
p_blau<=std_logic_vector(blau);
end behaviour;
> der fehler war beim else..
Aber die Sensitiv-Liste könnte auch kürzer ausfallen. Statt1 | process(p_col,p_row, takt) |
wäre besser
1 | process(takt) |
denn das Ergebnis des Prozesses hängt nur vom Takt ab. Und du könntest etwas abkürzen. Statt
1 | |
2 | gruen <= gruen + "0001"; |
3 | rot <= rot + "0010"; |
4 | blau <= blau + "0011"; |
so:
1 | gruen <= gruen + 1; |
2 | rot <= rot + 2; |
3 | blau <= blau + 3; |
ja danke. ich hatte das erst so gruen <= gruen + 1; rot <= rot + 2; blau <= blau + 3; habs aber dann geändert, weil ich mir nicht sicher war, wo der Fehler war
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.

