make accessible
This commit is contained in:
parent
d4d576d695
commit
c080f08044
|
|
@ -19,6 +19,7 @@ typedef struct OsdiRegistryEntry {
|
||||||
uint32_t inst_offset;
|
uint32_t inst_offset;
|
||||||
uint32_t dt;
|
uint32_t dt;
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
|
bool has_m;
|
||||||
} OsdiRegistryEntry;
|
} OsdiRegistryEntry;
|
||||||
|
|
||||||
typedef struct OsdiObjectFile {
|
typedef struct OsdiObjectFile {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
* descr->param_opvar to the internal ngspice representation (IFparm).
|
* descr->param_opvar to the internal ngspice representation (IFparm).
|
||||||
*/
|
*/
|
||||||
static int write_param_info(IFparm **dst, const OsdiDescriptor *descr,
|
static int write_param_info(IFparm **dst, const OsdiDescriptor *descr,
|
||||||
uint32_t start, uint32_t end) {
|
uint32_t start, uint32_t end, bool has_m) {
|
||||||
for (uint32_t i = start; i < end; i++) {
|
for (uint32_t i = start; i < end; i++) {
|
||||||
OsdiParamOpvar *para = &descr->param_opvar[i];
|
OsdiParamOpvar *para = &descr->param_opvar[i];
|
||||||
uint32_t num_names = para->num_alias + 1;
|
uint32_t num_names = para->num_alias + 1;
|
||||||
|
|
@ -68,12 +68,23 @@ static int write_param_info(IFparm **dst, const OsdiDescriptor *descr,
|
||||||
dataType |= IF_UNINTERESTING;
|
dataType |= IF_UNINTERESTING;
|
||||||
}
|
}
|
||||||
char *para_name = copy(para->name[j]);
|
char *para_name = copy(para->name[j]);
|
||||||
|
if (para_name[0] == '$') {
|
||||||
|
para_name[0] = '_';
|
||||||
|
}
|
||||||
strtolower(para_name);
|
strtolower(para_name);
|
||||||
(*dst)[j] = (IFparm){.keyword = para_name,
|
(*dst)[j] = (IFparm){.keyword = para_name,
|
||||||
.id = (int)i,
|
.id = (int)i,
|
||||||
.description = para->description,
|
.description = para->description,
|
||||||
.dataType = dataType};
|
.dataType = dataType};
|
||||||
}
|
}
|
||||||
|
if (!has_m && !strcmp(para->name[0], "$mfactor")) {
|
||||||
|
(*dst)[num_names] = (IFparm){.keyword = "m",
|
||||||
|
.id = (int)i,
|
||||||
|
.description = para->description,
|
||||||
|
.dataType = dataType};
|
||||||
|
*dst += 1;
|
||||||
|
}
|
||||||
|
|
||||||
*dst += num_names;
|
*dst += num_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,6 +121,10 @@ extern SPICEdev *osdi_create_spicedev(const OsdiRegistryEntry *entry) {
|
||||||
*num_instance_para_names += 1;
|
*num_instance_para_names += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!entry->has_m) {
|
||||||
|
*num_instance_para_names += 1;
|
||||||
|
}
|
||||||
|
|
||||||
IFparm *instance_para_names = TMALLOC(IFparm, *num_instance_para_names);
|
IFparm *instance_para_names = TMALLOC(IFparm, *num_instance_para_names);
|
||||||
IFparm *dst = instance_para_names;
|
IFparm *dst = instance_para_names;
|
||||||
|
|
||||||
|
|
@ -124,9 +139,9 @@ extern SPICEdev *osdi_create_spicedev(const OsdiRegistryEntry *entry) {
|
||||||
"Instance temperature"};
|
"Instance temperature"};
|
||||||
dst += 1;
|
dst += 1;
|
||||||
}
|
}
|
||||||
write_param_info(&dst, descr, 0, descr->num_instance_params);
|
write_param_info(&dst, descr, 0, descr->num_instance_params, entry->has_m);
|
||||||
write_param_info(&dst, descr, descr->num_params,
|
write_param_info(&dst, descr, descr->num_params,
|
||||||
descr->num_params + descr->num_opvars);
|
descr->num_params + descr->num_opvars, true);
|
||||||
|
|
||||||
// allocate and fill model params
|
// allocate and fill model params
|
||||||
int *num_model_para_names = TMALLOC(int, 1);
|
int *num_model_para_names = TMALLOC(int, 1);
|
||||||
|
|
@ -135,7 +150,8 @@ extern SPICEdev *osdi_create_spicedev(const OsdiRegistryEntry *entry) {
|
||||||
}
|
}
|
||||||
IFparm *model_para_names = TMALLOC(IFparm, *num_model_para_names);
|
IFparm *model_para_names = TMALLOC(IFparm, *num_model_para_names);
|
||||||
dst = model_para_names;
|
dst = model_para_names;
|
||||||
write_param_info(&dst, descr, descr->num_instance_params, descr->num_params);
|
write_param_info(&dst, descr, descr->num_instance_params, descr->num_params,
|
||||||
|
true);
|
||||||
|
|
||||||
// Allocate SPICE device
|
// Allocate SPICE device
|
||||||
SPICEdev *OSDIinfo = TMALLOC(SPICEdev, 1);
|
SPICEdev *OSDIinfo = TMALLOC(SPICEdev, 1);
|
||||||
|
|
@ -181,7 +197,5 @@ extern SPICEdev *osdi_create_spicedev(const OsdiRegistryEntry *entry) {
|
||||||
OSDIinfo->DEVpzLoad = OSDIpzLoad;
|
OSDIinfo->DEVpzLoad = OSDIpzLoad;
|
||||||
OSDIinfo->DEVtrunc = OSDItrunc;
|
OSDIinfo->DEVtrunc = OSDItrunc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return OSDIinfo;
|
return OSDIinfo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -358,12 +358,15 @@ extern OsdiObjectFile load_object_file(const char *input) {
|
||||||
const OsdiDescriptor *descr = &OSDI_DESCRIPTORS[i];
|
const OsdiDescriptor *descr = &OSDI_DESCRIPTORS[i];
|
||||||
|
|
||||||
uint32_t dt = descr->num_params + descr->num_opvars;
|
uint32_t dt = descr->num_params + descr->num_opvars;
|
||||||
|
bool has_m = false;
|
||||||
uint32_t temp = descr->num_params + descr->num_opvars + 1;
|
uint32_t temp = descr->num_params + descr->num_opvars + 1;
|
||||||
for (uint32_t param_id = 0; param_id < descr->num_params; param_id++) {
|
for (uint32_t param_id = 0; param_id < descr->num_params; param_id++) {
|
||||||
OsdiParamOpvar *param = &descr->param_opvar[param_id];
|
OsdiParamOpvar *param = &descr->param_opvar[param_id];
|
||||||
for (uint32_t j = 0; j < 1 + param->num_alias; j++) {
|
for (uint32_t j = 0; j < 1 + param->num_alias; j++) {
|
||||||
char *name = param->name[j];
|
char *name = param->name[j];
|
||||||
if (!strcmp(name, "dt")) {
|
if (!strcmp(name, "m")) {
|
||||||
|
has_m = true;
|
||||||
|
} else if (!strcmp(name, "dt")) {
|
||||||
dt = UINT32_MAX;
|
dt = UINT32_MAX;
|
||||||
} else if (!strcasecmp(name, "dtemp") || !strcasecmp(name, "dt")) {
|
} else if (!strcasecmp(name, "dtemp") || !strcasecmp(name, "dt")) {
|
||||||
dt = param_id;
|
dt = param_id;
|
||||||
|
|
@ -382,6 +385,7 @@ extern OsdiObjectFile load_object_file(const char *input) {
|
||||||
.inst_offset = (uint32_t)inst_off,
|
.inst_offset = (uint32_t)inst_off,
|
||||||
.dt = dt,
|
.dt = dt,
|
||||||
.temp = temp,
|
.temp = temp,
|
||||||
|
.has_m = has_m,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue