PlTbUtils  1.3
PlTbUtils is a collection of functions, procedures and components for easily creating stimuli and checking response in automatic self-checking testbenches.
txt_util Package Body Reference
Package >> txt_util

Functions

character   chr ( sl: in std_logic )
 converts std_logic into a character
string   str ( sl: in std_logic )
 converts std_logic into a string (1 to 1)
string   str ( slv: in std_logic_vector )
 converts std_logic_vector into a string (binary base)
string   str ( b: in boolean )
 converts boolean into a string
character   chr ( int: in integer )
 converts an integer into a character for 0 to 9 the obvious mapping is used, higher values are mapped to the characters A-Z
string   str ( int: in integer , base: in integer )
 convert integer to string using specified base
string   str ( int: in integer )
 return result and add sign if required convert integer to string, using base 10
string   hstr ( slv: in std_logic_vector )
 converts a std_logic_vector into a hex string.
character   to_upper ( c: in character )
 convert a character to upper case
character   to_lower ( c: in character )
 convert a character to lower case
string   to_upper ( s: in string )
 convert a string to upper case
string   to_lower ( s: in string )
 convert a string to lower case
boolean   is_whitespace ( c: in character )
 checks if whitespace (JFF)
string   strip_whitespace ( s: in string )
 remove leading whitespace (JFF)
string   first_string ( s: in string )
 return first non-whitespacesubstring (JFF)
std_logic   to_std_logic ( c: in character )
 j points to first whitespace converts a character into a std_logic
std_logic_vector   chr_to_slv ( c: in character )
 converts a character into std_logic_vector(JFF)
integer   chr_to_int ( c: in character )
 converts a character into int (JFF)
std_logic_vector   to_std_logic_vector ( s: in string )
 converts a binary string into std_logic_vector
std_logic_vector   hstr_to_slv ( s: in string )
 converts a hex string into std_logic_vector(JFF)
integer   str_to_int ( s: in string )
 converts a decimal string into an integer (JFF)

Procedures

  print( text: string )
 prints text to the screen
  print( active: boolean , text: string )
 prints text to the screen when active
  chomp( variable s: inout string ,variable shead: out string )
 removes first non-whitespace string from a string (JFF)
  str_read( res_string: out string )
 read variable length string from input file
  print( new_string: in string )
 print string to a file
  print( char: in character )
 print character to a file and start new line
  str_write( new_string: in string )

Detailed Description

Definition at line 152 of file txt_util.vhd.

Member Function Documentation

◆ chomp()

chomp ( variable   s inout string ,
variable   shead out string  
)
Procedure

removes first non-whitespace string from a string (JFF)

Definition at line 713 of file txt_util.vhd.

◆ chr() [1/2]

character chr (   int in integer  
)
Function

converts an integer into a character for 0 to 9 the obvious mapping is used, higher values are mapped to the characters A-Z

(this is useful for systems with base > 10) (adapted from Steve Vogwell's posting in comp.lang.vhdl)

Definition at line 254 of file txt_util.vhd.

◆ chr() [2/2]

character chr (   sl in std_logic  
)
Function

converts std_logic into a character

Definition at line 176 of file txt_util.vhd.

◆ chr_to_int()

integer chr_to_int (   c in character  
)
Function

converts a character into int (JFF)

Definition at line 838 of file txt_util.vhd.

◆ chr_to_slv()

std_logic_vector chr_to_slv (   c in character  
)
Function

converts a character into std_logic_vector(JFF)

Definition at line 790 of file txt_util.vhd.

◆ first_string()

string first_string (   s in string  
)
Function

return first non-whitespacesubstring (JFF)

Definition at line 682 of file txt_util.vhd.

◆ hstr()

string hstr (   slv in std_logic_vector  
)
Function

converts a std_logic_vector into a hex string.

Definition at line 390 of file txt_util.vhd.

◆ hstr_to_slv()

std_logic_vector hstr_to_slv (   s in string  
)
Function

converts a hex string into std_logic_vector(JFF)

Definition at line 888 of file txt_util.vhd.

◆ is_whitespace()

boolean is_whitespace (   c in character  
)
Function

checks if whitespace (JFF)

Definition at line 631 of file txt_util.vhd.

◆ print() [1/4]

print (   active boolean ,
  text string  
)
Procedure

prints text to the screen when active

Definition at line 165 of file txt_util.vhd.

◆ print() [2/4]

print (   char in character  
)
Procedure

print character to a file and start new line

Definition at line 969 of file txt_util.vhd.

◆ print() [3/4]

print (   new_string in string  
)
Procedure

print string to a file

Definition at line 956 of file txt_util.vhd.

◆ print() [4/4]

print (   text string  
)
Procedure

prints text to the screen

Definition at line 156 of file txt_util.vhd.

◆ str() [1/5]

string str (   b in boolean  
)
Function

converts boolean into a string

Definition at line 235 of file txt_util.vhd.

◆ str() [2/5]

string str (   int in integer  
)
Function

return result and add sign if required convert integer to string, using base 10

Definition at line 380 of file txt_util.vhd.

◆ str() [3/5]

string str (   int in integer ,
  base in integer  
)
Function

convert integer to string using specified base

(adapted from Steve Vogwell's posting in comp.lang.vhdl)

Definition at line 344 of file txt_util.vhd.

◆ str() [4/5]

string str (   sl in std_logic  
)
Function

converts std_logic into a string (1 to 1)

Definition at line 208 of file txt_util.vhd.

◆ str() [5/5]

string str (   slv in std_logic_vector  
)
Function

converts std_logic_vector into a string (binary base)

(this also takes care of the fact that the range of a string is natural while a std_logic_vector may have an integer range)

Definition at line 221 of file txt_util.vhd.

◆ str_read()

str_read (   res_string out string  
)
Procedure

read variable length string from input file

Definition at line 914 of file txt_util.vhd.

◆ str_to_int()

integer str_to_int (   s in string  
)
Function

converts a decimal string into an integer (JFF)

Definition at line 900 of file txt_util.vhd.

◆ str_write()

str_write (   new_string in string  
)
Procedure

appends contents of a string to a file until line feed occurs (LF is considered to be the end of the string)

Definition at line 984 of file txt_util.vhd.

◆ strip_whitespace()

string strip_whitespace (   s in string  
)
Function

remove leading whitespace (JFF)

Definition at line 645 of file txt_util.vhd.

◆ to_lower() [1/2]

character to_lower (   c in character  
)
Function

convert a character to lower case

Definition at line 530 of file txt_util.vhd.

◆ to_lower() [2/2]

string to_lower (   s in string  
)
Function

convert a string to lower case

Definition at line 616 of file txt_util.vhd.

◆ to_std_logic()

std_logic to_std_logic (   c in character  
)
Function

j points to first whitespace converts a character into a std_logic

Definition at line 756 of file txt_util.vhd.

◆ to_std_logic_vector()

std_logic_vector to_std_logic_vector (   s in string  
)
Function

converts a binary string into std_logic_vector

Definition at line 874 of file txt_util.vhd.

◆ to_upper() [1/2]

character to_upper (   c in character  
)
Function

convert a character to upper case

Definition at line 459 of file txt_util.vhd.

◆ to_upper() [2/2]

string to_upper (   s in string  
)
Function

convert a string to upper case

Definition at line 601 of file txt_util.vhd.


The documentation for this class was generated from the following file: