Merge branch 'pre-master-44' into bt_dev

This commit is contained in:
Brian Taylor 2024-10-26 13:46:29 -07:00
commit 781e94b085
5 changed files with 60 additions and 16 deletions

View File

@ -695,7 +695,7 @@ struct card *pspice_compat(struct card *oldcard)
nextcard = insert_new_line(nextcard, new_str, 7, 0, "internal");
new_str = copy(".func if(a, b, c) {ternary_fcn( a , b , c )}");
nextcard = insert_new_line(nextcard, new_str, 8, 0, "internal");
new_str = copy(".func int(x) { sign(x)*floor(abs(x)) }");
new_str = copy(".func int(x) { sgn(x)*floor(abs(x)) }");
nextcard = insert_new_line(nextcard, new_str, 9, 0, "internal");
nextcard->nextcard = oldcard;

View File

@ -947,7 +947,7 @@ fileInit(runDesc *run)
or special parameter names for @ vecors. FIXME This guessing may fail
due to the many options, especially for the @ vectors. */
static int
guess_type(const char *name)
guess_type(const char *name, char* pltypename)
{
int type;
@ -969,6 +969,20 @@ guess_type(const char *name)
type = SV_RES;
else if (cieq(name, "i-sweep"))
type = SV_CURRENT;
else if (pltypename && ciprefix("sp", pltypename) && ciprefix("S_", name))
type = SV_SPARAM;
else if (pltypename && ciprefix("sp", pltypename) && ciprefix("Y_", name))
type = SV_ADMITTANCE;
else if (pltypename && ciprefix("sp", pltypename) && ciprefix("Z_", name))
type = SV_IMPEDANCE;
else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "NF"))
type = SV_DB;
else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "NFmin"))
type = SV_DB;
else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "Rn"))
type = SV_IMPEDANCE;
else if (pltypename && ciprefix("sp", pltypename) && cieq(name, "SOpt"))
type = SV_NOTYPE;
else if (strstr(name, ":power\0"))
type = SV_POWER;
/* current source ISRC parameters for current */
@ -1001,7 +1015,7 @@ fileInit_pass2(runDesc *run)
char *name = run->data[i].name;
type = guess_type(name);
type = guess_type(name, NULL);
if (type == SV_CURRENT && !keepbranch) {
char *branch = strstr(name, "#branch");
@ -1141,7 +1155,7 @@ plotInit(runDesc *run)
name = copy(dd->name);
v = dvec_alloc(name,
guess_type(name),
guess_type(name, pl->pl_typename),
run->isComplex
? (VF_COMPLEX | VF_PERMANENT)
: (VF_REAL | VF_PERMANENT),

View File

@ -312,6 +312,10 @@ static size_t calc_osdi_noise_off(const OsdiDescriptor *descr) {
} \
const ty *name = (ty *)sym;
#define GET_PTR_NOCHECK(name, ty) \
sym = GET_SYM(handle, STRINGIFY(name)); \
const ty *name = (ty *)sym;
#define INIT_CALLBACK(name, ty) \
sym = GET_SYM(handle, STRINGIFY(name)); \
if (sym) { \
@ -373,18 +377,40 @@ extern OsdiObjectFile load_object_file(const char *input) {
return EMPTY_OBJECT;
}
// Try to get OSDI_DESCRIPTOR_SIZE
GET_PTR_NOCHECK(OSDI_DESCRIPTOR_SIZE, uint32_t);
size_t descriptor_size;
// Get major and minor OSDI version
GET_CONST(OSDI_VERSION_MAJOR, uint32_t);
GET_CONST(OSDI_VERSION_MINOR, uint32_t);
if (OSDI_VERSION_MAJOR != OSDI_VERSION_MAJOR_CURR ||
if (OSDI_DESCRIPTOR_SIZE) {
// This must be openvaf-reloaded
// Must be version>=0.4
if (!(
(OSDI_VERSION_MAJOR == 0 && OSDI_VERSION_MINOR >= 4) ||
OSDI_VERSION_MAJOR >= 1
)) {
printf("NGSPICE supports OpenVAF-reloaded OSDI version >= 0.4 but \"%s\" uses v%d.%d!",
path, OSDI_VERSION_MAJOR, OSDI_VERSION_MINOR);
txfree(path);
return INVALID_OBJECT;
}
descriptor_size = *OSDI_DESCRIPTOR_SIZE;
} else {
// Original OpenVAF, must be version==0.3
if (OSDI_VERSION_MAJOR != OSDI_VERSION_MAJOR_CURR ||
OSDI_VERSION_MINOR != OSDI_VERSION_MINOR_CURR) {
printf("NGSPICE only supports OSDI v%d.%d but \"%s\" targets v%d.%d!",
OSDI_VERSION_MAJOR_CURR, OSDI_VERSION_MINOR_CURR, path,
OSDI_VERSION_MAJOR, OSDI_VERSION_MINOR);
txfree(path);
return INVALID_OBJECT;
printf("NGSPICE only supports OSDI v%d.%d but \"%s\" uses v%d.%d!",
OSDI_VERSION_MAJOR_CURR, OSDI_VERSION_MINOR_CURR, path,
OSDI_VERSION_MAJOR, OSDI_VERSION_MINOR);
txfree(path);
return INVALID_OBJECT;
}
descriptor_size = sizeof(OsdiDescriptor);
}
GET_CONST(OSDI_NUM_DESCRIPTORS, uint32_t);
GET_PTR(OSDI_DESCRIPTORS, OsdiDescriptor);
@ -420,10 +446,12 @@ extern OsdiObjectFile load_object_file(const char *input) {
}
OsdiRegistryEntry *dst = TMALLOC(OsdiRegistryEntry, OSDI_NUM_DESCRIPTORS);
char* desc_ptr = (char*)OSDI_DESCRIPTORS;
for (uint32_t i = 0; i < OSDI_NUM_DESCRIPTORS; i++) {
const OsdiDescriptor *descr = &OSDI_DESCRIPTORS[i];
const OsdiDescriptor *descr = (OsdiDescriptor*)desc_ptr;
desc_ptr += descriptor_size;
uint32_t dt = descr->num_params + descr->num_opvars;
bool has_m = false;
uint32_t temp = descr->num_params + descr->num_opvars + 1;

View File

@ -69,7 +69,7 @@ SPICEdev HFETAinfo = {
#ifdef KLU
.DEVbindCSC = HFETAbindCSC,
.DEVbindCSCComplex = HFETAbindCSC,
.DEVbindCSCComplex = HFETAbindCSCComplex,
.DEVbindCSCComplexToReal = HFETAbindCSCComplexToReal,
#endif
};

View File

@ -20,7 +20,9 @@ NGHASHPTR modtabhash = NULL;
* This fcn takes the model name and looks to see if it is already
* in the model table. If it is, then just return. Otherwise,
* stick the model into the model table.
* Note that the model table INPmodel
* Note that the model table INPmodel *modtab is a linked list,
* in parallel a hash table modtabhash is filled in for faster
* access to modtab elements by giving the model name.
*--------------------------------------------------------------*/
int INPmakeMod(char *token, int type, struct card *line)