Ich habe mittlerweile folgenden Code geschrieben.
Das Programm sollte über drei Leitungen (vid_clk, vid_data, vidakt) ein
Videosignal von einem DSP Board einlesen im sram speichern und über die
VGA Schnittstelle ausgeben (Schwarz Weiß ohne Grautöne 360x288).
Mit dem Block RAM hat alles funktioniert. Wenn ich das ganze aber aufs
sRAM übertrage speichert er nur 16 bit die er dann die ganze Zeit
Ausgibt (Als wären schreibe- und Leseadresse immer auf Null).
Ich habe keine Ahnung mehr wo ich den Fehler suchen soll.
______________________________________________________________________
rst <= swt(7);
-- Prozess zum generieren der Leseadresse
process(clkdiv)
begin
if rising_edge(clkdiv) and vidon = '1' then
vc_d <= vc;
if vc /= vc_d then
pixelcntr <= 0;
end if;
if pixelcntr < 360 and hc > "0100000000" and vc > "0010000000"
then -- hc...vertical counter, hc...horizontal counter
pixelcntr <= pixelcntr + 1;
if cntr = 14 then
cntr <= cntr +1;
adout <= adout + 1;
end if;
if cntr = 15 then
cntr <= 0;
else
cntr <= cntr +1;
end if;
if vc_d <= vc and vc = "0000000000" then
adout <= 00 & X"0000";
pixelcntr <= 0;
cntr <= 0;
end if;
end if;
end if;
end process;
-- Prozess zum generieren der Schreibeadresse und Speicherung der Daten.
process(vid_clk, vid_data, vidakt)
begin
if falling_edge(vid_clk) then
if vidakt = '1' then
halb <= not halb;
if halb = '0' then
di(cntrin) <= vid_data;
if cntrin = 15 then
cntrin <= 0;
adin <= adin + 1;
else
cntrin <= cntrin + 1;
end if;
end if;
else
adin <= 00 & X"0000";
cntrin <= 0;
halb <= '0';
end if;
end if;
end process;
-- sram Ansteuerung
process (mclk,rst)
type sram_state_type is (write_init, write1, read_init, read1);
variable sram_state, next_sram_state : sram_state_type;
variable lfsr, last_lfsr : std_logic_vector(18 downto 0);
variable last_io : std_logic_vector(15 downto 0);
variable address : std_logic_vector(17 downto 0);
begin
CE1 <= '0';
UB1 <= '0';
LB1 <= '0';
CE2 <= '1';
UB2 <= '1';
LB2 <= '1';
AD <= address;
if rst = '0' then
address := "000000000000000000";
lfsr := "0000000000000000001";
sram_state := write_init;
WE <= '1';
IO1 <= "ZZZZZZZZZZZZZZZZ";
led(4 downto 1) <= "1100";
elsif rising_edge(mclk) then
case sram_state is
when write_init =>
sram_state := write1;
IO1 <= di;
WE <= '1';
OE <= '1';
address := adin;
when write1 =>
if cntr = 14 then
sram_state := read_init;
end if;
WE <= '0';
IO1 <= di;
when read_init =>
OE <= '0';
sram_state := read1;
IO1 <= "ZZZZZZZZZZZZZZZZ";
address := adout;
when read1 =>
sram_state := write_init;
do <= IO1;
end case;
end if;
end process;
--rgb definieren
Cred <= do(cntr);
Cgrn <= do(cntr);
Cblu <= do(cntr);