PandA-2024.02
Macros | Functions
string_manipulation.cpp File Reference

Auxiliary methods for manipulating string. More...

#include "string_manipulation.hpp"
#include "exceptions.hpp"
#include "panda_types.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <cxxabi.h>
#include <regex>
Include dependency graph for string_manipulation.cpp:

Go to the source code of this file.

Macros

#define FD_GROUP_U   1
 
#define FD_GROUP_W   2
 
#define FD_GROUP_D   3
 
#define FD_GROUP_SIGN   4
 
#define AC_GROUP_U   1
 
#define AC_GROUP_T   2
 
#define AC_GROUP_W   3
 
#define AC_GROUP_SIGN   4
 

Functions

void add_escape (std::string &ioString, const std::string &to_be_escaped)
 Header include. More...
 
void remove_escaped (std::string &ioString)
 Function converting all the escaped characters in the associated character. More...
 
std::string TrimSpaces (const std::string &value)
 
std::string cxa_demangle (const std::string &input)
 
std::string cxa_rename_mangled (const std::string &signature, const std::string &new_fname)
 
std::string cxa_prefix_mangled (const std::string &signature, const std::string &prefix)
 
std::string capitalize (const std::string &str)
 
std::string & capitalize (std::string &str)
 
static const std::regex fixed_def ("a[cp]_(u)?fixed<\*(\+)\*,\*(\+),?\*(\+)?[^>]*>[^\-]*")
 
std::string ConvertInBinary (const std::string &C_value, unsigned long long precision, const bool real_type, bool unsigned_type)
 Convert a string storing a number in decimal format into a string in binary format. More...
 
static const std::regex fixp_val ("(\+\?\*)")
 
std::string FixedPointReinterpret (const std::string &FP_vector, const std::string &fp_typename)
 
const std::vector< std::string > SplitString (const std::string &input, const std::string &separators)
 Function which splits a string into tokens. More...
 
std::string convert_fp_to_string (std::string num, unsigned long long precision)
 convert a real number stored in a string into a string of bits with a given precision More...
 
unsigned long long convert_fp_to_bits (std::string num, unsigned long long precision)
 convert a real number stored in a string into bits with a given precision More...
 
static const std::regex ac_type_def ("a[cp]_(u)?(\+)<\*(\+)\*,?\*(\+)?,?\*(\+)?[^>]*>")
 
unsigned long long ac_type_bitwidth (const std::string &intType, bool &is_signed, bool &is_fixed)
 

Detailed Description

Auxiliary methods for manipulating string.

Author
Marco Lattuada marco.nosp@m..lat.nosp@m.tuada.nosp@m.@pol.nosp@m.imi.i.nosp@m.t

Definition in file string_manipulation.cpp.

Macro Definition Documentation

◆ AC_GROUP_SIGN

#define AC_GROUP_SIGN   4

Definition at line 533 of file string_manipulation.cpp.

Referenced by ac_type_bitwidth().

◆ AC_GROUP_T

#define AC_GROUP_T   2

Definition at line 531 of file string_manipulation.cpp.

Referenced by ac_type_bitwidth().

◆ AC_GROUP_U

#define AC_GROUP_U   1

Definition at line 530 of file string_manipulation.cpp.

Referenced by ac_type_bitwidth().

◆ AC_GROUP_W

#define AC_GROUP_W   3

Definition at line 532 of file string_manipulation.cpp.

Referenced by ac_type_bitwidth().

◆ FD_GROUP_D

#define FD_GROUP_D   3

Definition at line 166 of file string_manipulation.cpp.

Referenced by ConvertInBinary(), and FixedPointReinterpret().

◆ FD_GROUP_SIGN

#define FD_GROUP_SIGN   4

Definition at line 167 of file string_manipulation.cpp.

Referenced by ConvertInBinary().

◆ FD_GROUP_U

#define FD_GROUP_U   1

Definition at line 164 of file string_manipulation.cpp.

Referenced by ConvertInBinary().

◆ FD_GROUP_W

#define FD_GROUP_W   2

Definition at line 165 of file string_manipulation.cpp.

Referenced by ConvertInBinary(), and FixedPointReinterpret().

Function Documentation

◆ ac_type_bitwidth()

unsigned long long ac_type_bitwidth ( const std::string &  intType,
bool is_signed,
bool is_fixed 
)

Definition at line 535 of file string_manipulation.cpp.

References AC_GROUP_SIGN, AC_GROUP_T, AC_GROUP_U, AC_GROUP_W, and ac_type_def().

Referenced by ConvertInBinary(), and InterfaceInfer::interface_info::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ac_type_def()

static const std::regex ac_type_def ( "a_(u)?(<\\\?\\?,?\\?[^>]*  [cp],
 
)
static

Referenced by ac_type_bitwidth(), and convert_fp_to_bits().

Here is the caller graph for this function:

◆ add_escape()

void add_escape ( std::string &  ioString,
const std::string &  to_be_escaped 
)

Header include.

Function which adds escape to selected characters.

Definition at line 52 of file string_manipulation.cpp.

Referenced by FunctionWriter::operator()(), and Translator::write_to_latex().

Here is the caller graph for this function:

◆ capitalize() [1/2]

std::string capitalize ( const std::string &  str)

Definition at line 151 of file string_manipulation.cpp.

References capitalize().

Referenced by capitalize(), and TestbenchGeneration::Exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ capitalize() [2/2]

std::string& capitalize ( std::string &  str)

Definition at line 157 of file string_manipulation.cpp.

References fixed_def(), and str.

Here is the call graph for this function:

◆ convert_fp_to_bits()

unsigned long long convert_fp_to_bits ( std::string  num,
unsigned long long  precision 
)

convert a real number stored in a string into bits with a given precision

Definition at line 462 of file string_manipulation.cpp.

References ac_type_def(), and STR.

Referenced by NumberToBinaryString(), and soft_float_cg_ext::RecursiveExaminate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_fp_to_string()

std::string convert_fp_to_string ( std::string  num,
unsigned long long  precision 
)

convert a real number stored in a string into a string of bits with a given precision

Definition at line 384 of file string_manipulation.cpp.

References STR, and U.

Referenced by BitLatticeManipulator::constructor_bitstring(), ConvertInBinary(), HLS_manager::get_constant_string(), NumberToBinaryString(), and fu_binding::write_init().

Here is the caller graph for this function:

◆ ConvertInBinary()

std::string ConvertInBinary ( const std::string &  C_value,
unsigned long long  precision,
const bool  real_type,
bool  unsigned_type 
)

Convert a string storing a number in decimal format into a string in binary format.

Parameters
C_valueis the decimal format
precisionis the precision of the number
real_typeis true if the type of the number is real
unsigned_typeis true if the type of the number is unsigned

Definition at line 169 of file string_manipulation.cpp.

References ac_type_bitwidth(), convert_fp_to_string(), FD_GROUP_D, FD_GROUP_SIGN, FD_GROUP_U, FD_GROUP_W, fixed_def(), fixp_val(), THROW_ASSERT, and THROW_ERROR.

Referenced by MemoryInitializationCWriter::Process(), and MemoryInitializationWriter::Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxa_demangle()

std::string cxa_demangle ( const std::string &  input)

Definition at line 109 of file string_manipulation.cpp.

Referenced by InterfaceInfer::ChasePointerInterfaceRecurse(), InterfaceInfer::Exec(), and tree_manager::GetFunction().

Here is the caller graph for this function:

◆ cxa_prefix_mangled()

std::string cxa_prefix_mangled ( const std::string &  signature,
const std::string &  prefix 
)

Definition at line 134 of file string_manipulation.cpp.

References distance().

Referenced by SimulationTool::GenerateLibraryBuildScript(), and HLSCWriter::WriteMainTestbench().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxa_rename_mangled()

std::string cxa_rename_mangled ( const std::string &  signature,
const std::string &  new_fname 
)

Definition at line 116 of file string_manipulation.cpp.

References distance().

Here is the call graph for this function:

◆ fixed_def()

static const std::regex fixed_def ( "a_(u)?fixed<\\\\\,?\\?[^>]*  [cp],
[^\-] *"   
)
static

Referenced by capitalize(), ConvertInBinary(), and FixedPointReinterpret().

Here is the caller graph for this function:

◆ FixedPointReinterpret()

std::string FixedPointReinterpret ( const std::string &  FP_vector,
const std::string &  fp_typename 
)

Definition at line 339 of file string_manipulation.cpp.

References FD_GROUP_D, FD_GROUP_W, fixed_def(), fixp_val(), STR, and THROW_ASSERT.

Here is the call graph for this function:

◆ fixp_val()

static const std::regex fixp_val ( "(\\"  )
static

Referenced by ConvertInBinary(), and FixedPointReinterpret().

Here is the caller graph for this function:

◆ remove_escaped()

void remove_escaped ( std::string &  ioString)

Function converting all the escaped characters in the associated character.

Parameters
ioStringis the string where the escaped character are changed

Definition at line 68 of file string_manipulation.cpp.

Referenced by bash_flow_wrapper::generate_synthesis_script(), NanoXploreWrapper::generate_synthesis_script(), QuartusPowerWrapper::generate_synthesis_script(), LatticeWrapper::generate_synthesis_script(), AlteraWrapper::generate_synthesis_script(), and XilinxWrapper::generate_synthesis_script().

Here is the caller graph for this function:

◆ SplitString()

const std::vector<std::string> SplitString ( const std::string &  input,
const std::string &  separators 
)

Function which splits a string into tokens.

Parameters
inputis the string to be split
separatorsis the set of characters to be used to compute the tokens
Returns
the identified tokens

Definition at line 366 of file string_manipulation.cpp.

References input.

Referenced by structural_manager::add_port(), FunctionalUnitStep::AnalyzeFu(), xml_child::CGetDescendants(), BambuParameter::CheckParameters(), EucalyptusParameter::CheckParameters(), RTLCharacterization::ComputeCells(), RTLCharacterization::ComputeComponent(), create_tree_manager::createCostTable(), DECODE_FU_LIB(), SimulationTool::DetermineCycles(), BasicBlocksProfiling::Exec(), fun_dominator_allocation::Exec(), FixCharacterization::Exec(), SpiderParameter::Exec(), BambuParameter::Exec(), pragma_manager::ExtractClauses(), FunctionBehavior::FunctionBehavior(), GenerateFuList::GenerateFuList(), allocation::get_compliant_pipelined_unit(), NP_functionality::get_port_list(), CompilerWrapper::GetSystemIncludes(), tree_helper::HasToBeDeclared(), FunctionalUnitStep::Initialize(), FunctionCallOpt::Initialize(), AllocationInformation::InitializeDSPDB(), AllocationInformation::InitializeMuxDB(), HWCallInjection::InternalExec(), Parameter::ManageDefaultOptions(), TestVectorParser::ParseUserString(), tree_helper::PrintType(), Translator::read_column_formats(), PragmaParser::recognize_call_point_hw_pragma(), soft_float_cg_ext::soft_float_cg_ext(), TrimSpaces(), HDL_manager::write_behavioral(), HDL_manager::write_fsm(), operation::xload(), and module::xload().

Here is the caller graph for this function:

◆ TrimSpaces()

std::string TrimSpaces ( const std::string &  value)

Definition at line 90 of file string_manipulation.cpp.

References SplitString().

Referenced by BambuParameter::Exec().

Here is the call graph for this function:
Here is the caller graph for this function:

Generated on Mon Feb 12 2024 13:03:35 for PandA-2024.02 by doxygen 1.8.13