El paquete contiene las siguientes líneas:
archivo ENTRADA: TEXTO está en "STD_INPUT"; archivo SALIDA: TEXTO está fuera "STD_OUTPUT";
Por alguna razón, estos me recuerdan los flujos de entrada y salida estándar de mis lecciones de lenguaje C. ¿Qué significan estos aquí? ¿Es realmente posible leer/escribir el flujo de entrada/salida estándar usando este paquete? ¿Cómo?
Respuesta corta: Sí :)
Desafortunadamente, no todos los simuladores lo admiten.
Actualmente, solo conozco GHDL y ModelSim / QuestaSim. No tengo información sobre iSim o xSim.
No conozco ninguna herramienta de síntesis que admita STD_IN y STD_OUT. Xilinx XST tiene soporte de E/S de archivos, pero creo que no es compatible con STD_IN/STD_OUT.
Vivado no admite E/S de archivos y Quartus no admite std.textio.
Ejemplos mínimos probados en GHDL 0.33
Lea 4 líneas de entrada de stdin y escupa cada una directamente a stdout:
library std;
use std.textio.all;
library ieee;
use ieee.std_logic_1164.all;
entity tmp_tb is
end;
architecture behav of tmp_tb is
begin
process
variable my_line : line;
begin
for i in 3 downto 0 loop
readline(input, my_line);
writeline(output, my_line);
end loop;
wait;
end process;
end;
Lea 4 enteros de stdin y escríbalos en una señal. Esto se puede observar en un archivo de onda generado. Usos: https://stackoverflow.com/questions/7271092/vhdl-convert-string-to-integer-best-way
architecture behav of tmp_tb is
constant clk_period : time := 1 ns;
signal my_integer : integer;
begin
process
variable my_line : line;
variable my_integer_var : integer;
begin
for i in 3 downto 0 loop
readline(input, my_line);
read(my_line, my_integer_var);
my_integer <= my_integer_var;
wait for clk_period / 2;
end loop;
wait;
end process;
end;
Un montón de ejemplos de escritura estándar en GitHub: https://github.com/cirosantilli/vhdl-cheat/blob/3721d42a1f1a8d3de3462ac70f90374c910f176e/write_tb.vhdl
Escriba un entero como hexadecimal en la salida estándar: https://stackoverflow.com/questions/37879954/how-to-write-an-integer-to-stdout-as-hexadecimal-in-vhdl
usuario8352
cuántico231
usuario8352