PandA-2024.02
hls_c_writer.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  */
41 #ifndef HLS_C_WRITER_HPP
42 #define HLS_C_WRITER_HPP
43 
45 #include "c_writer.hpp"
46 
48 #include "refcount.hpp"
49 
50 CONSTREF_FORWARD_DECL(HLSCBackendInformation);
51 
52 class HLSCWriter : public CWriter
53 {
54  protected:
57 
62  void WriteParamDecl(const BehavioralHelperConstRef behavioral_helper);
63 
71  void WriteParamInitialization(const BehavioralHelperConstRef behavioral_helper,
72  const std::map<std::string, std::string>& curr_test_vector);
73 
80  void WriteTestbenchFunctionCall(const BehavioralHelperConstRef behavioral_helper);
81 
89  void WriteSimulatorInitMemory(const unsigned int function_id);
90 
94  virtual void WriteExtraInitCode();
95 
96  virtual void WriteExtraCodeBeforeEveryMainCall();
97 
101  virtual void WriteMainTestbench();
102 
106  void WriteGlobalDeclarations() override;
107 
112  void WriteFunctionImplementation(unsigned int function_index) override;
113 
117  void WriteBuiltinWaitCall() override;
118 
119  public:
129  HLSCWriter(const CBackendInformationConstRef hls_c_backend_information, const HLS_managerConstRef _HLSMgr,
131  const ParameterConstRef _parameters, bool verbose = true);
132 
133  virtual ~HLSCWriter();
134 
139  void WriteFile(const std::string& file_name) override;
140 
144  void WriteHeader() override;
145 };
146 #endif
HLSCWriter(const CBackendInformationConstRef hls_c_backend_information, const HLS_managerConstRef _HLSMgr, const InstructionWriterRef instruction_writer, const IndentedOutputStreamRef indented_output_stream, const ParameterConstRef _parameters, bool verbose=true)
Constructor of the class.
const CBackendInformationConstRef c_backend_info
Backend information.
virtual ~HLSCWriter()
void WriteHeader() override
Writes the header of the file.
Class used to write the C code representing a program, this class can&#39;t be directly instantiated sinc...
Definition: c_writer.hpp:91
void WriteBuiltinWaitCall() override
Writes implementation of __builtin_wait_call.
bool verbose
Verbosity means that a comment is printed for each line in the output file.
Definition: c_writer.hpp:116
void WriteFunctionImplementation(unsigned int function_index) override
Write function implementation.
void WriteSimulatorInitMemory(const unsigned int function_id)
Write some print statements used to dump the values used by the HDL to initialize the memory before t...
void WriteTestbenchFunctionCall(const BehavioralHelperConstRef behavioral_helper)
Writes a call to the top function to be tested, using its parameters.
CONSTREF_FORWARD_DECL(HLSCBackendInformation)
Superclass include.
const IndentedOutputStreamRef indented_output_stream
Represents the stream we are currently writing to.
Definition: c_writer.hpp:101
void WriteParamInitialization(const BehavioralHelperConstRef behavioral_helper, const std::map< std::string, std::string > &curr_test_vector)
Initialize the parameters of the function.
Template definition of refcount.
void WriteGlobalDeclarations() override
Writes the global declarations.
virtual void WriteExtraInitCode()
Write additional initialization code needed by subclasses.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
This file contains the routines necessary to create a C executable program.
virtual void WriteMainTestbench()
Writes the main() of the testbench C program.
void WriteFile(const std::string &file_name) override
Writes the final C file.
virtual void WriteExtraCodeBeforeEveryMainCall()
void WriteParamDecl(const BehavioralHelperConstRef behavioral_helper)
Write declaration of the top function parameters.

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