61 char *s = (
char*) NULL;
62 char *t = (
char*) NULL;
63 char *u = (
char*) NULL;
67 char *tg = (
char*) NULL;
68 unsigned long *ml = (
unsigned long*) NULL;
69 unsigned long *mf = (
unsigned long*) NULL;
83 if (0 == strcmp(tok1,
"when")) {
85 (void) fprintf(
STDERR,
" a node cannot be controlled by a 'when' condition\n");
88 if (0 == strcmp(tok1,
"after")) {
92 (void) fprintf(
STDERR,
" the keyword <%s> cannot be used with this kind of node\n", tok1);
99 (void) fprintf(
STDERR,
" the keyword <%s> should be followed by a node,\n", tok1);
100 (void) fprintf(
STDERR,
" <%s> must be a node defined in this netlist\n", tok2);
105 if (0 == strcmp(tok1,
"before")) {
109 (void) fprintf(
STDERR,
" the keyword <%s> cannot be used with this kind of node\n", tok1);
116 (void) fprintf(
STDERR,
" the keyword <%s> should be followed by a node,\n", tok1);
117 (void) fprintf(
STDERR,
" <%s> must be a node defined in this netlist\n", tok2);
125 (void) fprintf(
STDERR,
" the keyword <%s> cannot reference this kind of node\n", tok1);
128 (void) strcpy(tok3,
Node_List[id2].value);
129 (void) strcat(tok3,
" after ");
130 (void) strcat(tok3,
Node_List[out].name1);
133 if (0 == strcmp(tok1,
"with")) {
138 (void) fprintf(
STDERR,
" the keyword <%s> should be followed by a node,\n", tok1);
139 (void) fprintf(
STDERR,
" <%s> must be a node defined in this netlist\n", tok2);
145 if ((0 == strcmp(
"before", tok1)) || (0 == strcmp(
"with", tok1))) {
162 char *s = (
char*) NULL;
166 unsigned long *ml = (
unsigned long*) NULL;
167 unsigned long *mf = (
unsigned long*) NULL;
183 (void) strcpy(tok2,
"");
184 (void) strcpy(tok3,
"");
190 if (
'$' == tok1[(
LENGTH(tok1)) - 1L]) {
191 tok1[(
LENGTH(tok1)) - 1L] =
'\0';
192 (void) strcat(tok2, tok1);
193 (void) strcat(tok2,
" ");
196 (void) strcat(tok3, tok1);
197 (void) strcat(tok3,
" ");
201 (void) strcat(tok2,
"dual ");
211 (void) strcpy(tok2,
"");
212 (void) strcpy(tok3,
"");
218 if (
'$' == tok1[(
LENGTH(tok1)) - 1L]) {
219 tok1[(
LENGTH(tok1)) - 1L] =
'\0';
220 (void) strcat(tok2, tok1);
221 (void) strcat(tok2,
" ");
224 (void) strcat(tok3, tok1);
225 (void) strcat(tok3,
" ");
229 (void) strcat(tok2,
"none");
238 (void) strcpy(tok2,
"");
239 (void) strcpy(tok3,
"");
245 if (
'$' == tok1[(
LENGTH(tok1)) - 1L]) {
246 tok1[(
LENGTH(tok1)) - 1L] =
'\0';
247 (void) strcat(tok2, tok1);
248 (void) strcat(tok2,
" ");
251 (void) strcat(tok3, tok1);
252 (void) strcat(tok3,
" ");
256 (void) strcat(tok2,
"arithmetic ");
265 (void) strcpy(tok2,
"");
266 (void) strcpy(tok3,
"");
272 if (
'$' == tok1[(
LENGTH(tok1)) - 1L]) {
273 tok1[(
LENGTH(tok1)) - 1L] =
'\0';
274 (void) strcat(tok2, tok1);
275 (void) strcat(tok2,
" ");
278 (void) strcat(tok3, tok1);
279 (void) strcat(tok3,
" ");
283 (void) strcat(tok2,
"dual ");
314 (void) strcpy(tok2,
"");
315 (void) strcpy(tok3,
"");
321 if (
'$' == tok1[(
LENGTH(tok1)) - 1L]) {
322 tok1[(
LENGTH(tok1)) - 1L] =
'\0';
323 (void) strcat(tok2, tok1);
324 (void) strcat(tok2,
" ");
327 (void) strcat(tok3, tok1);
328 (void) strcat(tok3,
" ");
342 if (
' ' == s[len - 1L]) {
356 char *s = (
char*) NULL;
357 char *t = (
char*) NULL;
362 char sgn[2] = {
'\0'};
363 char brck[3] = {
'\0'};
364 char *tg = (
char*) NULL;
365 unsigned long *ml = (
unsigned long*) NULL;
366 unsigned long *mf = (
unsigned long*) NULL;
378 if ((
char*) NULL != s) {
381 }
while ((
char*) NULL != s);
396 (void) snprintf(tok3, (
size_t) (
STRLENGTH-1L),
"1 %s", s);
403 if (0 == strcmp(tok1,
"0")) {
408 }
else if (0 == strcmp(tok1,
"1")) {
411 }
else if (0 == strcmp(tok1,
"2")) {
414 }
else if (0 == strcmp(tok1,
"3")) {
456 if (((
char*) NULL != strstr(
Node_List[out].option,
"arithmetic"))
457 || ((
char*) NULL != strstr(
Node_List[out].option,
"rms"))) {
463 if ((
char*) NULL != strstr(
Node_List[out].option,
"geometric")) {
464 (void) snprintf(tok2, (
size_t) (
STRLENGTH-1L),
"MAX(0.0, %s)", tok1);
466 (void) snprintf(tok2, (
size_t) (
STRLENGTH-1L),
"MAX(EPSILON, %s)", tok1);
560 (void) strcpy(tok3,
Var_List[v].value);
561 (void) strcat(tok3,
" ");
563 (void) strcat(tok3, tok2);
570 if ((0 != strcmp(brck,
"\"\"")) ||
ISEMPTY(tok1)) {
572 (void) fprintf(
STDERR,
" pattern descriptor <%s> must be a string of 0's and 1's\n", s);
575 (void) strcpy(tok3, s);
577 (void) strcpy(tok3,
"1");
582 if (!isspace((
int) *s)) {
586 if ((
'0' != *s) && (
'1' != *s) && (
'.' != *s) && (!isspace((
int) *s))) {
588 (void) fprintf(
STDERR,
" the pattern descriptor <%s> must contain only 0's, 1's, period or spaces\n", tok1);
595 (void) strcat(tok2,
" ");
596 (void) strcat(tok2, tok3);
659 (void) fprintf(
STDERR,
" 'osc' node replaced by 'sine' node as periodic sampling is not guaranteed\n");
672 (void) snprintf(tok2, (
size_t) (
STRLENGTH-1L),
"%s%s", sgn, tok1);
674 (void) snprintf(tok4, (
size_t) (
STRLENGTH-1L),
"%s%s", sgn, tok3);
675 flag = sscanf(tok4,
"%lf", &dtemp);
676 if ((1 == flag) &&
ISSMALL(dtemp)) {
717 char *s = (
char*) NULL;
719 char sgn[2] = {
'\0'};
728 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
729 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
734 for (out = 0L; out <
Num_Vars; out++) {
741 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
742 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
754 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
755 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
767 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
768 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
773 for (out = 0L; out <
Num_IOs; out++) {
780 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
781 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
786 (void) fprintf(
STDERR,
" <%s> cannot be defined from input instruction\n", tok);
801 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
802 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
813 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
814 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
825 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
826 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
838 if ((0 == strcmp(tok,
"One" )) || (0 == strcmp(tok,
"Zero")) ||
839 (0 == strcmp(tok,
"Ground")) || ((
char*) NULL != strchr(tok,
':'))) {
852 (void) strcpy(tok2, str);
855 if (0 == strcmp(tok2,
Var_List[i].value)) {
884 (void) strcpy(tok1,
Var_List[j].name1);
901 char *s = (
char*) NULL;
905 if (0 == strcmp(identifier,
"One")) {
917 }
else if (0 == strcmp(identifier,
"Zero")) {
929 }
else if (0 == strcmp(identifier,
"Ground")) {
941 }
else if ((
char*) NULL != strchr(identifier,
':')) {
942 if ((
':' == identifier[0]) || (
':' == identifier[
LENGTH(identifier)-1L])) {
945 s = strchr(identifier,
':');
946 if ((isspace((
int) *(s-1))) || (!isdigit((
int) *(s+1)))) {
949 (void) strcpy(tok1, identifier);
957 (void) fprintf(
STDERR,
" <%s> must be a node, not a variable\n", identifier);
963 (void) fprintf(
STDERR,
" root node <%s> does not exist\n", identifier);
967 (void) snprintf(tok2, (
size_t) (
STRLENGTH-1L),
"%s %s", s+1, identifier);
1012 (void) fprintf(
STDERR,
" There is no node named <%s> in the netlist\n",
Inject_List[i].name);
1016 (void) fprintf(
STDERR,
" <%s> is a variable. No injection is allowed\n",
Inject_List[i].name);
1020 if (0 == strcmp(
Node_List[n].name1,
"Ground")) {
1022 (void) fprintf(
STDERR,
" Not allowed on node <Ground>\n");
1026 (void) fprintf(
STDERR,
" Inject to node <%s> only once\n",
Inject_List[i].name);
1055 char *s = (
char*) NULL;
1061 char sgn[2] = {
'\0'};
1062 unsigned long *ml = (
unsigned long*) NULL;
1063 unsigned long *mf = (
unsigned long*) NULL;
1065 for (out = 0L; out <
Num_Nodes; out++) {
1076 (void) strcpy(tok3, s);
1083 if (0 == strcmp(tok4,
"after") || 0 == strcmp(tok4,
"with")) {
1092 (void) strcpy(tok2,
"itool_");
1099 (void) strcpy(tok2,
"dtool_");
1106 (void) strcpy(tok2,
"iuser_");
1111 (void) strcpy(tok2,
"duser_");
1116 (void) strcat(tok2, tok1);
1152 char *str = (
char*) NULL;
1236 for (i = 0L; i <
Num_IOs; i++) {
1323 char *s1 = (
char*) NULL;
1324 char *t2 = (
char*) NULL;
1325 char *t3 = (
char*) NULL;
1326 char *t4 = (
char*) NULL;
1327 char *t5 = (
char*) NULL;
1333 char sgn2[2] = {
'\0'};
1338 (void) strcpy(tok2,
"");
1340 (void) strcpy(tok3,
"");
1342 (void) strcpy(tok4,
"");
1344 (void) strcpy(tok5,
"");
1346 (void) strcpy(buf1,
"");
1355 (void) snprintf(t5, (
size_t) (
STRLENGTH-1L),
"%s%s", sgn2, tok2);
1357 (void) strcpy(t4, t3);
1359 (void) snprintf(t5, (
size_t) (
STRLENGTH-1L),
"%s%s", sgn2, tok2);
1361 (void) strcpy(t4, t3);
1364 (void) strcpy(t4, t3);
1366 (void) strcpy(t4, t2);
1368 if ((0 == strcmp(tok2,
"stdin" )) || (0 == strcmp(tok2,
"stderr")) || (0 == strcmp(tok2,
"stdout"))) {
1369 (void) snprintf(t5, (
size_t) (
STRLENGTH-1L),
"\"%s\"", tok2);
1371 (void) strcpy(t4, t3);
1374 (void) strcat(buf1,
" ");
1376 (void) strcpy(buf1,
"");
1379 (void) strcat(buf1, t4);
1391 char *t1 = (
char*) NULL;
1392 char *t2 = (
char*) NULL;
1393 char *t3 = (
char*) NULL;
1394 char sgn[2] = {
'\0'};
1399 (void) strcpy(tok3,
"");
1401 while (0L <=
LENGTH(t1)) {
1403 if ((
char*) NULL == strstr(tok1,
"::")) {
1404 (void) strcat(tok3, tok1);
1405 (void) strcat(tok3,
" ");
1410 t2 = strstr(tok1,
"::");
1412 (void) strcat(tok3, tok1);
1413 (void) strcpy(tok2,t2 + 2);
1417 (void) fprintf(
STDERR,
" <%s> value of an option must be a number, analog or digital\n", tok2);
1419 (void) strcat(tok3,
"::");
1421 (void) strcat(tok3, tok2);
1422 (void) strcat(tok3,
" ");
1425 (void) strcat(tok3, t3);
1426 (void) strcat(tok3,
" ");
1435 (void) strcpy(tok1,
"");
1436 (void) strcpy(tok2,
"");
1438 (void) strcpy(tok3,
"");
1440 while (0L <=
LENGTH(t1)) {
1442 if ((
char*) NULL == strstr(tok1,
"::")) {
1443 (void) strcat(tok3, tok1);
1444 (void) strcat(tok3,
" ");
1449 t2 = strstr(tok1,
"::");
1451 (void) strcat(tok3, tok1);
1452 (void) strcpy(tok2,t2 + 2);
1456 (void) fprintf(
STDERR,
" value <%s> of an option must be a number, analog or digital\n", tok2);
1458 (void) strcat(tok3,
"::");
1460 (void) strcat(tok3, tok2);
1461 (void) strcat(tok3,
" ");
1464 (void) strcat(tok3, t3);
1465 (void) strcat(tok3,
" ");
1482 char *str = (
char*) NULL;
1483 char sgn[2] = {
'\0'};
1568 for (i = 0L; i <
Num_IOs; i++) {
1669 (void) fprintf(
STDERR,
" collision between a variable and the function <%s()>\n", tok);
1674 (void) fprintf(
STDERR,
" collision between a node and the function <%s()>\n", tok);
1679 (void) fprintf(
STDERR,
" collision between an array and the function <%s()>\n", tok);
1694 (void) fprintf(
STDERR,
"\nNAPA Compiler Warning: (stuck instruction usage)\n");
1700 (void) fprintf(
STDERR,
" There is no node named <%s> in the netlist\n",
Stuck_List[i].name);
1705 (void) fprintf(
STDERR,
" A variable cannot be stuck <%s>\n",
Stuck_List[i].name);
1709 if (0 == strcmp(
Node_List[n].tag,
"stuck")) {
1711 (void) fprintf(
STDERR,
" Node <%s> can be stuck to a value only once\n",
Stuck_List[i].name);
1724 (void) fprintf(
STDERR,
" -> at line %3lu of main netlist,", (
Stuck_List[i].mline)[0]);
1729 (void) fprintf(
STDERR,
"\n");
1737 char *str = (
char*) NULL;
1738 char sgn[2] = {
'\0'};
1744 if ((
char*) NULL != strstr(
Var_List[i].name1,
"$init$")) {
1747 (void) strcpy(tok2, str);
1755 (void) snprintf(tok4, (
size_t) (
STRLENGTH-1L),
"%s %s", tok3, tok2);
void print_warning_location(const char *type, const unsigned long *mlin, const unsigned long *mfil)
void print_error_location(const char *type, const unsigned long *mlin, const unsigned long *mfil)
long constant_type(char *identifier)
void increment_function_number(const char *kind)
void increment_node_number(const char *kind)
void increment_tool_number(const char *kind)
long usertool_num(const char *nam)
void strcpy_alloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
int is_a_known_function(const char *identifier)
long array_id(const char *identifier)
long directive_id(const char *identifier)
void increment_const_number(void)
long node_id(const char *identifier)
long var_id(const char *identifier)
void increment_usertool_number(const char *kind)
void increment_var_number(const char *kind)
void strcpy_realloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
void process_node_error(const char *tok1)
#define DROP_SEGMENT_TYPE
EXTERN RANDOMSEED_TYPE Seed_List
EXTERN VAR_TYPE Var_List[2047L]
EXTERN RECORD_TYPE Record_List[127L]
EXTERN long Num_Functions
EXTERN POST_TYPE Post_List[63L]
EXTERN NODE_TYPE Node_List[4095L]
EXTERN long Num_UserTools
EXTERN USERTOOL_TYPE UserTool_List[511L]
EXTERN SAMPLING_TYPE Sampling_List
EXTERN DIRECTIVE_TYPE Directive_List[255L]
EXTERN INJECT_TYPE Inject_List[63L]
EXTERN long Num_Directives
EXTERN OPCODE_TYPE Opcode_List[127L]
EXTERN TERMINATE_TYPE Terminate_List
EXTERN SEGMENT_TYPE Segment_List[127L]
EXTERN int Multdelay_Flag
EXTERN FUNCTION_TYPE Function_List[255L]
EXTERN STUCK_TYPE Stuck_List[63L]
EXTERN DUMP_TYPE Dump_List
EXTERN IO_TYPE IO_List[63L]
#define DIGITAL_DATA_TYPE
EXTERN UPDATE_TYPE Update_List[2047L]
char * get_token(char *str, char *tok, long keep_quotes)
void clean_parentheses(char *tok)
char * get_function_identifier(char *str, char *fun_id, char *fun_parm)
char * get_token_between_braces(char *str, char *brc, char *tok)
char * get_sign_and_token(char *str, char *sgn, char *tok)
void purge_constants_in_ganging(void)
void create_automatic_node(const char *identifier, const unsigned long *mlin, const unsigned long *mfil)
void redefine_random_seed(void)
void separe_qualifiers(void)
void mark_directives(void)
void purge_constants_in_options(void)
void redefine_node_segments(void)
char * create_constant_var(char *str, int type, const unsigned long *mlin, const unsigned long *mfil)
void redefine_nodes(void)
void collect_functions(void)
long record_function_identifier(const char *tok, long m, const unsigned long *mlin, const unsigned long *mfil)