47 #include <Xyce_config.h>
68 #include <N_UTL_IndentStreamBuf.h>
69 #include <N_ERH_Message.h>
78 std::ostream &laTexComposite(std::ostream &os,
const std::string &composite_name,
const std::string &composite_description,
const ParametricData<void> ¶meters);
89 laTexProtect(
const std::string &t)
97 std::ostream &
operator<<(std::ostream &os,
const laTexProtect &laTex_protect)
99 for (std::string::const_iterator cit = laTex_protect.text.begin(); cit != laTex_protect.text.end(); ++cit) {
111 laTexClean(
const std::string &t)
115 const std::string &
text;
119 std::ostream &
operator<<(std::ostream &os,
const laTexClean &laTex_clean)
121 for (std::string::const_iterator cit = laTex_clean.text.begin(); cit != laTex_clean.text.end(); ++cit) {
130 const std::string &categoryName(
int category) {
131 static std::vector<std::string> s_categoryList;
133 if (s_categoryList.empty()) {
134 s_categoryList.resize(
CAT_MAX);
136 s_categoryList[
CAT_AC] =
"AC Parameters";
137 s_categoryList[
CAT_BASIC] =
"Basic Parameters";
138 s_categoryList[
CAT_BIN] =
"Bin Parameters";
139 s_categoryList[
CAT_CAP] =
"Capacitance Parameters";
140 s_categoryList[
CAT_CONTROL] =
"Control Parameters";
141 s_categoryList[
CAT_CURRENT] =
"Current Parameters";
142 s_categoryList[
CAT_DC] =
"DC Parameters";
144 s_categoryList[
CAT_DOPING] =
"Doping Parameters";
145 s_categoryList[
CAT_FLICKER] =
"Flicker and Thermal Noise Parameters";
147 s_categoryList[
CAT_INITIAL] =
"Initial Condition Parameters";
149 s_categoryList[
CAT_NQS] =
"NQS Parameters";
150 s_categoryList[
CAT_RADP] =
"Radiation Pulse Parameters";
151 s_categoryList[
CAT_RES] =
"Resistance Parameters";
152 s_categoryList[
CAT_PROCESS] =
"Process Parameters";
153 s_categoryList[
CAT_RF] =
"RF Parameters";
154 s_categoryList[
CAT_RAD] =
"Radiation Parameters";
155 s_categoryList[
CAT_TEMP] =
"Temperature Parameters";
156 s_categoryList[
CAT_TUNNEL] =
"Tunnelling Parameters";
157 s_categoryList[
CAT_VBI] =
"Built-in Potential Lowering Parameters";
158 s_categoryList[
CAT_VOLT] =
"Voltage Parameters";
159 s_categoryList[
CAT_ASYMRDS] =
"Asymmetric and Bias-Dependent $R_{ds}$ Parameters";
160 s_categoryList[
CAT_ASYMDDS] =
"Asymmetric Source/Drain Junction Diode Parameters";
161 s_categoryList[
CAT_IMPACT] =
"Impact Ionization Current Parameters";
162 s_categoryList[
CAT_GDLEAKAGE] =
"Gate-induced Drain Leakage Model Parameters";
163 s_categoryList[
CAT_STRESS] =
"Stress Effect Model Parameters";
164 s_categoryList[
CAT_WELL] =
"Well-Proximity Effect Model Parameters";
166 s_categoryList[
CAT_STATIC] =
"Static Model Parameters";
167 s_categoryList[
CAT_DYNAMIC] =
"Dynamic Model Parameters";
168 s_categoryList[
CAT_CARRIER] =
"Carrier Model Parameters";
169 s_categoryList[
CAT_OUTPUT] =
"Model Output Parameters";
170 s_categoryList[
CAT_PULSE] =
"Pulse Parameters";
172 s_categoryList[
CAT_SCALING] =
"Scaling Parameters";
176 return s_categoryList.size() ? s_categoryList[category] : s_categoryList[
CAT_UNKNOWN];
179 void unitDescription(
180 const std::string & name,
181 const OrderedParameterMap & parameter_map,
182 const Descriptor & descriptor,
185 std::string & description)
187 unit = descriptor.getUnit();
191 if (name == (*it).Name)
193 description = (*it).Description;
194 category = (*it).Category;
200 if (description.empty())
202 Report::UserWarning0() <<
"No description given for " << name <<
". Setting category and unit as UNKNOWN.";
204 description =
"Unspecified";
211 category = descriptor.getCategory();
215 std::string base_name = name.substr(1);
218 description =
"Length";
221 else if (name[0] ==
'W')
223 description =
"Width";
226 else if (name[0] ==
'P')
228 description =
"Cross-term";
231 description +=
" dependence of ";
232 description += base_name;
234 OrderedParameterMap::const_iterator it = parameter_map.find(base_name);
235 if (it == parameter_map.end())
237 Report::DevelFatal().in(
"DeviceEntity::getUnitDescription")
238 <<
"Base parameter not found for " << name <<
" in " << base_name;
242 const Descriptor &base_descriptor = *(*it).second;
244 std::string base_description;
248 unitDescription(base_name, parameter_map, base_descriptor, base_unit, base_category, base_description);
251 for (
int i = 0; i < num; ++i)
255 if ((*it).Unit == base_unit)
260 Report::UserWarning0() <<
"Need unit for " << (*it).description <<
" times m";
271 description = descriptor.getDescription();
276 const UnitInfo &findUnit(
const int unit)
279 if ((*it).Unit == unit)
284 std::ostream &documentParameter(std::ostream &os,
const std::string &name,
const int parameter_unit,
const std::string &description,
const Descriptor &descriptor)
286 if (descriptor.getCompositeParametricData<
void>()) {
287 os << laTexProtect(name) <<
" & " << laTexProtect(description) <<
" & ";
289 const UnitInfo &unit_info = findUnit(parameter_unit);
290 os <<
"\\multicolumn{2}{c}{See Table~\\ref{" << name <<
"_Composite_Params}} ";
293 os << laTexProtect(name) <<
" & " << laTexProtect(description) <<
" & ";
295 const UnitInfo &unit_info = findUnit(parameter_unit);
299 if ((descriptor.isType<
double>() && name ==
"TNOM") || name ==
"TEMP")
301 double default_value = getDefaultValue<double>(descriptor);
304 if (default_value == 0.0)
306 os <<
"Ambient Temperature";
308 else if (default_value -
CONSTCtoK < 0.0)
319 descriptor.getEntry().print(os);
323 if (descriptor.getCompositeParametricData<
void>()) {
324 const ParametricData<void> &composite_parametric_data = *descriptor.getCompositeParametricData<
void>();
325 const OrderedParameterMap composite_parametric_map(composite_parametric_data.getMap().begin(), composite_parametric_data.getMap().end());
327 std::ostringstream path;
328 path << name <<
"_Composite_Params.tex";
330 std::ofstream os(path.str().c_str(), std::ios_base::out);
332 os <<
"% This table was generated by Xyce" << std::endl;
334 laTexComposite(os, name, name, composite_parametric_data);
337 os <<
" \\\\ \\hline" << std::endl;
345 const std::string & composite_name,
346 const std::string & composite_description,
347 const ParametricData<void> & parameters)
350 std::string composite_description_lc = composite_description;
351 std::transform(composite_description_lc.begin(), composite_description_lc.end(), composite_description_lc.begin(), (int (*)(int)) std::tolower);
353 os <<
"\\index{" << laTexClean(composite_description_lc) <<
"!" <<
"composite parameters}" << std::endl
354 <<
"\\begin{CompositeParamTableGenerated}{" << laTexProtect(composite_description) <<
" " <<
"Composite Parameters}"
355 <<
"{" << composite_name <<
"_Composite_Params}" << std::endl;
357 const OrderedParameterMap parameter_map(parameters.getMap().begin(), parameters.getMap().end());
358 for (OrderedParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
359 std::string parameter_name = (*it).first;
360 const Descriptor &descriptor = *(*it).second;
363 std::string parameter_description;
366 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
368 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
372 os <<
"\\end{CompositeParamTableGenerated}" << std::endl;
382 const std::string & device_name,
383 const int device_level,
385 const std::string & device_description,
390 std::string device_description_lc = device_description;
391 std::transform(device_description_lc.begin(), device_description_lc.end(), device_description_lc.begin(), (int (*)(int)) std::tolower);
393 os <<
"\\index{" << laTexClean(device_description_lc) <<
"!" << (type ?
"device model parameters" :
"device instance parameters") <<
"}" << std::endl
394 <<
"\\begin{DeviceParamTableGenerated}{" << laTexProtect(device_description) <<
" " << (type ?
"Device Model Parameters" :
"Device Instance Parameters") <<
"}"
395 <<
"{" << device_name <<
"_" << device_level << (type ?
"_Device_Model_Params" :
"_Device_Instance_Params") <<
"}" << std::endl;
399 const OrderedParameterMap parameter_map(parameters.
getMap().begin(), parameters.
getMap().end());
401 const std::string &header = categoryName(category);
402 bool header_printed =
false;
404 for (OrderedParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
405 std::string parameter_name = (*it).first;
409 std::string parameter_description;
412 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
414 if (parameter_category == category) {
415 if (!header.empty() && !header_printed) {
416 header_printed =
true;
419 <<
"\\category{" << header <<
"}" <<
"\\\\ \\hline" << std::endl;
421 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
428 const OrderedParameterMap parameter_map(parameters.
getMap().begin(), parameters.
getMap().end());
429 for (OrderedParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
430 std::string parameter_name = (*it).first;
434 std::string parameter_description;
437 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
439 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
444 os <<
"\\end{DeviceParamTableGenerated}" << std::endl;
Pure virtual class to augment a linear system.
Parameter is not to be documented.
Class ParametricData manages the configuration information and the parameter binding map...
ExprAccess getExpressionAccess() const
Gets the expression access which describes the usage of the paramter.
Class Descriptor describes the parameters stored in the ParametricData parameter map.
StdDescription descriptionTable[]
std::map< std::string, Descriptor *, LessNoCase > OrderedParameterMap
ParameterMap & getMap()
Gets the parameter binding map map.
size_t descriptionTableSize
std::ostream & operator<<(std::ostream &os, const Configuration &configuration)
std::ostream & laTexDevice(std::ostream &os, const std::string &name, const int level, const int type, const std::string &device_description, const ParametricData< void > ¶meters, const OutputMode::Mode format)