Week07_1 - Basic I/O operations In VHDL, the designer is...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
In VHDL, the designer is allowed to load data from or save data to a file. Basic I/O operations File object (handle) declaration. In VHDL’87, there are no routines to open or close a file, so both the mode of the file and its name must be specified in the file declaration. The mode defaults to read if none is specified. In VHDL’93, a file can be named and opened in the declaration or opened later using additional procedure. File type declaration. file_type_definition ::= file of base_type; TYPE string_file IS FILE OF string; TYPE natural_file IS FILE OF natural; TYPE ft IS FILE OF tm ; FILE identifier : file_type IS [mode] “file_name”; FILE identifier : file_type [[ OPEN mode] IS “file_name”]; VHDL’87 VHDL’93 Basic I/O operations- File declarations (incompatible between VHDL'87 and VHDL'93!) VHDL'87 FILE sim_output : my_file_type IS OUT "/home/usr2/sim.res" ; sim_output is declared as a output file of the type my_file_type with the physical path and name /home/usr2/sim.res FILE rom_content : rom_file_type IS IN "rom2048.txt" ; rom_content is declared as a input file of the type rom_file_type with the physical name "rom2048.txt". FILE identifier : file_type IS [mode] “file_name”;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
VHDL'93 FILE nowhere : my_file_type; nowhere is declared as file of type my_file_type but without explicitly open it FILE sim_output : my_file_type OPEN WRITE_MODE IS "sim.res"; sim_output is declared as output file of type my_file_type with the name ”sim.res” procedure file_open ( file f_handle : file_type; f_name : in string; o_kind : in file_open_kind:= read_mode); procedure file_open (f_status : out file_open_status; file f_handle : file_type; f_name : in string; o_kind : in file_open_kind:= read_mode); procedure file_close ( file f_handle: file_type); TYPE file_open_kind is (read_mode, write_mode, append_mode); TYPE file_open_status is (open_ok, status_error, name_error, mode_error); FILE identifier : file_type [[ OPEN mode] IS “file_name”]; The Textual Input and Output (TextIO) package contains declarations of types and subprograms that support reading from and writing to formatted text files. These text files are ASCII files of any desired format that is supported by a host computer. The TextIO package treats these text files as files of lines, which are strings terminated by a carriage return. The Textual Input and Output ( package TextIO ) type string is array (positive range <>) of character; package TEXTIO is ………………………………………… type LINE is access string; type TEXT is file of string; type SIDE is (right, left); subtype WIDTH is natural; file INPUT : TEXT open READ_MODE is "STD_INPUT"; file OUTPUT : TEXT open WRITE_MODE is "STD_OUTPUT"; ………………………………………… procedure READLINE ( file f: TEXT; L: out LINE); procedure WRITELINE( file f: TEXT; L: inout LINE); ………………………………………… end;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/06/2010 for the course EECC 0306-351 taught by Professor Marcinlukowiak during the Winter '10 term at RIT.

Page1 / 8

Week07_1 - Basic I/O operations In VHDL, the designer is...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online