Move f_logicexp, f_pindly calls to u_process_instance. Use u_add_instance to copy gate instances and models to the replacement cards.
This commit is contained in:
parent
a27ae48e27
commit
9d239dc2f7
|
|
@ -3,17 +3,6 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//#define LOCAL_BUILD
|
||||
#ifdef LOCAL_BUILD
|
||||
#include "ngspice/ngspice/memory.h"
|
||||
#include "ngspice/ngspice/macros.h"
|
||||
#include "ngspice/ngspice/bool.h"
|
||||
#include "ngspice/ngspice/ngspice.h"
|
||||
#include "ngspice/ngspice/stringskip.h"
|
||||
#include "ngspice/ngspice/stringutil.h"
|
||||
#include "ngspice/ngspice/dstring.h"
|
||||
#include "logicexp.h"
|
||||
#else
|
||||
#include "ngspice/memory.h"
|
||||
#include "ngspice/macros.h"
|
||||
#include "ngspice/bool.h"
|
||||
|
|
@ -22,7 +11,7 @@
|
|||
#include "ngspice/stringutil.h"
|
||||
#include "ngspice/dstring.h"
|
||||
#include "ngspice/logicexp.h"
|
||||
#endif
|
||||
#include "ngspice/udevices.h"
|
||||
|
||||
/* Start of btree symbol table */
|
||||
#define SYM_INPUT 1
|
||||
|
|
@ -594,6 +583,7 @@ static char *get_inv_tail(char *str)
|
|||
|
||||
static void gen_inverters(SYM_TAB t)
|
||||
{
|
||||
DS_CREATE(instance, 128);
|
||||
if (t == NULL)
|
||||
return;
|
||||
gen_inverters(t->left);
|
||||
|
|
@ -601,13 +591,21 @@ static void gen_inverters(SYM_TAB t)
|
|||
if (t->ref_count >= 1) {
|
||||
printf("%s %s %s d_inv_zero_delay\n", get_inst_name(),
|
||||
t->name, get_inverter_output_name(t->name));
|
||||
|
||||
ds_clear(&instance);
|
||||
ds_cat_printf(&instance, "%s %s %s d_inv_zero_delay",
|
||||
get_inst_name(), t->name, get_inverter_output_name(t->name));
|
||||
u_add_instance(ds_get_buf(&instance));
|
||||
}
|
||||
}
|
||||
ds_free(&instance);
|
||||
gen_inverters(t->right);
|
||||
}
|
||||
|
||||
static void gen_models(void)
|
||||
{
|
||||
DS_CREATE(model, 64);
|
||||
|
||||
printf(".model d_inv_zero_delay d_inverter\n");
|
||||
printf(".model d__inverter__1 d_inverter\n");
|
||||
printf(".model d__buffer__1 d_buffer\n");
|
||||
|
|
@ -617,6 +615,44 @@ static void gen_models(void)
|
|||
printf(".model d__xor__1 d_xor\n");
|
||||
printf(".model d__nor__1 d_nor\n");
|
||||
printf(".model d__or__1 d_or\n");
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d_inv_zero_delay d_inverter");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__inverter__1 d_inverter");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__buffer__1 d_buffer");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__nand__1 d_nand");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__and__1 d_and");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__xnor__1 d_xnor");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__xor__1 d_xor");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__nor__1 d_nor");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_clear(&model);
|
||||
ds_cat_printf(&model, ".model d__or__1 d_or");
|
||||
u_add_instance(ds_get_buf(&model));
|
||||
|
||||
ds_free(&model);
|
||||
}
|
||||
|
||||
static void aerror(char *s)
|
||||
|
|
@ -1073,6 +1109,8 @@ static void gen_gates(PTABLE gate_tab, SYM_TAB parser_symbols)
|
|||
}
|
||||
|
||||
printf("%s\n", ds_get_buf(&instance));
|
||||
|
||||
u_add_instance(ds_get_buf(&instance));
|
||||
}
|
||||
delete_lexer(lxr);
|
||||
ds_free(&out_name);
|
||||
|
|
@ -1354,7 +1392,7 @@ BOOL f_logicexp(char *line)
|
|||
|
||||
BOOL f_pindly(char *line)
|
||||
{
|
||||
printf("\nf_pindly: %s\n", line);
|
||||
return FALSE;
|
||||
//printf("\nf_pindly: %s\n", line);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -764,6 +764,16 @@ struct card *replacement_udevice_cards(void)
|
|||
return newcard;
|
||||
}
|
||||
|
||||
void u_add_instance(char *str)
|
||||
{
|
||||
Xlatep x;
|
||||
|
||||
if (str && strlen(str) > 0) {
|
||||
x = create_xlate_translated(str);
|
||||
(void) add_xlator(translated_p, x);
|
||||
}
|
||||
}
|
||||
|
||||
void initialize_udevice(char *subckt_line)
|
||||
{
|
||||
Xlatep xdata;
|
||||
|
|
@ -3426,6 +3436,11 @@ BOOL u_check_instance(char *line)
|
|||
itype = hdr->instance_type;
|
||||
xspice = find_xspice_for_delay(itype);
|
||||
if (!xspice) {
|
||||
if (eq(itype, "logicexp") || eq(itype, "pindly")
|
||||
|| eq(itype, "constraint")) {
|
||||
delete_instance_hdr(hdr);
|
||||
return TRUE;
|
||||
}
|
||||
if (ps_udevice_msgs >= 1) {
|
||||
if (current_subckt && subckt_msg_count == 0) {
|
||||
printf("%s\n", current_subckt);
|
||||
|
|
@ -3434,13 +3449,7 @@ BOOL u_check_instance(char *line)
|
|||
printf("WARNING ");
|
||||
printf("Instance %s type %s is not supported\n",
|
||||
hdr->instance_name, itype);
|
||||
if (eq(itype, "logicexp")) {
|
||||
if (ps_udevice_msgs == 3)
|
||||
(void) f_logicexp(line);
|
||||
} else if (eq(itype, "pindly")) {
|
||||
if (ps_udevice_msgs == 3)
|
||||
(void) f_pindly(line);
|
||||
} else if (ps_udevice_msgs == 3) {
|
||||
if (ps_udevice_msgs >= 2) {
|
||||
printf("%s\n", line);
|
||||
}
|
||||
}
|
||||
|
|
@ -3467,8 +3476,19 @@ BOOL u_process_instance(char *nline)
|
|||
itype = hdr->instance_type;
|
||||
xspice = find_xspice_for_delay(itype);
|
||||
if (!xspice) {
|
||||
delete_instance_hdr(hdr);
|
||||
return FALSE;
|
||||
if (eq(itype, "logicexp")) {
|
||||
delete_instance_hdr(hdr);
|
||||
return f_logicexp(nline);
|
||||
} else if (eq(itype, "pindly")) {
|
||||
delete_instance_hdr(hdr);
|
||||
return f_pindly(nline);
|
||||
} else if (eq(itype, "constraint")) {
|
||||
delete_instance_hdr(hdr);
|
||||
return TRUE;
|
||||
} else {
|
||||
delete_instance_hdr(hdr);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (ps_port_directions >= 2) {
|
||||
printf("TRANS_IN %s\n", nline);
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ BOOL u_check_instance(char *line);
|
|||
void initialize_udevice(char *subckt_line);
|
||||
struct card *replacement_udevice_cards(void);
|
||||
void cleanup_udevice(void);
|
||||
void u_add_instance(char *str);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue