UGRAMM
Loading...
Searching...
No Matches
utilities.cpp File Reference
#include "../lib/UGRAMM.h"
#include "../lib/utilities.h"
#include "../lib/routing.h"
Include dependency graph for utilities.cpp:

Functions

std::string removeCurlyBrackets (const std::string &input)
 
std::string gNames_deliemter_changes (std::string gNames)
 
std::string string_remover (std::string original_string, std::string toRemove)
 
void jsonUppercase (json &j)
 
std::string readCommentSection (std::ifstream &inputFile)
 
bool skipPlacement (std::string hOpcode, json &jsonParsed)
 
bool needLocking (int HID, json &jsonParsed, std::string &jsonLockNode)
 
void readDeviceModelPragma (std::ifstream &deviceModelFile, json &UgrammPragmaConfig)
 
void readApplicationGraphPragma (std::ifstream &applicationGraphFile, json &UgrammPragmaConfig)
 
bool widthCheck (int hWidth, int gWidth)
 Checks if the application graph's node width is less than or equal to the device model's node width.
 
bool compatibilityCheck (int gID, int hID, std::map< int, NodeConfig > *hConfig, std::map< int, NodeConfig > *gConfig)
 
void printRoutingResults (int y, std::ofstream &positionedOutputFile, std::ofstream &unpositionedOutputFile, std::map< int, NodeConfig > *hConfig, std::map< int, NodeConfig > *gConfig)
 
void mandatoryFunCellConnections (int gNumber, std::string FunCellName, DirectedGraph *G, std::ofstream &positionedOutputFile, std::ofstream &unpositionedOutputFile)
 
void printPlacementResults (int gNumber, std::string gName, DirectedGraph *G, std::ofstream &positionedOutputFile, std::ofstream &unpositionedOutputFile, std::map< int, NodeConfig > *gConfig, json &UgrammPragmaConfig)
 
void printMappedResults (DirectedGraph *H, DirectedGraph *G, std::map< int, NodeConfig > *hConfig, std::map< int, NodeConfig > *gConfig, json &UgrammPragmaConfig)
 
void printName (int n)
 
void printVertexModels (DirectedGraph *H, DirectedGraph *G, std::map< int, NodeConfig > *hConfig, std::map< int, int > &invUsers)
 
void printRouting (int signal)
 
void readDeviceModel (DirectedGraph *G, std::map< int, NodeConfig > *gConfig)
 
void readApplicationGraph (DirectedGraph *H, std::map< int, NodeConfig > *hConfig, std::map< int, NodeConfig > *gConfig)
 

Variables

std::vector< std::string > colors
 
std::string input_pin_color = "#ADD8E6"
 
std::string output_pin_color = "#FFB6C1"
 
std::string unused_cell_color = "#A9A9A9"
 
std::map< std::string, std::string > funCellMapping
 

Function Documentation

◆ compatibilityCheck()

bool compatibilityCheck ( int gID,
int hID,
std::map< int, NodeConfig > * hConfig,
std::map< int, NodeConfig > * gConfig )

Checks whether the current opcode required by the application node is supported by the device model node.

This function determines if the opcode needed by the application node (represented by hOpcode) is compatible with or supported by the device model node type (represented by gType).

Parameters
gTypeThe type of the device model node. [ALU, MemPort etc..]
hOpcodeThe opcode required by the application node. [FMUL, FADD, INPUT, OUTPUT]
hConfigA map containing node configuration details of device-model graph.
gConfigA map containing node configuration details of device-model graph.
Returns
bool Returns true if the opcode is supported by the device model node, false otherwise.

◆ gNames_deliemter_changes()

std::string gNames_deliemter_changes ( std::string gNames)

Changes the delimiters in the given string from "." to "_" (neato dot format does not support "." delimiter in the node name)

◆ jsonUppercase()

void jsonUppercase ( json & j)

Converts all keys and values of the parsed JSON object to uppercase for normalization.

◆ mandatoryFunCellConnections()

void mandatoryFunCellConnections ( int gNumber,
std::string FunCellName,
DirectedGraph * G,
std::ofstream & positionedOutputFile,
std::ofstream & unpositionedOutputFile )

Connects associated pins to the specified FunCell in the device model graph.

◆ needLocking()

bool needLocking ( int HID,
json & jsonParsed,
std::string & jsonLockNode )

Checks whether locking is required for the given hNamed based on the information given in the JSON. In JSON, we define the locking code as "hName::gName"

◆ printMappedResults()

void printMappedResults ( DirectedGraph * H,
DirectedGraph * G,
std::map< int, NodeConfig > * hConfig,
std::map< int, NodeConfig > * gConfig,
json & UgrammPragmaConfig )

Prints mapping results in neato format: First displays the layout and then shows connections between the nodes.

◆ printName()

void printName ( int n)

Prints the device model cell name corresponding to a given boost id number from device model graph.

◆ printPlacementResults()

void printPlacementResults ( int gNumber,
std::string gName,
DirectedGraph * G,
std::ofstream & positionedOutputFile,
std::ofstream & unpositionedOutputFile,
std::map< int, NodeConfig > * gConfig,
json & UgrammPragmaConfig )

Prints placement information to a mapping-output file.

◆ printRouting()

void printRouting ( int signal)

Prints the routing details for the given signal.

◆ printRoutingResults()

void printRoutingResults ( int y,
std::ofstream & positionedOutputFile,
std::ofstream & unpositionedOutputFile,
std::map< int, NodeConfig > * hConfig,
std::map< int, NodeConfig > * gConfig )

Prints routing information to a mapping-output file.

◆ printVertexModels()

void printVertexModels ( DirectedGraph * H,
DirectedGraph * G,
std::map< int, NodeConfig > * hConfig,
std::map< int, int > & invUsers )

Prints vertex models of the application graph's nodes.

◆ readApplicationGraph()

void readApplicationGraph ( DirectedGraph * H,
std::map< int, NodeConfig > * hConfig,
std::map< int, NodeConfig > * gConfig )

Reads a DOT file and stores attributes into the application graph.

◆ readApplicationGraphPragma()

void readApplicationGraphPragma ( std::ifstream & applicationGraphFile,
json & UgrammPragmaConfig )

Reads, checks, and stores PRAGMA directives from the application graph file.

◆ readCommentSection()

std::string readCommentSection ( std::ifstream & inputFile)

Reads a multi-line comment containing PRAGMA from the given file.

◆ readDeviceModel()

void readDeviceModel ( DirectedGraph * G,
std::map< int, NodeConfig > * gConfig )

Reads a DOT file and stores attributes into the device model graph.

◆ readDeviceModelPragma()

void readDeviceModelPragma ( std::ifstream & deviceModelFile,
json & UgrammPragmaConfig )

Reads, checks, and stores PRAGMA directives from the device model file.

◆ removeCurlyBrackets()

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

Removes the curly brackets '{' and '}' from the given string. The kernels present in CGRA-ME have {} included in the node names, which hinders dot visualization.

◆ skipPlacement()

bool skipPlacement ( std::string hOpcode,
json & jsonParsed )

Checks whether placement is required for the given opcode based on the information given in the JSON. In JSON, we can either have opcode("Reg") or nodeType("ALU/Memport") to be skipped.

◆ string_remover()

std::string string_remover ( std::string original_string,
std::string toRemove )

Removes a specified substring from the original string.

◆ widthCheck()

bool widthCheck ( int hWidth,
int gWidth )

Checks if the application graph's node width is less than or equal to the device model's node width.

Checks if the application graph's node width is less than or equal to the device model's node width.

Variable Documentation

◆ colors

std::vector<std::string> colors
Initial value:
= {
"#FFA500",
"#FFFFE0",
"#D8BFD8",
"#D2B48C",
"#AFEEEE",
"#E0FFFF",
"#FFDAB9",
"#00FF00",
"#AFEEEE",
"#DDA0DD"
}

◆ funCellMapping

std::map<std::string, std::string> funCellMapping

◆ input_pin_color

std::string input_pin_color = "#ADD8E6"

◆ output_pin_color

std::string output_pin_color = "#FFB6C1"

◆ unused_cell_color

std::string unused_cell_color = "#A9A9A9"