Polymorphic Register Files Simulator
This program aims at simulating the Polymorphic Register Files behaviour, as described in "On Implementability of Polymorphic Register Files"
utility.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "prf.h"
Include dependency graph for utility.h:

Go to the source code of this file.

Data Structures

struct  Options
 Data structure used to store the user's given arguments. More...
 

Functions

Options parseArguments (int argc, char **argv)
 Parses the user arguments. More...
 
void printMatrix (int **inputMatrix, int dim1, int dim2)
 Prints in the console a formatted 2D matrix. More...
 
void printConflicts (int **inputMatrix, int dim1, int dim2)
 Prints in the console a conflict matrix, highlighting the conflicts. More...
 
void printMatrixHighlight (int **inputMatrix, int dim1, int dim2, int **highlightMatrix, int dimH1, int dimH2)
 Prints in the console a matrix, highlighing certain elements. More...
 
void printUsage (char *programName)
 Prints in the console the usage informations. More...
 
void performBlockRead (int index_i, int index_j, acc_type type, int **data_elements1, PolymorphicRegister *pR, int mode)
 Prints the report information of a block read. More...
 
char * accessStringFromAccessType (acc_type type)
 
int compareAddress (void *a, void *b)
 

Function Documentation

Options parseArguments ( int  argc,
char **  argv 
)

Parses the user arguments.

Parameters
argcnumber of user arguments.
argvlist of user's arguments.
Returns
Options struct containing the settings defined by the user.
See also
Options
void performBlockRead ( int  index_i,
int  index_j,
acc_type  type,
int **  data_elements1,
PolymorphicRegister pR,
int  mode 
)

Prints the report information of a block read.

Parameters
index_ithe horizontal index of the top-left element of the block read.
index_jthe vertical index of the top-left element of the block read.
typeaccess type defining the block access shape.
data_elements1the 2D array containing original input matrix.
pRpointer to the PolymorphicRegister used for the block read.
modeselect the access mode ( STANDARD or CUSTOM )
void printConflicts ( int **  inputMatrix,
int  dim1,
int  dim2 
)

Prints in the console a conflict matrix, highlighting the conflicts.

Parameters
inputMatrixthe 2D array containing the confict's data.
dim1the horizontal dimension of the given matrix.
dim2the vertical dimension of the given matrix.
void printMatrix ( int **  inputMatrix,
int  dim1,
int  dim2 
)

Prints in the console a formatted 2D matrix.

Parameters
inputMatrixthe 2D array containing the data.
dim1the horizontal dimension of the given matrix.
dim2the vertical dimension of the given matrix.
void printMatrixHighlight ( int **  inputMatrix,
int  dim1,
int  dim2,
int **  highlightMatrix,
int  dimH1,
int  dimH2 
)

Prints in the console a matrix, highlighing certain elements.

Parameters
inputMatrixthe 2D array containing all the matrix data.
dim1the horizontal dimension of the given matrix.
dim2the vertical dimension of the given matrix.
highlightMatrixthe 2D array containing the elements of the inputMatrix to highlight.
dimH1the horizontal dimension of the given highlightMatrix.
dimH2the vertical dimension of the given highlightMatrix.
void printUsage ( char *  programName)

Prints in the console the usage informations.

Parameters
programNamename of the executable