47 #include <Xyce_config.h>
68 #include <N_UTL_Misc.h>
69 #include <N_UTL_IndentStreamBuf.h>
70 #include <N_ERH_Message.h>
86 laTexProtect(
const std::string &t)
94 std::ostream &
operator<<(std::ostream &os,
const laTexProtect &laTex_protect)
96 for (std::string::const_iterator cit = laTex_protect.text.begin(); cit != laTex_protect.text.end(); ++cit) {
108 laTexClean(
const std::string &t)
112 const std::string &
text;
116 std::ostream &
operator<<(std::ostream &os,
const laTexClean &laTex_clean)
118 for (std::string::const_iterator cit = laTex_clean.text.begin(); cit != laTex_clean.text.end(); ++cit) {
127 const std::string &categoryName(
int category) {
128 static std::vector<std::string> s_categoryList;
130 if (s_categoryList.empty()) {
131 s_categoryList.resize(
CAT_MAX);
133 s_categoryList[
CAT_AC] =
"AC Parameters";
134 s_categoryList[
CAT_BASIC] =
"Basic Parameters";
135 s_categoryList[
CAT_BIN] =
"Bin Parameters";
136 s_categoryList[
CAT_CAP] =
"Capacitance Parameters";
137 s_categoryList[
CAT_CONTROL] =
"Control Parameters";
138 s_categoryList[
CAT_CURRENT] =
"Current Parameters";
139 s_categoryList[
CAT_DC] =
"DC Parameters";
141 s_categoryList[
CAT_DOPING] =
"Doping Parameters";
142 s_categoryList[
CAT_FLICKER] =
"Flicker Parameters";
144 s_categoryList[
CAT_INITIAL] =
"Initial Condition Parameters";
146 s_categoryList[
CAT_NQS] =
"NQS Parameters";
147 s_categoryList[
CAT_RADP] =
"Radiation Pulse Parameters";
148 s_categoryList[
CAT_RES] =
"Resistance Parameters";
149 s_categoryList[
CAT_PROCESS] =
"Process Parameters";
150 s_categoryList[
CAT_RF] =
"RF Parameters";
151 s_categoryList[
CAT_RAD] =
"Radiation Parameters";
152 s_categoryList[
CAT_TEMP] =
"Temperature Parameters";
153 s_categoryList[
CAT_TUNNEL] =
"Tunnelling Parameters";
154 s_categoryList[
CAT_VBI] =
"Built-in Potential Lowering Parameters";
155 s_categoryList[
CAT_VOLT] =
"Voltage Parameters";
156 s_categoryList[
CAT_ASYMRDS] =
"Asymmetric and Bias-Dependent $R_{ds}$ Parameters";
157 s_categoryList[
CAT_IMPACT] =
"Impact Ionization Current Parameters";
158 s_categoryList[
CAT_GDLEAKAGE] =
"Gate-induced Drain Leakage Model Parameters";
161 return s_categoryList.size() ? s_categoryList[category] : s_categoryList[
CAT_UNKNOWN];
164 void unitDescription(
165 const std::string & name,
167 const Descriptor & descriptor,
170 std::string & description)
172 unit = descriptor.getUnit();
176 if (name == (*it).Name)
178 description = (*it).Description;
179 category = (*it).Category;
185 if (description.empty())
187 Report::UserWarning0() <<
"No description given for " << name <<
". Setting category and unit as UNKNOWN.";
189 description =
"Unspecified";
196 category = descriptor.getCategory();
200 std::string base_name = name.substr(1);
203 description =
"Length";
206 else if (name[0] ==
'W')
208 description =
"Width";
211 else if (name[0] ==
'P')
213 description =
"Cross-term";
216 description +=
" dependence of ";
217 description += base_name;
219 ParameterMap::const_iterator it = parameter_map.find(base_name);
220 if (it == parameter_map.end())
222 Report::DevelFatal().in(
"DeviceEntity::getUnitDescription")
223 <<
"Base parameter not found for " << name <<
" in " << base_name;
227 const Descriptor &base_descriptor = *(*it).second;
229 std::string base_description;
233 unitDescription(base_name, parameter_map, base_descriptor, base_unit, base_category, base_description);
236 for (
int i = 0; i < num; ++i)
240 if ((*it).Unit == base_unit)
245 Report::UserWarning0() <<
"Need unit for " << (*it).description <<
" times m";
256 description = descriptor.getDescription();
261 const UnitInfo &findUnit(
const int unit)
264 if ((*it).Unit == unit)
269 std::ostream &documentParameter(std::ostream &os,
const std::string &name,
const int parameter_unit,
const std::string &description,
const Descriptor &descriptor)
271 os << laTexProtect(name) <<
" & " << laTexProtect(description) <<
" & ";
273 const UnitInfo &unit_info = findUnit(parameter_unit);
277 if ((descriptor.isType<
double>() && name ==
"TNOM") || name ==
"TEMP")
279 double default_value = getDefaultValue<double>(descriptor);
282 if (default_value == 0.0)
284 os <<
"Ambient Temperature";
286 else if (default_value -
CONSTCtoK < 0.0)
297 descriptor.getEntry().print(os);
300 os <<
" \\\\ \\hline" << std::endl;
311 std::string device_description_lc = device_description;
312 std::transform(device_description_lc.begin(), device_description_lc.end(), device_description_lc.begin(), (int (*)(int)) std::tolower);
314 os <<
"\\index{" << laTexClean(device_description_lc) <<
"!" << (type ?
"device model parameters" :
"device instance parameters") <<
"}" << std::endl
315 <<
"\\begin{DeviceParamTableGenerated}{" << laTexProtect(device_description) <<
" " << (type ?
"Device Model Parameters" :
"Device Instance Parameters") <<
"}"
316 <<
"{" << device_name <<
"_" << device_level << (type ?
"_Device_Model_Params" :
"_Device_Instance_Params") <<
"}" << std::endl;
322 const std::string &header = categoryName(category);
323 bool header_printed =
false;
325 for (ParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
326 std::string parameter_name = (*it).first;
330 std::string parameter_description;
333 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
335 if (parameter_category == category) {
336 if (!header.empty() && !header_printed) {
337 header_printed =
true;
340 <<
"\\category{" << header <<
"}" <<
"\\\\ \\hline" << std::endl;
342 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
350 for (ParameterMap::const_iterator it = parameter_map.begin(); it != parameter_map.end(); ++it) {
351 std::string parameter_name = (*it).first;
356 std::string parameter_description;
359 unitDescription((*it).first, parameter_map, descriptor, parameter_unit, parameter_category, parameter_description);
361 documentParameter(os, parameter_name, parameter_unit, parameter_description, descriptor);
366 os <<
"\\end{DeviceParamTableGenerated}" << std::endl;