PandA-2024.02
SimulationTool.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
42 #ifndef _SIMULATION_TOOL_HPP_
43 #define _SIMULATION_TOOL_HPP_
44 
45 #include "refcount.hpp"
46 
47 #include <list>
48 #include <string>
49 #include <vector>
50 
54 {
55  public:
57  using type_t = enum { UNKNOWN = 0, MODELSIM, XSIM, VERILATOR };
58 
59  static type_t to_sim_type(const std::string& str);
60 
61  protected:
64 
67 
69  unsigned int output_level;
70 
71  const std::string top_fname;
72 
74  std::string generated_script;
75 
77  std::string log_file;
78 
80  const std::string inc_dirs;
81 
85  virtual std::string GenerateScript(std::ostream& script, const std::string& top_filename,
86  const std::list<std::string>& file_list) = 0;
87 
88  std::string GenerateLibraryBuildScript(std::ostream& script, const std::string& libtb_filename,
89  std::string& beh_cflags) const;
90 
91  public:
95  explicit SimulationTool(const ParameterConstRef& Param, const std::string& top_fname, const std::string& inc_dirs);
96 
100  virtual ~SimulationTool();
101 
105  static SimulationToolRef CreateSimulationTool(type_t type, const ParameterConstRef& Param, const std::string& suffix,
106  const std::string& top_fname, const std::string& inc_dirs);
107 
111  virtual void CheckExecution();
112 
116  virtual std::string GenerateSimulationScript(const std::string& top_filename, std::list<std::string> file_list);
117 
121  virtual void Simulate(unsigned long long& accum_cycles, unsigned long long& n_testcases);
122 
128  void DetermineCycles(unsigned long long int& accum_cycles, unsigned long long& n_testcases);
129 
134  virtual void Clean() const;
135 };
138 #endif
std::string log_file
log file
const ParameterConstRef Param
class containing all the parameters
REF_FORWARD_DECL(SimulationTool)
virtual std::string GenerateSimulationScript(const std::string &top_filename, std::list< std::string > file_list)
Generates the proper simulation script.
virtual std::string GenerateScript(std::ostream &script, const std::string &top_filename, const std::list< std::string > &file_list)=0
Performs the actual writing.
static SimulationToolRef CreateSimulationTool(type_t type, const ParameterConstRef &Param, const std::string &suffix, const std::string &top_fname, const std::string &inc_dirs)
Factory method.
virtual ~SimulationTool()
Destructor.
void DetermineCycles(unsigned long long int &accum_cycles, unsigned long long &n_testcases)
Determines the average number of cycles for the simulation(s)
std::string GenerateLibraryBuildScript(std::ostream &script, const std::string &libtb_filename, std::string &beh_cflags) const
static type_t to_sim_type(const std::string &str)
std::string generated_script
generated script
SimulationTool(const ParameterConstRef &Param, const std::string &top_fname, const std::string &inc_dirs)
Constructor.
Template definition of refcount.
CONSTREF_FORWARD_DECL(Parameter)
int debug_level
debug level of the class
unsigned int output_level
verbosity level of the class
virtual void CheckExecution()
Checks if the current specification can be executed or not.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
virtual void Simulate(unsigned long long &accum_cycles, unsigned long long &n_testcases)
Performs the simulation and returns the number of cycles.
char str[25]
Definition: fixedptc.c:8
enum { UNKNOWN=0, MODELSIM, XSIM, VERILATOR } type_t
supported synthesis tools
const std::string top_fname
const std::string inc_dirs
comma separated list of include dirs
virtual void Clean() const
Remove files created during simulation FIXME: this should become pure virtual.

Generated on Mon Feb 12 2024 13:02:56 for PandA-2024.02 by doxygen 1.8.13