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 Reference

Defines useful functions an procedures for text handling text in VHDL. More...

Package Body >> 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 single character (can also be used for hex conversion and other bases)
string   str ( int: in integer , base: in integer )
 converts integer into string using specified base
string   str ( int: in integer )
 converts integer to string, using base 10
string   hstr ( slv: in std_logic_vector )
 convert std_logic_vector into a string in hex format
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 nonwhitespace substring (JFF)
std_logic   to_std_logic ( c: in character )
 converts a character into std_logic
std_logic_vector   chr_to_slv ( c: in character )
 converts a hex 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( active: boolean , text: string )
 prints the message when active
  print( text: string )
 prints a message to the screen
  chomp( variable s: inout string ,variable shead: out string )
 finds the first non-whitespace substring in a string and (JFF)
  str_read( res_string: out string )
 read variable length string from input file
  print( new_string: in string )
 print string to a file and start new line
  print( char: in character )
 print character to a file and start new line

Detailed Description

Defines useful functions an procedures for text handling text in VHDL.

Definition at line 31 of file txt_util.vhd.

Member Function Documentation

◆ chomp()

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

finds the first non-whitespace substring in a string and (JFF)

Returns
both the substring and the original with the substring removed

Definition at line 98 of file txt_util.vhd.

◆ chr() [1/2]

character chr (   int in integer  
)
Function

converts an integer into a single character (can also be used for hex conversion and other bases)

Definition at line 62 of file txt_util.vhd.

◆ chr() [2/2]

character chr (   sl in std_logic  
)
Function

converts std_logic into a character

Definition at line 49 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 109 of file txt_util.vhd.

◆ chr_to_slv()

std_logic_vector chr_to_slv (   c in character  
)
Function

converts a hex character into std_logic_vector(JFF)

Definition at line 106 of file txt_util.vhd.

◆ first_string()

string first_string (   s in string  
)
Function

return first nonwhitespace substring (JFF)

Definition at line 94 of file txt_util.vhd.

◆ hstr()

string hstr (   slv in std_logic_vector  
)
Function

convert std_logic_vector into a string in hex format

Definition at line 71 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 115 of file txt_util.vhd.

◆ is_whitespace()

boolean is_whitespace (   c in character  
)
Function

checks if whitespace (JFF)

Definition at line 88 of file txt_util.vhd.

◆ print() [1/4]

print (   active boolean ,
  text string  
)
Procedure

prints the message when active

useful for debug switches

Parameters
texttext to print to screen
activecondition for printing

Definition at line 39 of file txt_util.vhd.

◆ print() [2/4]

print (   char in character  
)
Procedure

print character to a file and start new line

Parameters
out_fileFile to print to.
charChar to print.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 145 of file txt_util.vhd.

◆ print() [3/4]

print (   new_string in string  
)
Procedure

print string to a file and start new line

Parameters
out_fileFile to print to.
new_stringString to print.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 134 of file txt_util.vhd.

◆ print() [4/4]

print (   text string  
)
Procedure

prints a message to the screen

Parameters
texttext to print to screen

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 46 of file txt_util.vhd.

◆ str() [1/5]

string str (   b in boolean  
)
Function

converts boolean into a string

Definition at line 58 of file txt_util.vhd.

◆ str() [2/5]

string str (   int in integer  
)
Function

converts integer to string, using base 10

Definition at line 68 of file txt_util.vhd.

◆ str() [3/5]

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

converts integer into string using specified base

Definition at line 65 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 52 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)

Definition at line 55 of file txt_util.vhd.

◆ str_read()

str_read (   res_string out string  
)
Procedure

read variable length string from input file

Definition at line 123 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 118 of file txt_util.vhd.

◆ strip_whitespace()

string strip_whitespace (   s in string  
)
Function

remove leading whitespace (JFF)

Definition at line 91 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 79 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 85 of file txt_util.vhd.

◆ to_std_logic()

std_logic to_std_logic (   c in character  
)
Function

converts a character into std_logic

Definition at line 103 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 112 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 76 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 82 of file txt_util.vhd.


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