# HG changeset patch # User Space Falcon # Date 1438475670 0 # Node ID 068ea2458c5d3aa20928f6e95d89961879905f53 # Parent 1f3283f8e4823104c31e891e8b82644455e5c17b unet-bind: instance entry implemented diff -r 1f3283f8e482 -r 068ea2458c5d ueda/sverp-bind/Makefile --- a/ueda/sverp-bind/Makefile Sun Aug 02 00:00:15 2015 +0000 +++ b/ueda/sverp-bind/Makefile Sun Aug 02 00:34:30 2015 +0000 @@ -1,6 +1,6 @@ CC= gcc CFLAGS= -O2 -OBJS= insthash.o main.o outcomp.o +OBJS= enterinst.o insthash.o main.o outcomp.o LIBS= ../libueda/libueda.a PROG= unet-bind BINDIR= /usr/local/bin diff -r 1f3283f8e482 -r 068ea2458c5d ueda/sverp-bind/enterinst.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ueda/sverp-bind/enterinst.c Sun Aug 02 00:34:30 2015 +0000 @@ -0,0 +1,70 @@ +#include +#include +#include +#include +#include "struct.h" + +extern struct instance *enter_instance(); + +process_hier_attr(oc, hier) + register struct outcomp *oc; + char *hier; +{ + register struct instance *inst; + + oc->altname = hier; + inst = enter_instance(hier); + inst->outcomp = oc; +} + +process_slotmap_attr(oc, slotmap_file) + struct outcomp *oc; + char *slotmap_file; +{ + FILE *stream; + char linebuf[256]; + int lineno; + register char *cp; + char *instname, *slot; + register struct instance *inst; + + stream = fopen(slotmap_file, "r"); + if (!stream) { + perror(slotmap_file); + exit(1); + } + for (lineno = 1; fgets(linebuf, sizeof linebuf, stream); lineno++) { + cp = index(linebuf, '\n'); + if (!cp) { + fprintf(stderr, + "error: %s line %d is too long or unterminated\n", + slotmap_file, lineno); + exit(1); + } + *cp = '\0'; + for (cp = linebuf; isspace(*cp); cp++) + ; + if (*cp == '\0' || *cp == '#') + continue; + instname = cp; + while (*cp && !isspace(*cp)) + cp++; + if (*cp) + *cp++ = '\0'; + while (isspace(*cp)) + cp++; + if (*cp == '\0' || *cp == '#') + slot = 0; + else { + slot = cp; + while (*cp && !isspace(*cp)) + cp++; + if (*cp) + *cp++ = '\0'; + } + inst = enter_instance(instname); + inst->outcomp = oc; + inst->slot = slot; + } + fclose(stream); +} diff -r 1f3283f8e482 -r 068ea2458c5d ueda/sverp-bind/outcomp.c --- a/ueda/sverp-bind/outcomp.c Sun Aug 02 00:00:15 2015 +0000 +++ b/ueda/sverp-bind/outcomp.c Sun Aug 02 00:34:30 2015 +0000 @@ -55,6 +55,7 @@ register struct outcomp *oc; { register struct pinconn **conn_array; + register char *attr; oc->name = oc->mclcomp->name; try_numpins(oc); @@ -74,6 +75,10 @@ } bzero(conn_array, sizeof(struct pinconn *) * oc->npins); oc->conn_array = conn_array; + if (attr = get_comp_attr(oc->mclcomp, "hier")) + process_hier_attr(oc, attr); + else if (attr = get_comp_attr(oc->mclcomp, "slotmap")) + process_slotmap_attr(oc, attr); } init_outcomp_from_MCL()