Noch eine Frage: Wie kann man eine Datei lesen um in die gleiche Datei
zu schreiben?
# Eingabedatum Ausgabedatum
in0 out0
Wobei in0 gelesen wird, dann macht VHDL etwas und dann schreibt VHDL
out0 in die Reihe von AUsgabedatum.
ranju@ins_amba:/srv/GHDL_training$ ghdl -a --ieee=synopsys FILE_IO.vhdl
FILE_IO.vhdl:32:24: no declaration for "print"
FILE_IO.vhdl:32:30: no declaration for "out_file"
FILE_IO.vhdl:33:24: no declaration for "print"
FILE_IO.vhdl:33:30: no declaration for "out_file"
FILE_IO.vhdl:36:53: no declaration for "lin"
FILE_IO.vhdl:38:39: no declaration for "break"
FILE_IO.vhdl:40:35: no declaration for "nr"
FILE_IO.vhdl:41:45: no declaration for "lin"
FILE_IO.vhdl:41:50: no declaration for "piece"
FILE_IO.vhdl:42:48: no declaration for "to_std_logic"
FILE_IO.vhdl:43:45: no declaration for "lin"
FILE_IO.vhdl:43:50: no declaration for "piece"
FILE_IO.vhdl:44:48: no declaration for "to_std_logic"
FILE_IO.vhdl:45:45: no declaration for "lin"
FILE_IO.vhdl:45:50: no declaration for "piece"
FILE_IO.vhdl:46:48: no declaration for "to_std_logic"
FILE_IO.vhdl:47:45: no declaration for "lin"
FILE_IO.vhdl:47:50: no declaration for "piece"
FILE_IO.vhdl:48:52: no declaration for "to_std_logic"
FILE_IO.vhdl:49:55: no declaration for "piece"
FILE_IO.vhdl:50:40: port "summe" can't be assigned
FILE_IO.vhdl:50:49: no declaration for "chr"
FILE_IO.vhdl:51:55: no declaration for "piece"
FILE_IO.vhdl:52:40: port "carry_out" can't be assigned
FILE_IO.vhdl:52:53: no declaration for "chr"
FILE_IO.vhdl:53:55: no declaration for "piece"
FILE_IO.vhdl:23:26:warning: procedure "read_file" is never referenced
/usr/lib/ghdl/bin/ghdl: compilation error
Das kam dabei raus.
Ach und wie stellt man synopsis automatisch ein?
Gruesse
Wiplash schrieb:> Das kam dabei raus.
Wobei?
Welchen Quelltext hast du wie und mit welchen Versionen damit übersetzt?
Ranjeet Kuruvilla schrieb:> Noch eine Frage: Wie kann man eine Datei lesen um in die gleiche Datei> zu schreiben?
Datei zum Lesen öffen.
Datei komplett einlesen.
Datei schliessen.
Datei zum Überschreiben öffnen.
Datei komplett neu überschreiben.
Datei schliessen.
Hallo
Hier der QUelltext
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_textio.all; --
Bibliotheken für TextIO / FileIO
USE std.textio.all;
ENTITY FileIO IS
PORT(
CLK : IN std_logic; -- Clock
STEP : OUT std_logic; -- RW_CMD
OP_A : OUT std_logic;
OP_B : OUT std_logic;
CARRY_IN : OUT std_logic; -- RW_CMD
SUMME : IN std_logic; -- RW_CMD
CARRY_OUT : IN std_logic -- RW_CMD
);
END ENTITY;
ARCHITECTURE behaviour OF FileIO IS
BEGIN
main: PROCESS
PROCEDURE read_file IS
VARIABLE lin_in : line; -- Zeile von Datei
VARIABLE lin_out : line; -- Zeile in Datei
FILE input_file : text; -- Input
FILE output_file : text; -- Output
BEGIN
file_open(input_file, "Input.piece.log", read_mode); -- Open a
file for reading the file.
file_open(output_file, "Output.piece.log", write_mode); -- Open a
file for reading the file.
print(out_file, "## Output piece for all signals\n");
print(out_file, "#\tStep\tsumme\tcarry_out");
WHILE(endfile(input_file) = false) LOOP
readline(input_file, lin); -- Read the line and save it in lin
ASSERT break REPORT "Error reading input file!";
IF(nr(1 to 2) /= "#") THEN -- If the line opens with # or ##,
than skip the line!
read(lin, piece); -- HIGH or LOW
STEP <= to_std_logic(piece);
read(lin, piece); -- Tab between left and step
OP_A <= to_std_logic(piece);
read(lin, piece); -- Tab between step and val
OP_B <= to_std_logic(piece);
read(lin, piece); -- Tab between step and val
CARRY_IN <= to_std_logic(piece);
write(lin_out, piece & "\t");
SUMME <= chr(piece);
write(lin_out, piece & "\n");
CARRY_OUT <= chr(piece);
write(lin_out, piece & "\n");
ELSE NULL;
END IF;
writeline(output_file, lin_out);
END LOOP;
file_close(input_file);
file_close(output_file);
END PROCEDURE;
begin
end process;
END ARCHITECTURE;
Dieser Queltext wurde verwendet.
Joa... dieser Quellcode wurde oben aufgefuehrt. Aber du bist mit deinem
Raten nicht weit entfernt:), obwohl ich schon weiss, was die einzelnen
Funktionen tun und mit VHDL arbeite ich regelmaessig, aber FileIO ist
mir vollkommen fremd.
Andere Frage: wo werden diese Packages installiert?
Ranjeet Kuruvilla schrieb:> Andere Frage: wo werden diese Packages installiert?
Die werden nicht installiert, sondern sind Teil deines Projekts. Sie
müssen also mitcompiliert werden.
Ranjeet Kuruvilla schrieb:> Ja, aber wie? Das sind Probleme die ich noch nicht hatte...
Du nutzt GHDL!?
Die schnelle Variante, alle Dateien in ein Verzeichnis packen.
Alle VHDL Dateien in GHDL importieren und mit zwei weiteren Aufrufe
durchstarten.
ghdl -i *.vhd
ghdl -m -g --warn-unused --ieee=synopsys tb_vga
ghdl -r tb_vga --disp-tree=inst --stop-time=20000ns --wave=vga.ghw
Siehe auch in
http://www.dossmatik.de/ghdl/ghdl_unisim.pdf