comparison ueda/sverp/misc.c @ 0:cd92449fdb51

initial import of ueda and ifctf-part-lib from ifctfvax CVS
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 20 Jul 2015 00:24:37 +0000
parents
children 7b4f78fcca08
comparison
equal deleted inserted replaced
-1:000000000000 0:cd92449fdb51
1 /*
2 * ueda-sverp miscellaneous functions
3 */
4
5 #include <stdio.h>
6 #include <strings.h>
7 #include "struct.h"
8
9 extern struct module_def *glob_module_list, *top_module_def;
10 extern char *top_module_expl;
11
12 struct module_def *
13 find_module_by_name(namesought)
14 register char *namesought;
15 {
16 register struct module_def *m;
17
18 for (m = glob_module_list; m; m = m->next)
19 if (!strcmp(m->name, namesought))
20 break;
21 return(m);
22 }
23
24 process_explicit_topmod()
25 {
26 register struct module_def *mod;
27
28 mod = find_module_by_name(top_module_expl);
29 if (!mod) {
30 fprintf(stderr, "error: module \"%s\" (-t option) not found\n",
31 top_module_expl);
32 exit(1);
33 }
34 if (mod->is_primitive) {
35 fprintf(stderr,
36 "error: module %s selected with -t is a primitive\n",
37 top_module_expl);
38 exit(1);
39 }
40 if (mod->nports) {
41 fprintf(stderr,
42 "error: module %s (-t option) has ports and thus cannot be top\n",
43 top_module_expl);
44 exit(1);
45 }
46 /* all checks passed */
47 top_module_def = mod;
48 }