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 os << laTexProtect(name) <<
" & " << laTexProtect(description) <<
" & ";
288 const UnitInfo &unit_info = findUnit(parameter_unit);
292 if ((descriptor.isType<
double>() && name ==
"TNOM") || name ==
"TEMP")
294 double default_value = getDefaultValue<double>(descriptor);
297 if (default_value == 0.0)
299 os <<
"Ambient Temperature";
301 else if (default_value -
CONSTCtoK < 0.0)
312 descriptor.getEntry().print(os);
315 if (descriptor.getCompositeParametricData<
void>()) {
316 const ParametricData<void> &composite_parametric_data = *descriptor.getCompositeParametricData<
void>();
317 const OrderedParameterMap composite_parametric_map(composite_parametric_data.getMap().begin(), composite_parametric_data.getMap().end());
319 std::ostringstream path;
320 path << name <<
"_Composite_Params.tex";
322 std::ofstream os(path.str().c_str(), std::ios_base::out);
324 os <<
"% This table was generated by Xyce" << std::endl;
326 laTexComposite(os, name, name, composite_parametric_data);
329 os <<
" \\\\ \\hline" << std::endl;
337 const std::string & composite_name,
338 const std::string & composite_description,
339 const ParametricData<void> & parameters)
342 std::string composite_description_lc = composite_description;
343 std::transform(composite_description_lc.begin(), composite_description_lc.end(), composite_description_lc.begin(), (int (*)(int)) std::tolower);
345 os <<
"\\index{" << laTexClean(composite_description_lc) <<
"!" <<
"composite parameters}" << std::endl
346 <<
"\\begin{CompositeParamTableGenerated}{" << laTexProtect(composite_description) <<
" " <<
"Composite Parameters}"
347 <<
"{" << composite_name <<
"_Composite_Params}" << std::endl;
349 const OrderedParameterMap parameter_map(parameters.getMap().begin(), parameters.getMap().end());
350 for (OrderedParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
351 std::string parameter_name = (*it).first;
352 const Descriptor &descriptor = *(*it).second;
355 std::string parameter_description;
358 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
360 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
364 os <<
"\\end{CompositeParamTableGenerated}" << std::endl;
374 const std::string & device_name,
375 const int device_level,
377 const std::string & device_description,
382 std::string device_description_lc = device_description;
383 std::transform(device_description_lc.begin(), device_description_lc.end(), device_description_lc.begin(), (int (*)(int)) std::tolower);
385 os <<
"\\index{" << laTexClean(device_description_lc) <<
"!" << (type ?
"device model parameters" :
"device instance parameters") <<
"}" << std::endl
386 <<
"\\begin{DeviceParamTableGenerated}{" << laTexProtect(device_description) <<
" " << (type ?
"Device Model Parameters" :
"Device Instance Parameters") <<
"}"
387 <<
"{" << device_name <<
"_" << device_level << (type ?
"_Device_Model_Params" :
"_Device_Instance_Params") <<
"}" << std::endl;
391 const OrderedParameterMap parameter_map(parameters.
getMap().begin(), parameters.
getMap().end());
393 const std::string &header = categoryName(category);
394 bool header_printed =
false;
396 for (OrderedParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
397 std::string parameter_name = (*it).first;
401 std::string parameter_description;
404 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
406 if (parameter_category == category) {
407 if (!header.empty() && !header_printed) {
408 header_printed =
true;
411 <<
"\\category{" << header <<
"}" <<
"\\\\ \\hline" << std::endl;
413 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
420 const OrderedParameterMap parameter_map(parameters.
getMap().begin(), parameters.
getMap().end());
421 for (OrderedParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
422 std::string parameter_name = (*it).first;
426 std::string parameter_description;
429 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
431 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
436 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)