5 #include <unordered_map>
7 #include <unordered_set>
16 enum class GroupResource {
49 bool operator()(
const std::string& a,
const std::string& b)
const;
56 std::set<std::string, CustomStringComparator>
58 std::set<std::string, CustomStringComparator>
60 std::unordered_map<std::string, std::string>
97 const bool optional =
false);
110 const GroupResource &group,
bfp::DMA *dma,
111 const bool optional =
false);
124 const GroupResource &group, std::uint32_t *address,
125 const bool optional =
false);
138 const GroupResource &group, std::uint32_t *address,
139 const bool optional =
false);
155 std::uint32_t nResource,
const GroupResource &group,
156 std::unordered_map<std::uint32_t, const std::uint32_t> *mapInsert,
157 const bool optional =
false);
173 std::uint32_t nResource,
const GroupResource &group,
174 std::unordered_map<std::uint32_t, const std::uint32_t> *mapInsert,
175 const bool optional =
false);
187 const std::unordered_map<std::uint32_t, const std::uint32_t> &mapA,
188 const std::string &nameTermA,
189 const std::unordered_map<std::uint32_t, const std::uint32_t> &mapB,
190 const std::string &nameTermB,
191 const GroupResource &group);
201 const std::string &errMsg,
202 const GroupResource &group);
217 const bool onlyErrors =
false)
const;
237 const GroupResource &group);
245 const GroupResource &group);
Responsible for managing the parsing of resources for a bitfile.
void logResourceNotFound(const std::string &resourceName, const GroupResource &group)
Logs that a resource has not been found.
bool findRegister(const std::string &resourceName, const GroupResource &group, bfp::Register *reg, const bool optional=false)
Finds a register with the given resource name.
bool findDMAEnumNum(const std::string &resourceName, std::uint32_t nResource, const GroupResource &group, std::unordered_map< std::uint32_t, const std::uint32_t > *mapInsert, const bool optional=false)
Finds the DMA number of a DMA with the given name, The resource follows an enumeration naming convent...
void printInfoXML(const std::string &filename) const
Prints resources found, not found and incompatibilities in XML format.
void compareResourcesMap(const std::unordered_map< std::uint32_t, const std::uint32_t > &mapA, const std::string &nameTermA, const std::unordered_map< std::uint32_t, const std::uint32_t > &mapB, const std::string &nameTermB, const GroupResource &group)
Compares two resource maps and logs any differences.
bool m_error
True if some resource was not found.
bool findDMANum(const std::string &resourceName, const GroupResource &group, std::uint32_t *address, const bool optional=false)
Finds the DMA number of a resource with the given name.
bool hasErrorOccurred() const
Checks if an error has occurred during parsing.
bool findRegisterAddress(const std::string &resourceName, const GroupResource &group, std::uint32_t *address, const bool optional=false)
Finds the address of a register with the given resource name.
std::unordered_map< GroupResource, GroupInfo > m_groupInfo
Map to divide information of found resources per group.
void printInfo(std::ostream &os=std::cout, const bool onlyErrors=false) const
Prints resources found, not found and incompatibilities.
bfp::BFP m_bfp
The BFP object used by the parser manager.
void logResourceError(const std::string &resourceName, const std::string &errMsg, const GroupResource &group)
Logs an error related to a resource.
bool findRegisterEnumAddress(const std::string &resourceName, std::uint32_t nResource, const GroupResource &group, std::unordered_map< std::uint32_t, const std::uint32_t > *mapInsert, const bool optional=false)
Finds the address of a register with the given resource name.
ParserManager(const bfp::BFP &bfp)
Constructs a ParserManager object with the given BFP object.
void printInfoError(std::ostream &os=std::cerr) const
Prints resources not found and incompatibilities.
void logResourceFound(const std::string &resourceName, const GroupResource &group)
Logs that a resource has been found.
bool findDMA(const std::string &resourceName, const GroupResource &group, bfp::DMA *dma, const bool optional=false)
Finds a DMA with the given resource name.
Class holding information about one DMA.
Class holding information about one Register.
Custom string comparator for std::set.
bool operator()(const std::string &a, const std::string &b) const
Overloaded function call operator for comparing two strings.
Contains information about found, not found, and error resources for a group.
std::set< std::string, CustomStringComparator > found
Set of found resources.
std::set< std::string, CustomStringComparator > notFound
Set of not found resources.
std::unordered_map< std::string, std::string > error
Map of resource errors.