47 #ifndef FLOPOCOWRAPPER_HPP 48 #define FLOPOCOWRAPPER_HPP 62 #define FILE_EXT ".vhdl" 63 #define ENCODE_NAME(FU_name, FU_prec_in, FU_prec_out, pipe_parameter) \ 65 ((FU_name) + "_" + STR(FU_prec_in) + "_" + STR(FU_prec_out) + ((pipe_parameter) != "" ? "_" + (pipe_parameter) : "")) 66 #define FLOPOCO_ADDITIONAL_BITS 2 68 #define IN_WRAP_PREFIX "in_wrap_" 70 #define OUT_WRAP_PREFIX "out_wrap_" 72 #define WRAPPED_PREFIX "wrapped_" 144 flopoco::Operator* get_FU(std::string FU_name_stored)
const;
153 const std::vector<std::string> get_ports(
const std::string& FU_name_stored,
unsigned int expected_ports,
154 port_type type,
bool check_ports =
true)
const;
160 const std::string get_port(
port_type type)
const;
173 int InternalWriteVHDL(
const std::string& FU_name,
const unsigned int FU_prec_in,
const unsigned int FU_prec_out,
174 const std::string&
filename,
const std::string& pipe_parameter);
183 void outputHeaderVHDL(
const std::string& FU_name_stored, std::ostream& os)
const;
184 void outputWrapVHDL(
const std::string& FU_name_stored, std::ostream& os,
const std::string& pipe_parameter);
185 void outputPortDeclaration(
const std::string& FU_prefix,
const std::string& FU_name_stored, std::ostream& os,
187 void outputSignals(
const std::string& FU_name_stored, std::ostream& os);
188 void outputPortMap(
const std::string& FU_name_stored, std::ostream& os,
const std::string& pipe_parameter);
213 void add_FU(
const std::string& FU_type,
unsigned int FU_prec_in,
unsigned int FU_prec_out,
214 const std::string& FU_name,
const std::string& pipe_parameter);
222 unsigned int get_FUPipelineDepth(
const std::string& FU_name,
const unsigned int FU_prec_in,
223 const unsigned int FU_prec_out,
const std::string& pipe_parameter)
const;
235 int writeVHDL(
const std::string& FU_name,
const unsigned int FU_prec_in,
const unsigned int FU_prec_out,
236 std::string pipe_parameter, std::string&
filename);
242 std::string writeVHDLcommon();
249 return this->FU_files;
256 bool is_unit_written(
const std::string& FU_name,
const unsigned int FU_prec_in,
const unsigned int FU_prec_out,
257 const std::string& pipe_parameter)
const 259 return this->FU_files.find(
ENCODE_NAME(FU_name, FU_prec_in, FU_prec_out, pipe_parameter) +
FILE_EXT) !=
260 this->FU_files.end();
268 const std::vector<std::string>
get_in_ports(
const std::string& FU_name,
const unsigned int FU_prec_in,
269 const unsigned int FU_prec_out,
const unsigned int expected_ports,
270 const std::string& pipe_parameter)
const 275 const std::vector<std::string>
get_out_ports(
const std::string& FU_name,
const unsigned int FU_prec_in,
276 const unsigned int FU_prec_out,
const unsigned int expected_ports,
277 const std::string& pipe_parameter)
const 289 static void DECODE_BITS(
unsigned int FU_prec,
unsigned int& n_mant,
unsigned int& n_exp);
291 static constexpr
double DEFAULT_TARGET_FREQUENCY = 100.0;
Forward declarations of FloPoCo classes.
void * top(node_stack *head)
std::vector< flopoco::Operator * > oplist
File containing functions and utilities to support the printing of debug messagges.
bool is_unit_written(const std::string &FU_name, const unsigned int FU_prec_in, const unsigned int FU_prec_out, const std::string &pipe_parameter) const
Checks if a Functional Unit have been written to a VHDL file.
REF_FORWARD_DECL(flopoco_wrapper)
RefCount type definition of the flopoco_wrapper class structure.
const std::vector< std::string > get_out_ports(const std::string &FU_name, const unsigned int FU_prec_in, const unsigned int FU_prec_out, const unsigned int expected_ports, const std::string &pipe_parameter) const
Simple pretty print functor.
simple_indent PP
Pretty print functor object used to indent the generated code.
const CustomUnorderedSet< std::string > & get_files_written()
Returns the Functional Units that have been written to a VHDL file.
enum { UT_ADD, UT_SUB, UT_MULT, UT_DIV, UT_FF_CONV, UT_ADDSUB, UT_UFIX2FP, UT_IFIX2FP, UT_FP2UFIX, UT_FP2IFIX, UT_EXP, UT_SQRT, UT_compare_expr, UT_LOG, UT_POW, UT_UNKNOWN } unit_type
unit type
exceptions managed by PandA
enum { port_in, port_out, clk, rst } port_type
Port types.
#define ENCODE_NAME(FU_name, FU_prec_in, FU_prec_out, pipe_parameter)
Name of the stored Functional Unit.
redefinition of map to manage ordered/unordered structures
#define WRAPPED_PREFIX
Suffix appended to the internal (wrapped) Functional Unit.
CustomUnorderedSet< std::string > FU_files
Set of Functional Units written to a .vhdl file.
CustomUnorderedMap< std::string, std::pair< unsigned int, unsigned int > > FU_to_prec
Maps a Functional Unit to its precision.
#define FILE_EXT
Default extension for generated files.
const std::vector< std::string > get_in_ports(const std::string &FU_name, const unsigned int FU_prec_in, const unsigned int FU_prec_out, const unsigned int expected_ports, const std::string &pipe_parameter) const
Return the names of input and output ports (multiple names, thus a vector of strings) ...
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
redefinition of set to manage ordered/unordered structures
This file collects some utility functions and macros.
Template definition of refcount.
Very simple pretty printer functor.
Main class for wrapping the FloPoCo code generator.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
enum { top, wrapped, in_wrap, out_wrap } component_type
Component types.