00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef ARITH_H
00030 #define ARITH_H
00031
00032 #include <basicdevicefactory.h>
00033 #include <basicdevice.h>
00034 #include <phbib.h>
00035 #include <signals.h>
00036 #include <freeconnectionsystem.h>
00037
00038 namespace simthlib
00039 {
00040
00058 class Add : public simth::Device
00059 {
00060 protected:
00061 unsigned int iports;
00062
00063 Add(int deviceID, simth::DeviceSystemIntf* system,
00064 const simth::PropertyList& pl,
00065 unsigned int _iports);
00066
00067 public:
00068 virtual void updateInputLengths();
00069 virtual void updateOutputLengths();
00070
00071 template<class seqT>
00072 void process();
00073
00074 void print(std::ostream &os) const;
00075
00076 static void init(const std::string& fileName,
00077 simth::Device** dev,
00078 simth::DeviceSystemIntf* sysPtr,
00079 int ID,
00080 const std::string& regionQualifier);
00081
00082 static void init(simth::DeviceFactory& registration);
00083 };
00084
00093 template<class seqT>
00094 class AddT : public Add
00095 {
00096 public:
00097 AddT(int deviceID, simth::DeviceSystemIntf* system,
00098 const simth::PropertyList& pl,
00099 unsigned int _iports);
00100
00102 AddT(int deviceID,
00103 simth::DeviceSystemIntf* system,
00104 const simth::PropertyList& pl)
00105 : Add (deviceID, system, pl,
00106 pl.simth::PropertyList::getProperty<unsigned>("input_ports"))
00107 {
00108 insertInputInterface< seqT >(iports);
00109 insertOutputInterface< seqT >();
00110 }
00111
00112 void process()
00113 { Add::process<seqT>(); };
00114 };
00115
00116
00117
00118
00141 class Multiply : public simth::Device
00142 {
00143 protected:
00144 Multiply(int deviceID, simth::DeviceSystemIntf* system,
00145 const simth::PropertyList& pl,
00146 unsigned input_ports);
00147 unsigned iports;
00148
00149 public:
00150 virtual void updateInputLengths();
00151 virtual void updateOutputLengths();
00152
00153 void print(std::ostream &os) const;
00154
00155 static void init(const std::string& fileName,
00156 simth::Device** dev,
00157 simth::DeviceSystemIntf* sysPtr,
00158 int ID,
00159 const std::string& regionQualifier);
00160 };
00161
00162
00169 template<class seqT>
00170 class MultiplyT : public Multiply
00171 {
00172 protected:
00173 typename seqT::value_type factor;
00174
00175 public:
00176 MultiplyT(int deviceID, simth::DeviceSystemIntf* system,
00177 const simth::PropertyList& pl,
00178 typename seqT::value_type _factor,
00179 unsigned input_ports);
00180
00182 MultiplyT(int deviceID,
00183 simth::DeviceSystemIntf* system,
00184 const simth::PropertyList& pl)
00185 : Multiply (deviceID, system, pl,
00186 pl.simth::PropertyList::getProperty<unsigned>("input_ports"))
00187 , factor(pl.simth::PropertyList::getProperty<typename seqT::value_type>("factor"))
00188 {
00189 insertInputInterface< seqT >(iports);
00190 insertOutputInterface< seqT >();
00191 }
00192
00193 void process();
00194 };
00195
00208 template<class seqT>
00209 class InvertT : public Multiply
00210 {
00211 public:
00212 InvertT(int deviceID, simth::DeviceSystemIntf* system,
00213 const simth::PropertyList& pl);
00214
00215 void process();
00216 };
00217
00218
00219 namespace Invert
00220 {
00221 void init(const std::string& fileName,
00222 simth::Device** dev,
00223 simth::DeviceSystemIntf* sysPtr,
00224 int ID,
00225 const std::string& regionQualifier);
00226 }
00227
00228 }
00229
00230
00231
00232 #endif