PandA-2024.02
FPlt_expr.cpp
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  */
43 #include "config_SKIP_WARNING_SECTIONS.hpp"
45 
46 #if SKIP_WARNING_SECTIONS
47 #pragma GCC diagnostic ignored "-Wshadow"
48 #pragma GCC diagnostic ignored "-Wsign-conversion"
49 #pragma GCC diagnostic ignored "-Wconversion"
50 #pragma GCC diagnostic ignored "-Wunused-parameter"
51 #endif
52 
53 #include <cmath>
54 #include <cstring>
55 #include <iosfwd>
56 #include <sstream>
57 #include <vector>
58 
59 #include <cstddef>
60 #include <gmp.h>
61 
62 #include "utils.hpp"
63 #include <gmpxx.h>
64 
65 #include "FPAdderSinglePath.hpp"
66 #include "FPlt_expr.hpp"
67 
68 #include "custom_map.hpp"
69 #include <cmath>
70 #include <cstdlib>
71 #include <iomanip>
72 #include <list>
73 #include <locale>
74 #include <sstream>
75 #include <string>
76 #include <vector>
77 
78 #include <cstdio>
79 #include <mpfr.h>
80 
81 #include "flopoco_wrapper.hpp"
82 
83 using namespace std;
84 
85 namespace flopoco
86 {
87  extern vector<Operator*> oplist;
88 
89 #define DEBUGVHDL 0
90 
91  FPlt_expr::FPlt_expr(Target* _target, int wE, int wF) : Operator(_target)
92  {
93  ostringstream name;
94 
95  name << "FPlt_expr_" << wE << "_" << wF;
96  setName(name.str());
97 
98  setCopyrightString("Fabrizio Ferrandi (2011-2018)");
99 
100  /* Set up the IO signals */
101 
102  addFPInput("X", wE, wF);
103  addFPInput("Y", wE, wF);
104  addOutput("R", 1);
105 
106  /* VHDL code description */
107  manageCriticalPath(_target->localWireDelay() + _target->lutDelay());
108  vhdl << tab << declare("nX", wE + wF + 3) << " <= X" << range(wE + wF + 2, wE + wF + 1) << " & not(X"
109  << of(wE + wF) << ") & X" << range(wE + wF - 1, 0) << ";" << endl;
110  auto* value_difference = new FPAdderSinglePath(_target, wE, wF, wE, wF, wE, wF);
111  value_difference->changeName(getName() + "value_difference");
112  oplist.push_back(value_difference);
113  inPortMap(value_difference, "X", "Y");
114  inPortMap(value_difference, "Y", "nX");
115  outPortMap(value_difference, "R", "valueDiff");
116  vhdl << instance(value_difference, "value_difference");
117  syncCycleFromSignal("valueDiff");
118  setCriticalPath(value_difference->getOutputDelay("R"));
119 
120  manageCriticalPath(_target->localWireDelay() + _target->lutDelay());
121  vhdl << tab << "R(0) <= '1' when (valueDiff" << of(wE + wF) << "='0') and (valueDiff"
122  << range(wE + wF + 2, wE + wF + 1) << " /= \"00\") else '0';" << endl;
123  }
124 
125  FPlt_expr::~FPlt_expr() = default;
126 
127  void FPlt_expr::emulate(TestCase*)
128  {
129  // TODO
130  }
131 
133  {
134  }
135 
136 } // namespace flopoco
Forward declarations of FloPoCo classes.
ub1 tab[]
Definition of hash function for EdgeDescriptor.
Definition: graph.hpp:1321
FPlt_expr module for flopoco.
redefinition of map to manage ordered/unordered structures
~FPlt_expr() override
destructor
void buildStandardTestCases(TestCaseList *tcl) override
Definition: FPlt_expr.cpp:132
void emulate(TestCase *tc) override
Definition: FPlt_expr.cpp:127
Wrapper to FloPoCo for VHDL code generation.
vector< Operator * > oplist
Definition: FPge_expr.cpp:88

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