[qflow] 01/16: Corrected the liberty file reading of scalar values instead of tables for vesta static timing analysis and in the readliberty library. Also, added a hash table for reading and looking up nets in vesta to speed up the verilog file reading, which was a bottleneck for large netlists.

Ruben Undheim rubund-guest at moszumanska.debian.org
Thu Jul 23 08:22:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to tag upstream/1.1.7
in repository qflow.

commit 7987e380ef6ea6e55880d9b5ba39bf1e006c8dab
Author: Tim Edwards <tim at opencircuitdesign.com>
Date:   Sun May 31 19:34:16 2015 -0400

    Corrected the liberty file reading of scalar values instead of
    tables for vesta static timing analysis and in the readliberty
    library.  Also, added a hash table for reading and looking up
    nets in vesta to speed up the verilog file reading, which was
    a bottleneck for large netlists.
---
 src/Makefile                 |   6 +-
 src/hash.o                   | Bin 14952 -> 14952 bytes
 src/readliberty.c            |  38 +++++++---
 src/readliberty.o            | Bin 43464 -> 44168 bytes
 src/vesta.c                  |  85 +++++++++++++++-------
 src/{vesta.c => vesta.c.xxx} | 164 ++++++++++++++++++++++++++++---------------
 6 files changed, 195 insertions(+), 98 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 94a9903..3d8f639 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Main compiler arguments
-CFLAGS = -g -O2
+CFLAGS = -g
 DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DTCLSH_PATH=\"tclsh\" -DQFLOW_MAGIC_PATH=\"/usr/local/bin/magic\" -DQFLOW_QROUTER_PATH=\"/usr/local/bin/qrouter\" -DQFLOW_GRAYWOLF_PATH=\"/usr/local/bin/graywolf\" -DQFLOW_YOSYS_PATH=\"/usr/local/bin/yosys\"
 LIBS = 
 LDFLAGS = 
@@ -38,8 +38,8 @@ blifFanout$(EXEEXT): blifFanout.o hash.o readliberty.o
 blif2Verilog$(EXEEXT): blif2Verilog.o
 	$(CC) $(LDFLAGS) blif2Verilog.o -o $@ $(LIBS)
 
-vesta$(EXEEXT): vesta.o
-	$(CC) $(LDFLAGS) vesta.o -o $@ $(LIBS)
+vesta$(EXEEXT): vesta.o hash.o
+	$(CC) $(LDFLAGS) vesta.o hash.o -o $@ $(LIBS)
 
 install: $(TARGETS)
 	@echo "Installing verilog and BDNET file format handlers"
diff --git a/src/hash.o b/src/hash.o
index 3d6381c..909ad18 100644
Binary files a/src/hash.o and b/src/hash.o differ
diff --git a/src/readliberty.c b/src/readliberty.c
index a20c1e2..d6fe160 100644
--- a/src/readliberty.c
+++ b/src/readliberty.c
@@ -430,7 +430,7 @@ read_liberty(char *libfile, char *pattern)
     double gval;
     char *iptr;
 
-    LUTable *newtable, *reftable;
+    LUTable *newtable, *reftable, *scalar;
     Cell *newcell, *lastcell;
     Pin *newpin, *lastpin;
     char *curfunc;
@@ -441,6 +441,24 @@ read_liberty(char *libfile, char *pattern)
 	return NULL;
     }
 
+    /* Generate one table template for the "scalar" case */
+
+    scalar = (LUTable *)malloc(sizeof(LUTable));
+    scalar->name = strdup("scalar");
+    scalar->invert = 0;
+    scalar->var1 = strdup("transition");
+    scalar->var2 = strdup("capacitance");
+    scalar->tsize = 1;
+    scalar->csize = 1;
+    scalar->times = (double *)malloc(sizeof(double));
+    scalar->caps = (double *)malloc(sizeof(double));
+
+    scalar->times[0] = 0.0;
+    scalar->caps[0] = 0.0;
+
+    scalar->next = NULL;
+    tables = scalar;
+
     /* Read the file.  This is not a rigorous parser! */
 
     libCurrentLine = 0;
@@ -901,17 +919,15 @@ read_liberty(char *libfile, char *pattern)
 		    token = advancetoken(flib, 0);	// Open parens
 		    if (!strcmp(token, "("))
 			token = advancetoken(flib, ')');
-		    if (strcmp(token, "scalar")) {
 			
-		        for (reftable = tables; reftable; reftable = reftable->next)
-			    if (!strcmp(reftable->name, token))
-			        break;
-		        if (reftable == NULL)
-			    fprintf(stderr, "Failed to find a valid table \"%s\"\n",
-				    token);
-		        else if (newcell->reftable == NULL)
-			    newcell->reftable = reftable;
-		    }
+		    for (reftable = tables; reftable; reftable = reftable->next)
+			if (!strcmp(reftable->name, token))
+			    break;
+		    if (reftable == NULL)
+			fprintf(stderr, "Failed to find a valid table \"%s\"\n",
+				token);
+		    else if (newcell->reftable == NULL)
+			newcell->reftable = reftable;
 
 		    token = advancetoken(flib, 0);
 		    if (strcmp(token, "{"))
diff --git a/src/readliberty.o b/src/readliberty.o
index 1ced932..aa882d4 100644
Binary files a/src/readliberty.o and b/src/readliberty.o differ
diff --git a/src/vesta.c b/src/vesta.c
index feecff8..f4dbb81 100644
--- a/src/vesta.c
+++ b/src/vesta.c
@@ -52,6 +52,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <math.h>	// Temporary, for fabs()
+#include "hash.h"	// For net hash table
  
 #define LIB_LINE_MAX  65535
 
@@ -2307,31 +2308,29 @@ libertyRead(FILE *flib, lutable **tablelist, cell **celllist)
 		    token = advancetoken(flib, 0);	// Open parens
 		    if (!strcmp(token, "("))
 			token = advancetoken(flib, ')');
-		    if (strcmp(token, "scalar")) {
 			
-		        for (reftable = *tablelist; reftable; reftable = reftable->next)
-			    if (!strcmp(reftable->name, token))
-			        break;
-		        if (reftable == NULL)
-			    fprintf(stderr, "Failed to find a valid table \"%s\"\n",
-				    token);
-		        else {
-			    // Fill in default values from template reftable
-			    tableptr->invert = reftable->invert;
-			    if (reftable->size1 > 0) {
-				tableptr->var1 = reftable->var1;
-				tableptr->size1 = reftable->size1;
-				tableptr->idx1.times = (double *)malloc(tableptr->size1 * sizeof(double));
-				memcpy(tableptr->idx1.times, reftable->idx1.times,
+		    for (reftable = *tablelist; reftable; reftable = reftable->next)
+			if (!strcmp(reftable->name, token))
+			    break;
+		    if (reftable == NULL)
+			fprintf(stderr, "Failed to find a valid table \"%s\"\n",
+				token);
+		    else {
+			// Fill in default values from template reftable
+			tableptr->invert = reftable->invert;
+			if (reftable->size1 > 0) {
+			    tableptr->var1 = reftable->var1;
+			    tableptr->size1 = reftable->size1;
+			    tableptr->idx1.times = (double *)malloc(tableptr->size1 * sizeof(double));
+			    memcpy(tableptr->idx1.times, reftable->idx1.times,
 						tableptr->size1 * sizeof(double));
-			    }
-			    if (reftable->size2 > 0) {
-				tableptr->var2 = reftable->var2;
-				tableptr->size2 = reftable->size2;
-				tableptr->idx2.caps = (double *)malloc(tableptr->size2 * sizeof(double));
-				memcpy(tableptr->idx2.caps, reftable->idx2.caps,
+			}
+			if (reftable->size2 > 0) {
+			    tableptr->var2 = reftable->var2;
+			    tableptr->size2 = reftable->size2;
+			    tableptr->idx2.caps = (double *)malloc(tableptr->size2 * sizeof(double));
+			    memcpy(tableptr->idx2.caps, reftable->idx2.caps,
 						tableptr->size2 * sizeof(double));
-			    }
 			}
 		    }
 
@@ -2530,6 +2529,14 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
     pinptr testpin;
 
     int vstart, vend, vtarget, isinput;
+    struct hashlist *Nethash[OBJHASHSIZE];
+
+    /* See hash.c for these routines and variables */
+    hashfunc = hash;
+    matchfunc = match;
+
+    /* Initialize net hash table */
+    InitializeHashTable(Nethash);
 
     /* Read tokens off of the line */
     token = advancetoken(fsrc, 0);
@@ -2581,6 +2588,7 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 		    if (vstart == 0 && vend == 0) {
 			newnet = create_net(netlist);
 			newnet->name = strdup(token);
+			HashPtrInstall(newnet->name, newnet, Nethash);
 
 			testconn = (connptr)malloc(sizeof(connect));
 			testconn->refnet = newnet;
@@ -2608,6 +2616,7 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 			    newnet = create_net(netlist);
 			    newnet->name = (char *)malloc(strlen(token) + 6);
 			    sprintf(newnet->name, "%s[%d]", token, vstart);
+			    HashPtrInstall(newnet->name, newnet, Nethash);
 
 			    vstart += (vtarget > vend) ? 1 : -1;
 
@@ -2731,14 +2740,12 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 
 	    case PINCONN:
 		// Token is net name
-		for (testnet = *netlist; testnet; testnet = testnet->next) {
-		    if (!strcmp(testnet->name, token))
-			break;
-		}
+		testnet = (netptr)HashLookup(token, Nethash);
 		if (testnet == NULL) {
 		    // This is a new net, and we need to record it
 		    newnet = create_net(netlist);
 		    newnet->name = strdup(token);
+		    HashPtrInstall(newnet->name, newnet, Nethash);
 		    newconn->refnet = newnet;
 		}
 		else
@@ -2751,6 +2758,9 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 	else
 	    token = advancetoken(fsrc, 0);
     }
+
+    /* Hash table no longer needed */
+    HashKill(Nethash);
 }
 
 /*--------------------------------------------------------------*/
@@ -2974,6 +2984,7 @@ main(int objc, char *argv[])
 
     lutable *tables = NULL;
     cell *cells = NULL;
+    lutable *scalar;
 
     // Verilog netlist database
 
@@ -3064,6 +3075,28 @@ main(int objc, char *argv[])
     }
 
     /*------------------------------------------------------------------*/
+    /* Generate one table template for the "scalar" case		*/
+    /*------------------------------------------------------------------*/
+
+    scalar = (lutable *)malloc(sizeof(lutable));
+    scalar->name = strdup("scalar");
+    scalar->invert = 0;
+    scalar->var1 = CONSTRAINED_TIME;
+    scalar->var2 = OUTPUT_CAP;
+    scalar->size1 = 1;
+    scalar->size2 = 1;
+    scalar->idx1.times = (double *)malloc(sizeof(double));
+    scalar->idx2.caps = (double *)malloc(sizeof(double));
+    scalar->values = (double *)malloc(sizeof(double));
+
+    scalar->idx1.times[0] = 0.0;
+    scalar->idx2.caps[0] = 0.0;
+    scalar->values[0] = 0.0;
+
+    scalar->next = NULL;
+    tables = scalar;
+
+    /*------------------------------------------------------------------*/
     /* Read the liberty format file.  This is not a rigorous parser!	*/
     /*------------------------------------------------------------------*/
 
diff --git a/src/vesta.c b/src/vesta.c.xxx
similarity index 96%
copy from src/vesta.c
copy to src/vesta.c.xxx
index feecff8..a7990b9 100644
--- a/src/vesta.c
+++ b/src/vesta.c.xxx
@@ -52,6 +52,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <math.h>	// Temporary, for fabs()
+#include "hash.h"	// For net hash table
  
 #define LIB_LINE_MAX  65535
 
@@ -264,7 +265,6 @@ typedef struct _net {
    connptr *receivers;
    double loadr;	/* Total load capacitance for rising input */
    double loadf;	/* Total load capacitance for falling input */
-   netptr next;
 } net;
 
 typedef struct _instance *instptr;
@@ -533,25 +533,41 @@ pinptr parse_pin(cellptr newcell, char *token, short sense_predef)
 /* Create a new net record					*/
 /*--------------------------------------------------------------*/
 
-netptr create_net(netptr *netlist) {
+netptr create_net() {
 
     netptr newnet;
 
     newnet = (netptr)malloc(sizeof(net));
     newnet->name = NULL;
-    newnet->next = *netlist;
-    *netlist = newnet;
     newnet->driver = NULL;
     newnet->fanout = 0;
     newnet->receivers = NULL;
     newnet->loadr = 0.0;
     newnet->loadf = 0.0;
     newnet->type = NET;
-
     return newnet;
 }
 
 /*----------------------------------------------------------------------*/
+/* Create and hash a net record (unless it's already in the hash table)	*/
+/*----------------------------------------------------------------------*/
+
+netptr hash_net(struct hashlist *nethash[], char *name)
+{
+    netptr np;
+
+    np = (netptr)HashLookup(name, nethash);
+
+    if (np == NULL)
+    {
+	np = create_net();
+	HashPtrInstall(name, np, nethash);
+	np->name = strdup(name);
+    }
+    return np;
+}
+
+/*----------------------------------------------------------------------*/
 /* Interpolate or extrapolate a vector from a time vs. capacitance	*/
 /* lookup table.							*/
 /*----------------------------------------------------------------------*/
@@ -1329,8 +1345,8 @@ short find_edge_dir(short dir, netptr sourcenet, netptr destnet) {
 /* If minmax == MINIMUM_TIME, return the minimum delay.		*/
 /*--------------------------------------------------------------*/
 
-int find_clock_to_term_paths(connlistptr clockedlist, ddataptr *masterlist, netptr netlist,
-		char minmax)
+int find_clock_to_term_paths(connlistptr clockedlist, ddataptr *masterlist,
+		struct hashlist *nethash[], char minmax)
 {
     netptr	commonclock, testnet;
     connptr     testconn, thisconn;
@@ -1357,7 +1373,8 @@ int find_clock_to_term_paths(connlistptr clockedlist, ddataptr *masterlist, netp
 
 	// Remove all tags and reset delay metrics before each run
 
-	for (testnet = netlist; testnet; testnet = testnet->next) {
+	testnet = (netptr)HashFirst(nethash);
+	while (testnet != NULL) {
 	    for (i = 0; i < testnet->fanout; i++) {
 		testconn = testnet->receivers[i];
 		testconn->tag = NULL;
@@ -1366,6 +1383,7 @@ int find_clock_to_term_paths(connlistptr clockedlist, ddataptr *masterlist, netp
 		else
 		    testconn->metric = 1E50;
 	    }
+	    testnet = (netptr)HashNext(nethash);
 	}
 
 	thisconn = testlink->connection;
@@ -2307,31 +2325,29 @@ libertyRead(FILE *flib, lutable **tablelist, cell **celllist)
 		    token = advancetoken(flib, 0);	// Open parens
 		    if (!strcmp(token, "("))
 			token = advancetoken(flib, ')');
-		    if (strcmp(token, "scalar")) {
 			
-		        for (reftable = *tablelist; reftable; reftable = reftable->next)
-			    if (!strcmp(reftable->name, token))
-			        break;
-		        if (reftable == NULL)
-			    fprintf(stderr, "Failed to find a valid table \"%s\"\n",
+		    for (reftable = *tablelist; reftable; reftable = reftable->next)
+			if (!strcmp(reftable->name, token))
+			    break;
+		    if (reftable == NULL)
+			fprintf(stderr, "Failed to find a valid table \"%s\"\n",
 				    token);
-		        else {
-			    // Fill in default values from template reftable
-			    tableptr->invert = reftable->invert;
-			    if (reftable->size1 > 0) {
-				tableptr->var1 = reftable->var1;
-				tableptr->size1 = reftable->size1;
-				tableptr->idx1.times = (double *)malloc(tableptr->size1 * sizeof(double));
-				memcpy(tableptr->idx1.times, reftable->idx1.times,
+		    else {
+			// Fill in default values from template reftable
+			tableptr->invert = reftable->invert;
+			if (reftable->size1 > 0) {
+			    tableptr->var1 = reftable->var1;
+			    tableptr->size1 = reftable->size1;
+			    tableptr->idx1.times = (double *)malloc(tableptr->size1 * sizeof(double));
+			    memcpy(tableptr->idx1.times, reftable->idx1.times,
 						tableptr->size1 * sizeof(double));
-			    }
-			    if (reftable->size2 > 0) {
-				tableptr->var2 = reftable->var2;
-				tableptr->size2 = reftable->size2;
-				tableptr->idx2.caps = (double *)malloc(tableptr->size2 * sizeof(double));
-				memcpy(tableptr->idx2.caps, reftable->idx2.caps,
+			}
+			if (reftable->size2 > 0) {
+			    tableptr->var2 = reftable->var2;
+			    tableptr->size2 = reftable->size2;
+			    tableptr->idx2.caps = (double *)malloc(tableptr->size2 * sizeof(double));
+			    memcpy(tableptr->idx2.caps, reftable->idx2.caps,
 						tableptr->size2 * sizeof(double));
-			    }
 			}
 		    }
 
@@ -2516,8 +2532,9 @@ libertyRead(FILE *flib, lutable **tablelist, cell **celllist)
 /*--------------------------------------------------------------*/
 
 void
-verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
-		connect **inputlist, connect **outputlist)
+verilogRead(FILE *fsrc, cell *cells, struct hashlist *nethash[],
+		instance **instlist, connect **inputlist,
+		connect **outputlist)
 {
     char *token;
     char *modname = NULL;
@@ -2579,8 +2596,7 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 		    // Create a net entry for the input or output, add to the list of nets
 
 		    if (vstart == 0 && vend == 0) {
-			newnet = create_net(netlist);
-			newnet->name = strdup(token);
+			newnet = hash_net(nethash, token);
 
 			testconn = (connptr)malloc(sizeof(connect));
 			testconn->refnet = newnet;
@@ -2605,9 +2621,11 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 		    else {
 			vtarget = vend + (vstart < vend) ? 1 : -1;
 			while (vstart != vtarget) {
-			    newnet = create_net(netlist);
-			    newnet->name = (char *)malloc(strlen(token) + 6);
-			    sprintf(newnet->name, "%s[%d]", token, vstart);
+			    char *netname;
+			    netname = (char *)malloc(strlen(token) + 6);
+			    sprintf(netname, "%s[%d]", token, vstart);
+			    newnet = hash_net(nethash, netname);
+			    free(netname);
 
 			    vstart += (vtarget > vend) ? 1 : -1;
 
@@ -2731,14 +2749,10 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 
 	    case PINCONN:
 		// Token is net name
-		for (testnet = *netlist; testnet; testnet = testnet->next) {
-		    if (!strcmp(testnet->name, token))
-			break;
-		}
+		testnet = (netptr)HashLookup(token, nethash);
 		if (testnet == NULL) {
 		    // This is a new net, and we need to record it
-		    newnet = create_net(netlist);
-		    newnet->name = strdup(token);
+		    newnet = hash_net(nethash, token);
 		    newconn->refnet = newnet;
 		}
 		else
@@ -2762,7 +2776,7 @@ verilogRead(FILE *fsrc, cell *cells, net **netlist, instance **instlist,
 /*--------------------------------------------------------------*/
 
 void
-computeLoads(netptr netlist, instptr instlist, double out_load)
+computeLoads(struct hashlist *nethash[], instptr instlist, double out_load)
 {
     instptr testinst;
     pinptr testpin;
@@ -2770,7 +2784,8 @@ computeLoads(netptr netlist, instptr instlist, double out_load)
     connptr testconn;
     int i;
 
-    for (testnet = netlist; testnet; testnet = testnet->next) {
+    testnet = (netptr)HashFirst(nethash);
+    while (testnet != NULL) {
 	for (i = 0; i < testnet->fanout; i++) {
 	    testconn = testnet->receivers[i];
 	    testpin = testconn->refpin;
@@ -2783,6 +2798,7 @@ computeLoads(netptr netlist, instptr instlist, double out_load)
 		testnet->loadf += testpin->capf;
 	    }
 	}
+	testnet = (netptr)HashNext(nethash);
     }
 
     // For each instance input pin, collapse the pin's lookup table
@@ -2818,7 +2834,7 @@ computeLoads(netptr netlist, instptr instlist, double out_load)
 /* For diagnostics, return the number of entries in clockedlist	*/
 /*--------------------------------------------------------------*/
 
-int assign_net_types(netptr netlist, connlistptr *clockedlist)
+int assign_net_types(struct hashlist *nethash[], connlistptr *clockedlist)
 {
     int i, numterms;
     netptr testnet;
@@ -2828,7 +2844,8 @@ int assign_net_types(netptr netlist, connlistptr *clockedlist)
 
     numterms = 0;
 
-    for (testnet = netlist; testnet; testnet = testnet->next) {
+    testnet = (netptr)HashFirst(nethash);
+    while (testnet != NULL) {
 	for (i = 0; i < testnet->fanout; i++) {
 	    testrcvr = testnet->receivers[i];
 	    testpin = testrcvr->refpin;
@@ -2860,6 +2877,7 @@ int assign_net_types(netptr netlist, connlistptr *clockedlist)
 		}
 	    }
 	}
+	testnet = (netptr)HashNext(nethash);
     }
     return numterms;
 }
@@ -2888,7 +2906,7 @@ int assign_net_types(netptr netlist, connlistptr *clockedlist)
 /*--------------------------------------------------------------*/
 
 void
-createLinks(netptr netlist, instptr instlist, connptr inputlist, connptr outputlist)
+createLinks(instptr instlist, connptr inputlist, connptr outputlist)
 {
     netptr testnet;
     instptr testinst;
@@ -2974,16 +2992,19 @@ main(int objc, char *argv[])
 
     lutable *tables = NULL;
     cell *cells = NULL;
+    lutable *scalar;
 
     // Verilog netlist database
 
     instptr     instlist = NULL;
-    netptr      netlist = NULL;
     connlistptr clockconnlist = NULL;
     connlistptr newinputconn, inputconnlist = NULL;
     connptr     testconn, inputlist = NULL;
     connptr     outputlist = NULL;
 
+    // Net hashtable
+    struct hashlist *Nethash[OBJHASHSIZE];
+
     // Timing path database
     ddataptr	pathlist = NULL;
     ddataptr	freeddata, testddata, *orderedpaths;
@@ -2995,6 +3016,8 @@ main(int objc, char *argv[])
     verbose = 0;
     exhaustive = 0;
 
+    InitializeHashTable(Nethash);
+
     while ((firstarg < objc) && (*argv[firstarg] == '-')) {
        if (!strcmp(argv[firstarg], "-d") || !strcmp(argv[firstarg], "--delay")) {
 	  delayfile = strdup(argv[firstarg + 1]);
@@ -3064,6 +3087,28 @@ main(int objc, char *argv[])
     }
 
     /*------------------------------------------------------------------*/
+    /* Generate one table template for the "scalar" case		*/
+    /*------------------------------------------------------------------*/
+
+    scalar = (lutable *)malloc(sizeof(lutable));
+    scalar->name = strdup("scalar");
+    scalar->invert = 0;
+    scalar->var1 = CONSTRAINED_TIME;
+    scalar->var2 = OUTPUT_CAP;
+    scalar->size1 = 1;
+    scalar->size2 = 1;
+    scalar->idx1.times = (double *)malloc(sizeof(double));
+    scalar->idx2.caps = (double *)malloc(sizeof(double));
+    scalar->values = (double *)malloc(sizeof(double));
+
+    scalar->idx1.times[0] = 0.0;
+    scalar->idx2.caps[0] = 0.0;
+    scalar->values[0] = 0.0;
+
+    scalar->next = NULL;
+    tables = scalar;
+
+    /*------------------------------------------------------------------*/
     /* Read the liberty format file.  This is not a rigorous parser!	*/
     /*------------------------------------------------------------------*/
 
@@ -3103,7 +3148,7 @@ main(int objc, char *argv[])
     /*------------------------------------------------------------------*/
 
     fileCurrentLine = 0;
-    verilogRead(fsrc, cells, &netlist, &instlist, &inputlist, &outputlist);
+    verilogRead(fsrc, cells, Nethash, &instlist, &inputlist, &outputlist);
     fflush(stdout);
     fprintf(stdout, "Verilog netlist read:  Processed %d lines.\n", fileCurrentLine);
     if (fsrc != NULL) fclose(fsrc);
@@ -3115,8 +3160,8 @@ main(int objc, char *argv[])
     if (verbose > 1) {
 	connect *testoutput;
 	connect *testinput;
-	net *testnet;
 	instance *testinst;
+	netptr testnet;
 
 	for (testinput = inputlist; testinput; testinput = testinput->next) {
 	    if (testinput->refnet)
@@ -3126,8 +3171,10 @@ main(int objc, char *argv[])
 	    if (testoutput->refnet)
 		fprintf(stdout, "   Output: %s\n", testoutput->refnet->name);
 	}
-	for (testnet = netlist; testnet; testnet = testnet->next) {
+	testnet = (netptr)HashFirst(Nethash);
+	while (testnet != NULL) {
 	    fprintf(stdout, "   Net: %s\n", testnet->name);
+	    testnet = (netptr)HashNext(Nethash);
 	}
 	for (testinst = instlist; testinst; testinst = testinst->next) {
 	    fprintf(stdout, "   Gate: %s\n", testinst->name);
@@ -3138,7 +3185,7 @@ main(int objc, char *argv[])
     /* Generate internal links representing the network	*/
     /*--------------------------------------------------*/
 
-    createLinks(netlist, instlist, inputlist, outputlist);
+    createLinks(instlist, inputlist, outputlist);
 
     /* Generate a connection list from inputlist */
 
@@ -3154,14 +3201,14 @@ main(int objc, char *argv[])
     /* To do:  Add wire models or computed wire delays	*/
     /*--------------------------------------------------*/
 
-    computeLoads(netlist, instlist, outLoad);
+    computeLoads(Nethash, instlist, outLoad);
 
     /*--------------------------------------------------*/
     /* Assign net types, mainly to identify clocks	*/
     /* Return a list of clock nets			*/
     /*--------------------------------------------------*/
 
-    numterms = assign_net_types(netlist, &clockconnlist);
+    numterms = assign_net_types(Nethash, &clockconnlist);
 
     if (verbose > 1) 
 	fprintf(stdout, "Number of terminals to check: %d\n", numterms);
@@ -3170,7 +3217,7 @@ main(int objc, char *argv[])
     /* Identify all clock-to-terminal paths		*/
     /*--------------------------------------------------*/
 
-    numpaths = find_clock_to_term_paths(clockconnlist, &pathlist, netlist, MAXIMUM_TIME);
+    numpaths = find_clock_to_term_paths(clockconnlist, &pathlist, Nethash, MAXIMUM_TIME);
     fprintf(stdout, "Number of paths analyzed:  %d\n", numpaths);
 
     /*--------------------------------------------------*/
@@ -3259,7 +3306,7 @@ main(int objc, char *argv[])
     /* Now calculate minimum delay paths		*/
     /*--------------------------------------------------*/
 
-    numpaths = find_clock_to_term_paths(clockconnlist, &pathlist, netlist, MINIMUM_TIME);
+    numpaths = find_clock_to_term_paths(clockconnlist, &pathlist, Nethash, MINIMUM_TIME);
     fprintf(stdout, "Number of paths analyzed:  %d\n", numpaths);
 
     /*--------------------------------------------------*/
@@ -3340,7 +3387,7 @@ main(int objc, char *argv[])
     /* Identify all input-to-terminal paths		*/
     /*--------------------------------------------------*/
 
-    numpaths = find_clock_to_term_paths(inputconnlist, &pathlist, netlist, MAXIMUM_TIME);
+    numpaths = find_clock_to_term_paths(inputconnlist, &pathlist, Nethash, MAXIMUM_TIME);
     fprintf(stdout, "Number of paths analyzed:  %d\n", numpaths);
 
     /*--------------------------------------------------*/
@@ -3412,7 +3459,7 @@ main(int objc, char *argv[])
     /* Now calculate minimum delay paths from inputs	*/
     /*--------------------------------------------------*/
 
-    numpaths = find_clock_to_term_paths(inputconnlist, &pathlist, netlist, MINIMUM_TIME);
+    numpaths = find_clock_to_term_paths(inputconnlist, &pathlist, Nethash, MINIMUM_TIME);
     fprintf(stdout, "Number of paths analyzed:  %d\n", numpaths);
 
     /*--------------------------------------------------*/
@@ -3475,5 +3522,6 @@ main(int objc, char *argv[])
 
     free(orderedpaths);
 
+    // Should free netlist memory and HashKill(Nethash) here. . .
     return 0;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/qflow.git



More information about the debian-science-commits mailing list