From bd0f7257769f554a3c1a2ec99886aecde9ec162f Mon Sep 17 00:00:00 2001 From: Brian Taylor Date: Thu, 18 Jan 2024 13:11:56 -0800 Subject: [PATCH] There are approx. 47 out of 1455 subckts in PSPICE 9.1 libraries which contain X* subckt calls together with zero or more U* instances. Now this type of subckt can be translated to XSPICE. --- src/frontend/inpcompat.c | 3 ++- src/frontend/udevices.c | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/frontend/inpcompat.c b/src/frontend/inpcompat.c index b0dfd43c4..8e2ade0cb 100644 --- a/src/frontend/inpcompat.c +++ b/src/frontend/inpcompat.c @@ -576,7 +576,8 @@ static struct card *u_instances(struct card *startcard) models_ok++; } } - } else if (ciprefix("u", cut_line)) { + } else if (ciprefix("u", cut_line) || ciprefix("x", cut_line)) { + /* U* device instance or X* instance of a subckt */ if (subcktcard) { if (repeat_pass) { if (!u_process_instance(cut_line)) { diff --git a/src/frontend/udevices.c b/src/frontend/udevices.c index cfe25c88d..dcbe5d054 100644 --- a/src/frontend/udevices.c +++ b/src/frontend/udevices.c @@ -4239,11 +4239,16 @@ BOOL u_check_instance(char *line) { /* Check to see if the U* instance is a type which can be translated. + An X* instance of a subckt is allowed. Return TRUE if it can be translated */ char *xspice, *itype; - struct instance_hdr *hdr = create_instance_header(line); + struct instance_hdr *hdr = NULL; + if (ciprefix("x", line)) { + return TRUE; + } + hdr = create_instance_header(line); if (!hdr) { return FALSE; } @@ -4284,10 +4289,24 @@ BOOL u_process_instance(char *nline) { /* Return TRUE if ok */ char *p1, *itype, *xspice; - struct instance_hdr *hdr = create_instance_header(nline); + struct instance_hdr *hdr = NULL; Xlatorp xp = NULL; BOOL behav_ret = TRUE; + + if (ciprefix("x", nline)) { + /* An X* instance of a subckt is translated unchanged */ + Xlate_datap xdp = create_xlate_translated(nline); + Xlatorp xlp = create_xlator(); + (void) add_xlator(xlp, xdp); + append_xlator(translated_p, xlp); + if (ps_ports_and_pins & 4) { + printf("TRANS_IN %s\n", nline); + } + delete_xlator(xlp); + return TRUE; + } + hdr = create_instance_header(nline); if (!hdr) { return FALSE; }