The System Designer's Guide to VHDL-AMS: Analog, Mixed-Signal, and Mixed-Technology Modeling

In this chapter we look at the facilities in VHDL-AMS for file input and output. Files serve a number of purposes, one of which is to provide long-term data storage. In this context, "long-term" means beyond the lifetime of one simulation run. Files can be used to store data to be loaded into a model when it is run, or to store the results produced by a simulation. VHDL-AMS also provides specialized versions of file operations for working with text files. We show how textual input and output can be used to extend the user interface of a simulator with model-specific operations.
We start our discussion of files by looking at the general-purpose mechanisms provided in VHDL-AMS for file input and output. VHDL-AMS provides sequential access to files using operations, such as "open", "close", "read" and "write", that are familiar to users of conventional programming languages.
A VHDL-AMS file is a class of object used to store data. Hence, as with other classes of objects, we must include file-type definitions in our models. The syntax rule for defining a file type is
file_type_definition <span class="unicode">?</span> <b class="bold">file of</b> type_mark
A file-type definition simply specifies the type of objects to be stored in files of the given type. For example, the type declaration
<b class="bold">type</b> integer_file <b class="bold">is file of</b> integer;
defines integer_file to be a type of file that can only contain integers. A file can only contain one type of object, but that type can...