Access and File types in VHDL Digital Design using VHDL by Ravinder Nath Rajotiya - May 13, 2021May 14, 20210 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle Access Type:Examples Access Type: Access type allows to manipulate data, which are created dynamically during simulation and which exact size is not known in advance. Any reference to them is performed via allocators, which work in a similar way as pointers in programming languages. Simplified Syntax access subtype_indication type identifier; Here, the subtype_indication denotes the type of an object designated by a value of an access type. It can be any scalar, composite or other access type. File type is not allowed here. Variables are only the objects allowed to be of the access type. The default value of an access type is null. NULL designates no object at all. Allocators has to be used to assign any other value to an object of an access type. The access type allows to create recursive data structures (dynamic lists of objects created during simulation) which consist of the records that contain elements of access types – either the same or different than the actually declared. In order to handle declarations of such recursive data structures so called incomplete type declaration is needed which plays a role of an “announcement” of a type which will be declared later on. Example — declaration of record type Person: type Person is record address:ADRESS_TYPE; age:DATE; end record Person; — declaration of access type Person_Access: type Person_Access is access Person; The Person_Access type defines a pointer (dynamic link) to a record declared earlier and called Person. File Type File types are typically used to access files in the host system environment. The value of a file object is the sequence of values contained in the host system file. Simplified Syntax type type_name is file of type; type specifies what kind of data will be stored in a file. Type can be any scalar type (vector, integer etc.) or composite type (record and array, but only one-dimensional). Others types are forbidden. The subtype can be either constrained or unconstrained. The subtype cannot be based on a file type or an access type. When a file type is declared, several operations on objects of this type are implicitly defined. The list of the operations includes: opening a file, closing a file, reading from a file, writing to a file and checking the end of a file. Several file type declarations are shown below: For a file type declared as type FT is file of SomeType; the implicit operations are as follows: procedure FILE_OPEN ( file anonymous: FT; External_Name: in STRING; Open_Kind: in FILE_OPEN_KIND := READ_MODE ); procedure FILE_OPEN ( Status: out FILE_OPEN_STATUS; file anonymous: FT; External_Name: in STRING; Open_Kind: in FILE_OPEN_KIND := READ_MODE ); procedure FILE_CLOSE ( file anonymous: FT ); procedure READ ( file anonymous: FT; Value: out SomeType ); procedure WRITE ( file anonymous: FT; Value: in SomeType ); function ENDFILE ( file anonymous: FT ) return BOOLEAN; Examples type POSITIVE_FILE is file of POSITIVE; type BIT_VECTOR_FILE is file of BIT_VECTOR ( 0 to 7 ); type STRING_FILE is file of STRING; Here, the first type declares a file of positive numbers, the second one – a file of 8-bit wide vectors of bits, and the third one – a file containing an indefinite number of strings of arbitrary length. Questions Write short note on Access data types. Write short note on file data types. Share on Facebook Share Send email Mail Print Print