OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ImplementationSimulator Class Referenceabstract

#include <ImplementationSimulator.hh>

Inheritance diagram for ImplementationSimulator:
Inheritance graph
Collaboration diagram for ImplementationSimulator:
Collaboration graph

Public Member Functions

 ImplementationSimulator (std::string tbFile, std::vector< std::string > hdlFiles, bool verbose, bool leaveDirty)
 
virtual ~ImplementationSimulator ()
 
virtual bool compile (std::vector< std::string > &errors)=0
 
virtual bool simulate (std::vector< std::string > &errors)=0
 

Protected Member Functions

virtual std::string createWorkDir ()
 
void setWorkDir (std::string dir)
 
std::string workDir () const
 
std::string tbDirectory () const
 
std::string tbFile () const
 
int hdlFileCount () const
 
std::string file (int index) const
 
bool verbose ()
 
void parseErrorMessages (std::vector< std::string > &inputMsg, std::vector< std::string > &errors)
 

Private Member Functions

 ImplementationSimulator ()
 

Private Attributes

std::string tbFile_
 Testbench file name with path. More...
 
std::vector< std::string > hdlFiles_
 Vector containing other vhdl files needed to compile testbench. More...
 
std::string baseDir_
 Directory path of testbench file. More...
 
std::string workDir_
 Working directory where testbench is compiled and simulated. More...
 
std::string oldCwd_
 Old current working directory (before changing to workDir_) More...
 
bool verbose_
 Enable verbose output. More...
 
bool leaveDirty_
 Don't delete work dir. More...
 

Detailed Description

Definition at line 39 of file ImplementationSimulator.hh.

Constructor & Destructor Documentation

◆ ImplementationSimulator() [1/2]

ImplementationSimulator::ImplementationSimulator ( std::string  tbFile,
std::vector< std::string >  hdlFiles,
bool  verbose,
bool  leaveDirty 
)

Definition at line 42 of file ImplementationSimulator.cc.

46  :
47  tbFile_(tbFile),
48  hdlFiles_(hdlFiles), baseDir_(""), workDir_(""), oldCwd_(""),
49  verbose_(verbose), leaveDirty_(leaveDirty) {
50 
53 }

References baseDir_, FileSystem::currentWorkingDir(), FileSystem::directoryOfPath(), oldCwd_, and tbFile().

Here is the call graph for this function:

◆ ~ImplementationSimulator()

ImplementationSimulator::~ImplementationSimulator ( )
virtual

Definition at line 55 of file ImplementationSimulator.cc.

55  {
56  if (!workDir_.empty() && FileSystem::fileExists(workDir_)) {
57  if (!leaveDirty_) {
59  }
60  }
61  if (!oldCwd_.empty()) {
63  }
64 }

References FileSystem::changeWorkingDir(), FileSystem::fileExists(), leaveDirty_, oldCwd_, FileSystem::removeFileOrDirectory(), and workDir_.

Here is the call graph for this function:

◆ ImplementationSimulator() [2/2]

ImplementationSimulator::ImplementationSimulator ( )
private

Member Function Documentation

◆ compile()

virtual bool ImplementationSimulator::compile ( std::vector< std::string > &  errors)
pure virtual

◆ createWorkDir()

std::string ImplementationSimulator::createWorkDir ( )
protectedvirtual

Reimplemented in ModelsimSimulator.

Definition at line 66 of file ImplementationSimulator.cc.

66  {
67  string work = baseDir_ + FileSystem::DIRECTORY_SEPARATOR + "work";
68  if (!FileSystem::createDirectory(work)) {
69  work = "";
70  }
71  workDir_ = work;
72  return workDir_;
73 }

References baseDir_, FileSystem::createDirectory(), FileSystem::DIRECTORY_SEPARATOR, and workDir_.

Referenced by GhdlSimulator::compile().

Here is the call graph for this function:

◆ file()

std::string ImplementationSimulator::file ( int  index) const
protected

Definition at line 95 of file ImplementationSimulator.cc.

95  {
96  return hdlFiles_.at(index);
97 }

References hdlFiles_.

Referenced by GhdlSimulator::compile(), ModelsimSimulator::compile(), ModelsimSimulator::compileOneFile(), and GhdlSimulator::importFile().

◆ hdlFileCount()

int ImplementationSimulator::hdlFileCount ( ) const
protected

Definition at line 91 of file ImplementationSimulator.cc.

91  {
92  return hdlFiles_.size();
93 }

References hdlFiles_.

Referenced by GhdlSimulator::compile(), and ModelsimSimulator::compile().

◆ parseErrorMessages()

void ImplementationSimulator::parseErrorMessages ( std::vector< std::string > &  inputMsg,
std::vector< std::string > &  errors 
)
protected

Definition at line 104 of file ImplementationSimulator.cc.

105  {
106  string tag = "TCE Assert";
107  for (unsigned int i = 0; i < inputMsg.size(); i++) {
108  string::size_type loc = inputMsg.at(i).find(tag, 0);
109  if (loc != string::npos) {
110  string errorMsg = FileSystem::fileOfPath(tbFile_) + ": "
111  + inputMsg.at(i);
112  errors.push_back(errorMsg);
113  }
114  }
115 }

References FileSystem::fileOfPath(), and tbFile_.

Referenced by GhdlSimulator::simulate(), and ModelsimSimulator::simulate().

Here is the call graph for this function:

◆ setWorkDir()

void ImplementationSimulator::setWorkDir ( std::string  dir)
protected

Definition at line 75 of file ImplementationSimulator.cc.

75  {
76  workDir_ = dir;
77 }

References workDir_.

Referenced by ModelsimSimulator::createWorkDir().

◆ simulate()

virtual bool ImplementationSimulator::simulate ( std::vector< std::string > &  errors)
pure virtual

◆ tbDirectory()

std::string ImplementationSimulator::tbDirectory ( ) const
protected

◆ tbFile()

std::string ImplementationSimulator::tbFile ( ) const
protected

Definition at line 87 of file ImplementationSimulator.cc.

87  {
88  return tbFile_;
89 }

References tbFile_.

Referenced by GhdlSimulator::compile(), ModelsimSimulator::compile(), and ImplementationSimulator().

◆ verbose()

bool ImplementationSimulator::verbose ( )
protected

◆ workDir()

std::string ImplementationSimulator::workDir ( ) const
protected

Member Data Documentation

◆ baseDir_

std::string ImplementationSimulator::baseDir_
private

Directory path of testbench file.

Definition at line 82 of file ImplementationSimulator.hh.

Referenced by createWorkDir(), ImplementationSimulator(), and tbDirectory().

◆ hdlFiles_

std::vector<std::string> ImplementationSimulator::hdlFiles_
private

Vector containing other vhdl files needed to compile testbench.

Definition at line 80 of file ImplementationSimulator.hh.

Referenced by file(), and hdlFileCount().

◆ leaveDirty_

bool ImplementationSimulator::leaveDirty_
private

Don't delete work dir.

Definition at line 90 of file ImplementationSimulator.hh.

Referenced by ~ImplementationSimulator().

◆ oldCwd_

std::string ImplementationSimulator::oldCwd_
private

Old current working directory (before changing to workDir_)

Definition at line 86 of file ImplementationSimulator.hh.

Referenced by ImplementationSimulator(), and ~ImplementationSimulator().

◆ tbFile_

std::string ImplementationSimulator::tbFile_
private

Testbench file name with path.

Definition at line 78 of file ImplementationSimulator.hh.

Referenced by parseErrorMessages(), and tbFile().

◆ verbose_

bool ImplementationSimulator::verbose_
private

Enable verbose output.

Definition at line 88 of file ImplementationSimulator.hh.

Referenced by verbose().

◆ workDir_

std::string ImplementationSimulator::workDir_
private

Working directory where testbench is compiled and simulated.

Definition at line 84 of file ImplementationSimulator.hh.

Referenced by createWorkDir(), setWorkDir(), workDir(), and ~ImplementationSimulator().


The documentation for this class was generated from the following files:
ImplementationSimulator::hdlFiles_
std::vector< std::string > hdlFiles_
Vector containing other vhdl files needed to compile testbench.
Definition: ImplementationSimulator.hh:80
FileSystem::removeFileOrDirectory
static bool removeFileOrDirectory(const std::string &path)
Definition: FileSystem.cc:493
ImplementationSimulator::verbose
bool verbose()
Definition: ImplementationSimulator.cc:99
FileSystem::createDirectory
static bool createDirectory(const std::string &path)
Definition: FileSystem.cc:400
ImplementationSimulator::workDir_
std::string workDir_
Working directory where testbench is compiled and simulated.
Definition: ImplementationSimulator.hh:84
FileSystem::fileOfPath
static std::string fileOfPath(const std::string pathName)
Definition: FileSystem.cc:101
ImplementationSimulator::tbFile
std::string tbFile() const
Definition: ImplementationSimulator.cc:87
ImplementationSimulator::baseDir_
std::string baseDir_
Directory path of testbench file.
Definition: ImplementationSimulator.hh:82
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
ImplementationSimulator::leaveDirty_
bool leaveDirty_
Don't delete work dir.
Definition: ImplementationSimulator.hh:90
ImplementationSimulator::oldCwd_
std::string oldCwd_
Old current working directory (before changing to workDir_)
Definition: ImplementationSimulator.hh:86
ImplementationSimulator::tbFile_
std::string tbFile_
Testbench file name with path.
Definition: ImplementationSimulator.hh:78
ImplementationSimulator::verbose_
bool verbose_
Enable verbose output.
Definition: ImplementationSimulator.hh:88
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
FileSystem::changeWorkingDir
static bool changeWorkingDir(const std::string &path)
Definition: FileSystem.cc:185
FileSystem::fileExists
static bool fileExists(const std::string fileName)
FileSystem::currentWorkingDir
static std::string currentWorkingDir()
Definition: FileSystem.cc:142