Data Objects and Data types

Updated on 2017/07/29 16:59

Write introduction of the Article here.

Data Objects

Signal

The signal represents interconnection wires between ports it may be declared in the declaration part of

  • packages
  • entities
  • architectures
  • blocks

Syntax:

signal signal_name : signal_type;
Signal assignment: <=

Variable

The variable locally stores temporary data and it is used only inside a sequential statement that means

  • process
  • function
  • procedures

The variable is visible only inside processes and subprograms in which it is declared. The variable declaration is

Syntax:-

variable variable_name : variable_type;
Variable assignment: :=

Constant

The constant names specific values to make the model better documented and easy to update.

The constant can be declared in all the declarative VHDL statement,

  • sequential
  • concurrent

that means it may be declared in the declaration section of packages, entities, architectures, processes, subprograms and blocks

The constant declaration is

Syntax:-

constant constant_name : constant_type := value;

File

The File type is used to access File on disk.

It is used only in test bench; in fact File type cannot be implemented in hardware.

In order to use the FILE type you shall include the TextIO package that contains all procedures and functions that allow you to read from and write to formatted text files.

Input ASCII files are handled as file of lines, where a line is a string, terminated by a carriage return.

TextIO package declares a type line used to hold

  • a line read from an input file
  • a line to write to an output file

Syntax: Write file

process_write_file : process(...)
file file_name_write: text; -- declare file
variable row: line; -- line to access file
variable integer_value : integer; -- integer value write to file
begin
-- open file write mode
file_open(file_name_read,file_to_write.txt, write_mode);
-- read line from file and then read integer value
writeline(file_name_write,row);
write(row,integer_value);
...
end process process_write_file;

Syntax: Read file

process_read_file : process(...)
file file_name_read : text; -- declare file
variable row : line; -- line to access file
variable integer_value : integer; -- integer value read from file
begin
-- open file read mode
file_open(file_name_read, file_to_read.txt, read_mode);
-- read line from file and then read integer value
readline(file_name_read,row);
read(row,integer_value);
...
end process process_read_file;

Data Types

1429196637.png

References

  • Edited and Created by Prof Hrishikesh Dhanwate, JSPM'S ICOER,Wagholi ,Pune
  • WikiNote Foundation
Tags:
Created by HrishikeshDhanawate on 2017/07/28 15:22