Add port directions when logicexp or pindly are present.
This commit is contained in:
parent
da6a311260
commit
dcafbbcf90
|
|
@ -340,6 +340,7 @@ static int lex_gate_op(int c)
|
||||||
|
|
||||||
static int lex_ident(int c)
|
static int lex_ident(int c)
|
||||||
{
|
{
|
||||||
|
/* Pspice and MicroCap are vague about what defines an identifier */
|
||||||
if (isalnum(c) || c == '_' || c == '/' || c == '-')
|
if (isalnum(c) || c == '_' || c == '/' || c == '-')
|
||||||
return c;
|
return c;
|
||||||
else
|
else
|
||||||
|
|
@ -1614,6 +1615,7 @@ BOOL f_logicexp(char *line)
|
||||||
if (!expect_token(t, LEX_ID, NULL, TRUE, 10)) goto error_return;
|
if (!expect_token(t, LEX_ID, NULL, TRUE, 10)) goto error_return;
|
||||||
(void) add_sym_tab_entry(parse_lexer->lexer_buf,
|
(void) add_sym_tab_entry(parse_lexer->lexer_buf,
|
||||||
SYM_INPUT, &parse_lexer->lexer_sym_tab);
|
SYM_INPUT, &parse_lexer->lexer_sym_tab);
|
||||||
|
u_remember_pin(parse_lexer->lexer_buf, 1);
|
||||||
}
|
}
|
||||||
/* num_outs output ids */
|
/* num_outs output ids */
|
||||||
for (i = 0; i < num_outs; i++) {
|
for (i = 0; i < num_outs; i++) {
|
||||||
|
|
@ -1621,6 +1623,7 @@ BOOL f_logicexp(char *line)
|
||||||
if (!expect_token(t, LEX_ID, NULL, TRUE, 11)) goto error_return;
|
if (!expect_token(t, LEX_ID, NULL, TRUE, 11)) goto error_return;
|
||||||
(void) add_sym_tab_entry(parse_lexer->lexer_buf,
|
(void) add_sym_tab_entry(parse_lexer->lexer_buf,
|
||||||
SYM_OUTPUT, &parse_lexer->lexer_sym_tab);
|
SYM_OUTPUT, &parse_lexer->lexer_sym_tab);
|
||||||
|
u_remember_pin(parse_lexer->lexer_buf, 2);
|
||||||
}
|
}
|
||||||
/* timing model */
|
/* timing model */
|
||||||
t = lex_scan();
|
t = lex_scan();
|
||||||
|
|
@ -2154,6 +2157,7 @@ static BOOL new_gen_output_models(LEXER lx)
|
||||||
if (pline) {
|
if (pline) {
|
||||||
pline_arr[idx++] = pline;
|
pline_arr[idx++] = pline;
|
||||||
(void) set_ena_name(ds_get_buf(&enable_name), pline);
|
(void) set_ena_name(ds_get_buf(&enable_name), pline);
|
||||||
|
u_remember_pin(lx->lexer_buf, 3);
|
||||||
} else {
|
} else {
|
||||||
goto err_return;
|
goto err_return;
|
||||||
}
|
}
|
||||||
|
|
@ -2247,6 +2251,7 @@ BOOL f_pindly(char *line)
|
||||||
if (!expect_token(t, LEX_ID, NULL, TRUE, 61)) goto error_return;
|
if (!expect_token(t, LEX_ID, NULL, TRUE, 61)) goto error_return;
|
||||||
pline = add_new_pindly_line(pindly_tab);
|
pline = add_new_pindly_line(pindly_tab);
|
||||||
(void) set_in_name(lxr->lexer_buf, pline);
|
(void) set_in_name(lxr->lexer_buf, pline);
|
||||||
|
u_remember_pin(lxr->lexer_buf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* num_ena enable nodes which are ignored */
|
/* num_ena enable nodes which are ignored */
|
||||||
|
|
@ -2254,6 +2259,9 @@ BOOL f_pindly(char *line)
|
||||||
for (i = 0; i < num_ena + num_refs; i++) {
|
for (i = 0; i < num_ena + num_refs; i++) {
|
||||||
t = lexer_scan(lxr);
|
t = lexer_scan(lxr);
|
||||||
if (!expect_token(t, LEX_ID, NULL, TRUE, 62)) goto error_return;
|
if (!expect_token(t, LEX_ID, NULL, TRUE, 62)) goto error_return;
|
||||||
|
if (i < num_ena) {
|
||||||
|
u_remember_pin(lxr->lexer_buf, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* num_ios output ids */
|
/* num_ios output ids */
|
||||||
pline = NULL;
|
pline = NULL;
|
||||||
|
|
@ -2265,6 +2273,7 @@ BOOL f_pindly(char *line)
|
||||||
else
|
else
|
||||||
pline = pline->next;
|
pline = pline->next;
|
||||||
(void) set_out_name(lxr->lexer_buf, pline);
|
(void) set_out_name(lxr->lexer_buf, pline);
|
||||||
|
u_remember_pin(lxr->lexer_buf, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_gen_output_models(lxr)) {
|
if (!new_gen_output_models(lxr)) {
|
||||||
|
|
|
||||||
|
|
@ -389,6 +389,22 @@ static void add_port_name(char *name)
|
||||||
add_pin_name(name, &port_names_list);
|
add_pin_name(name, &port_names_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void u_remember_pin(char *name, int type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case 1: add_input_pin(name);
|
||||||
|
break;
|
||||||
|
case 2: add_output_pin(name);
|
||||||
|
break;
|
||||||
|
case 3: add_tristate_pin(name);
|
||||||
|
break;
|
||||||
|
case 4: add_port_name(name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void add_all_port_names(char *subckt_line)
|
static void add_all_port_names(char *subckt_line)
|
||||||
{
|
{
|
||||||
char *copy_line, *tok, *pos;
|
char *copy_line, *tok, *pos;
|
||||||
|
|
@ -398,7 +414,7 @@ static void add_all_port_names(char *subckt_line)
|
||||||
}
|
}
|
||||||
if (ps_port_directions & 4) {
|
if (ps_port_directions & 4) {
|
||||||
printf("TRANS_IN %s\n", subckt_line);
|
printf("TRANS_IN %s\n", subckt_line);
|
||||||
} else if (ps_port_directions) {
|
} else if (ps_port_directions & 1) {
|
||||||
printf("%s\n", subckt_line);
|
printf("%s\n", subckt_line);
|
||||||
}
|
}
|
||||||
copy_line = tprintf("%s", subckt_line);
|
copy_line = tprintf("%s", subckt_line);
|
||||||
|
|
@ -921,7 +937,7 @@ static void determine_port_type(void)
|
||||||
port_type = "IN";
|
port_type = "IN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ps_port_directions) {
|
if (ps_port_directions & 1) {
|
||||||
printf("port: %s %s\n", x->name, port_type);
|
printf("port: %s %s\n", x->name, port_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,6 @@ struct card *replacement_udevice_cards(void);
|
||||||
void cleanup_udevice(void);
|
void cleanup_udevice(void);
|
||||||
void u_add_instance(char *str);
|
void u_add_instance(char *str);
|
||||||
void u_add_logicexp_model(char *tmodel, char *xspice_gate, char *model_name);
|
void u_add_logicexp_model(char *tmodel, char *xspice_gate, char *model_name);
|
||||||
|
void u_remember_pin(char *name, int type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue