[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-162-g42a5beb)



The branch, master has been updated
       via  42a5bebc27f842b1955d9626f2521eea124259a0 (commit)
      from  a838dece88323eb782b0ac301c5825ed693fbf0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gnetlist/include/i_vars.h         |    1 +
 gnetlist/include/prototype.h      |    5 ++-
 gnetlist/lib/system-gnetlistrc.in |    8 ++++
 gnetlist/src/g_rc.c               |   12 +++++++
 gnetlist/src/g_register.c         |    1 +
 gnetlist/src/i_vars.c             |    5 ++-
 gnetlist/src/s_cpinlist.c         |    1 +
 gnetlist/src/s_net.c              |   67 ++++++++++++++++++++-----------------
 gnetlist/src/s_netlist.c          |    3 +-
 gnetlist/src/s_traverse.c         |   40 ++++++++++++++++-----
 libgeda/include/struct.h          |    2 +
 libgeda/src/s_toplevel.c          |    1 +
 12 files changed, 101 insertions(+), 45 deletions(-)


=================
 Commit Messages
=================

commit 42a5bebc27f842b1955d9626f2521eea124259a0
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Jan 9 01:04:14 2009 +0000

    gnetlist: Teach netlist traversal code to understand buses (still disabled)
    
    Up until recently, the connection scanning code has rejected some, but not
    all buses. This means that it is unlikely graphical buses formed a useful
    part of anyone's design, since the netlist code in s_traverse_net()
    would not follow connections to another bus segment. The only possible
    bus-pin connectivity has ever been "pin-bus-pin", or "pin-bus-net-...".
    
    This behaviour appears to have been accidental, and would not have been
    easy for a user to take advantage of. The traversal code would not move
    on to a subsequent bus, but would, for example, allow a pin->bus->!bus
    connection, which could then connect onwards. The bus mixed up in this
    would for all intents and purposes behave as a net.
    
    The pin->bus validity bug was actually fixed in libgeda when adding
    support for bus pins. This commit formalises it further, since if
    support for netlisting bus pins were enabled it would otherwise still
    be possible to get a buspin-bus-net-... connection if you tried hard.
    
    Introduce type-checking between pins, nets and buses such that they can
    not netlist where the object types don't match. For buses, the code to
    name a connection based on "netname", "net" or "label" attributes is
    disabled - pending decision as to what constructs we wish to use for
    naming buses. Add a gnetlistrc setting (unnamed-busname ...) which sets
    the default naming (if the connection scanning code were run on bus pins).
    
    This commit lays some of the ground work for shared connection scanning
    code for determining the connectivity of buses and bus pins.

:100644 100644 cfc6367... a607b3b... M	gnetlist/include/i_vars.h
:100644 100644 fdbaf94... d37d397... M	gnetlist/include/prototype.h
:100644 100644 475c153... 176c705... M	gnetlist/lib/system-gnetlistrc.in
:100644 100644 3bc700d... b545a55... M	gnetlist/src/g_rc.c
:100644 100644 727f663... b3dc589... M	gnetlist/src/g_register.c
:100644 100644 e94e55e... 2d2b6b8... M	gnetlist/src/i_vars.c
:100644 100644 ba9843b... f873a5f... M	gnetlist/src/s_cpinlist.c
:100644 100644 6b4b20a... 5fdf975... M	gnetlist/src/s_net.c
:100644 100644 1fe068c... a45b3e0... M	gnetlist/src/s_netlist.c
:100644 100644 31ba9ef... 4613c82... M	gnetlist/src/s_traverse.c
:100644 100644 b2c0084... b29634a... M	libgeda/include/struct.h
:100644 100644 0b7da2d... 57269d3... M	libgeda/src/s_toplevel.c

=========
 Changes
=========

commit 42a5bebc27f842b1955d9626f2521eea124259a0
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Jan 9 01:04:14 2009 +0000

    gnetlist: Teach netlist traversal code to understand buses (still disabled)
    
    Up until recently, the connection scanning code has rejected some, but not
    all buses. This means that it is unlikely graphical buses formed a useful
    part of anyone's design, since the netlist code in s_traverse_net()
    would not follow connections to another bus segment. The only possible
    bus-pin connectivity has ever been "pin-bus-pin", or "pin-bus-net-...".
    
    This behaviour appears to have been accidental, and would not have been
    easy for a user to take advantage of. The traversal code would not move
    on to a subsequent bus, but would, for example, allow a pin->bus->!bus
    connection, which could then connect onwards. The bus mixed up in this
    would for all intents and purposes behave as a net.
    
    The pin->bus validity bug was actually fixed in libgeda when adding
    support for bus pins. This commit formalises it further, since if
    support for netlisting bus pins were enabled it would otherwise still
    be possible to get a buspin-bus-net-... connection if you tried hard.
    
    Introduce type-checking between pins, nets and buses such that they can
    not netlist where the object types don't match. For buses, the code to
    name a connection based on "netname", "net" or "label" attributes is
    disabled - pending decision as to what constructs we wish to use for
    naming buses. Add a gnetlistrc setting (unnamed-busname ...) which sets
    the default naming (if the connection scanning code were run on bus pins).
    
    This commit lays some of the ground work for shared connection scanning
    code for determining the connectivity of buses and bus pins.

diff --git a/gnetlist/include/i_vars.h b/gnetlist/include/i_vars.h
index cfc6367..a607b3b 100644
--- a/gnetlist/include/i_vars.h
+++ b/gnetlist/include/i_vars.h
@@ -30,3 +30,4 @@ extern char *default_hierarchy_netname_separator;
 extern char *default_hierarchy_netattrib_separator;
 extern char *default_hierarchy_uref_separator;
 extern char *default_unnamed_netname;
+extern char *default_unnamed_busname;
diff --git a/gnetlist/include/prototype.h b/gnetlist/include/prototype.h
index fdbaf94..d37d397 100644
--- a/gnetlist/include/prototype.h
+++ b/gnetlist/include/prototype.h
@@ -32,6 +32,7 @@ SCM g_rc_hierarchy_netattrib_order(SCM mode);
 SCM g_rc_hierarchy_netname_order(SCM mode);
 SCM g_rc_hierarchy_uref_order(SCM mode);
 SCM g_rc_unnamed_netname(SCM name);
+SCM g_rc_unnamed_busname(SCM name);
 /* g_register.c */
 void g_register_funcs(void);
 SCM g_quit(void);
@@ -76,7 +77,7 @@ void s_net_print(NET *ptr);
 char *s_net_return_connected_string(TOPLEVEL *pr_current, OBJECT *object, char *hierarchy_tag);
 int s_net_find(NET *net_head, NET *node);
 char *s_net_name_search(TOPLEVEL *pr_current, NET *net_head);
-char *s_net_name(TOPLEVEL *pr_current, NETLIST *netlist_head, NET *net_head, char *hierarchy_tag);
+char *s_net_name(TOPLEVEL *pr_current, NETLIST *netlist_head, NET *net_head, char *hierarchy_tag, int type);
 /* s_netattrib.c */
 char *s_netattrib_extract_netname(char *value);
 void s_netattrib_create_pins(TOPLEVEL *pr_current, OBJECT *o_current, NETLIST *netlist, char *value, char *hierarchy_tag);
@@ -110,7 +111,7 @@ void s_traverse_init(void);
 void s_traverse_start(TOPLEVEL *pr_current);
 void s_traverse_sheet(TOPLEVEL *pr_current, const GList *obj_list, char *hierarchy_tag);
 CPINLIST *s_traverse_component(TOPLEVEL *pr_current, OBJECT *component, char *hierarchy_tag);
-NET *s_traverse_net(TOPLEVEL *pr_current, NET *nets, int starting, OBJECT *object, char *hierarchy_tag);
+NET *s_traverse_net(TOPLEVEL *pr_current, NET *nets, int starting, OBJECT *object, char *hierarchy_tag, int type);
 /* vams_misc.c */
 SCM vams_get_attribs_list(OBJECT *object);
 SCM vams_get_package_attributes(SCM scm_uref);
diff --git a/gnetlist/lib/system-gnetlistrc.in b/gnetlist/lib/system-gnetlistrc.in
index 475c153..176c705 100644
--- a/gnetlist/lib/system-gnetlistrc.in
+++ b/gnetlist/lib/system-gnetlistrc.in
@@ -147,6 +147,14 @@
 ;
 (unnamed-netname "unnamed_net")
 
+; unnamed-busname string
+;
+; Specifies the default string which is placed in front of all buses that
+; have not been explicitly named by the user.
+; (This is not currently useful, since gnetlist does not netlist buses).
+;
+(unnamed-busname "unnamed_bus")
+
 ;
 ; End of mode related keywords
 ;
diff --git a/gnetlist/src/g_rc.c b/gnetlist/src/g_rc.c
index 3bc700d..b545a55 100644
--- a/gnetlist/src/g_rc.c
+++ b/gnetlist/src/g_rc.c
@@ -203,6 +203,18 @@ SCM g_rc_unnamed_netname(SCM name)
   return SCM_BOOL_T;
 }
 
+SCM g_rc_unnamed_busname(SCM name)
+{
+  SCM_ASSERT (scm_is_string (name), name,
+              SCM_ARG1, "unamed-busname");
+
+  g_free(default_unnamed_busname);
+
+  default_unnamed_busname = g_strdup (SCM_STRING_CHARS (name));
+
+  return SCM_BOOL_T;
+}
+
 
 /*************************** GUILE end done *********************************/
 
diff --git a/gnetlist/src/g_register.c b/gnetlist/src/g_register.c
index 727f663..b3dc589 100644
--- a/gnetlist/src/g_register.c
+++ b/gnetlist/src/g_register.c
@@ -69,6 +69,7 @@ static struct gsubr_t gnetlist_funcs[] = {
   { "hierarchy-netname-order",      1, 0, 0, g_rc_hierarchy_netname_order },
   { "hierarchy-uref-order",         1, 0, 0, g_rc_hierarchy_uref_order },
   { "unnamed-netname",              1, 0, 0, g_rc_unnamed_netname },
+  { "unnamed-busname",              1, 0, 0, g_rc_unnamed_busname },
 
   /* netlist functions */
   { "gnetlist:get-packages",        1, 0, 0, g_get_packages },
diff --git a/gnetlist/src/i_vars.c b/gnetlist/src/i_vars.c
index e94e55e..2d2b6b8 100644
--- a/gnetlist/src/i_vars.c
+++ b/gnetlist/src/i_vars.c
@@ -58,6 +58,7 @@ char *default_hierarchy_netname_separator = NULL;
 char *default_hierarchy_netattrib_separator = NULL;
 char *default_hierarchy_uref_separator = NULL;
 char *default_unnamed_netname = NULL;
+char *default_unnamed_busname = NULL;
 
 void i_vars_set(TOPLEVEL * pr_current)
 {
@@ -86,7 +87,8 @@ void i_vars_set(TOPLEVEL * pr_current)
     if (!default_hierarchy_netname_separator ||
         !default_hierarchy_netattrib_separator ||
         !default_hierarchy_uref_separator ||
-        !default_unnamed_netname) {
+        !default_unnamed_netname ||
+        !default_unnamed_busname) {
       fprintf(stderr, "Some rc variables are not set!\n");
       fprintf(stderr, "Check log and make sure the system-gnetlistrc file was found! (exiting)\n");
       exit(-1);
@@ -100,5 +102,6 @@ void i_vars_set(TOPLEVEL * pr_current)
              default_hierarchy_uref_separator);
 
     INIT_STR(pr_current, unnamed_netname, default_unnamed_netname);
+    INIT_STR(pr_current, unnamed_busname, default_unnamed_busname);
 }
 
diff --git a/gnetlist/src/s_cpinlist.c b/gnetlist/src/s_cpinlist.c
index ba9843b..f873a5f 100644
--- a/gnetlist/src/s_cpinlist.c
+++ b/gnetlist/src/s_cpinlist.c
@@ -83,6 +83,7 @@ CPINLIST *s_cpinlist_add(CPINLIST * ptr)
 
     /* setup node information */
     new_node->plid = 0;
+    new_node->type = PIN_TYPE_NET;
     new_node->pin_number = NULL;
     new_node->pin_label = NULL;
     new_node->net_name = NULL;
diff --git a/gnetlist/src/s_net.c b/gnetlist/src/s_net.c
index 6b4b20a..5fdf975 100644
--- a/gnetlist/src/s_net.c
+++ b/gnetlist/src/s_net.c
@@ -42,6 +42,7 @@
 #endif
 
 static int unnamed_net_counter = 1;
+static int unnamed_bus_counter = 1;
 static int unnamed_pin_counter = 1;
 
 #define MAX_UNNAMED_NETS 99999999
@@ -344,10 +345,10 @@ char *s_net_name_search(TOPLEVEL * pr_current, NET * net_head)
     }
 }
 
-char *s_net_name(TOPLEVEL * pr_current, NETLIST * netlist_head,
-		 NET * net_head, char *hierarchy_tag)
+char *s_net_name (TOPLEVEL * pr_current, NETLIST * netlist_head,
+                  NET * net_head, char *hierarchy_tag, int type)
 {
-    char *string;
+    char *string = NULL;
     NET *n_start;
     NETLIST *nl_current;
     CPINLIST *pl_current;
@@ -355,7 +356,8 @@ char *s_net_name(TOPLEVEL * pr_current, NETLIST * netlist_head,
     int found = 0;
     int hierarchy_tag_len;
     char *temp;
-    char *misc;
+    int *unnamed_counter;
+    char *unnamed_string;
 
     net_name = s_net_name_search(pr_current, net_head);
 
@@ -424,37 +426,40 @@ char *s_net_name(TOPLEVEL * pr_current, NETLIST * netlist_head,
 	hierarchy_tag_len = 0;
     }
 
-    /* have we exceeded the number of unnamed nets? */
-    if (unnamed_net_counter < MAX_UNNAMED_NETS) {
-
-	if (netlist_mode == SPICE) {
-	    string =
-        g_strdup_printf("%d", unnamed_net_counter++);
-
-	    return (string);
-	} else {
-	    if (hierarchy_tag) {
-		temp = g_strdup_printf("%s%d", pr_current->unnamed_netname, 
-		        unnamed_net_counter++);
-
-		misc =
-		    s_hierarchy_create_netname(pr_current, temp,
-					       hierarchy_tag);
-		string = g_strdup(misc);
-		g_free(misc);
-	    } else {
-		string = g_strdup_printf("%s%d", pr_current->unnamed_netname, 
-			unnamed_net_counter++);
-	    }
+    switch (type) {
+      case PIN_TYPE_NET:
+        unnamed_counter = &unnamed_net_counter;
+        unnamed_string = pr_current->unnamed_netname;
+        break;
+      case PIN_TYPE_BUS:
+        unnamed_counter = &unnamed_bus_counter;
+        unnamed_string = pr_current->unnamed_busname;
+        break;
+      default:
+        g_critical ("Incorrect connectivity type %i in s_name_nets()\n", type);
+        return NULL;
+    }
 
-	    return (string);
-	}
+    /* have we exceeded the number of unnamed nets? */
+    if (*unnamed_counter < MAX_UNNAMED_NETS) {
+
+        if (netlist_mode == SPICE) {
+          string = g_strdup_printf("%d", (*unnamed_counter)++);
+        } else {
+          temp = g_strdup_printf ("%s%d", unnamed_string, (*unnamed_counter)++);
+          if (hierarchy_tag) {
+            string = s_hierarchy_create_netname (pr_current, temp, hierarchy_tag);
+            g_free (temp);
+          } else {
+            string = temp;
+          }
+        }
 
     } else {
-	fprintf(stderr, "Increase number of unnamed nets (s_net.c)\n");
-	exit(-1);
+      fprintf(stderr, "Increase number of unnamed nets (s_net.c)\n");
+      exit(-1);
     }
 
-    return (NULL);
+    return string;
 
 }
diff --git a/gnetlist/src/s_netlist.c b/gnetlist/src/s_netlist.c
index 1fe068c..a45b3e0 100644
--- a/gnetlist/src/s_netlist.c
+++ b/gnetlist/src/s_netlist.c
@@ -177,7 +177,8 @@ void s_netlist_post_process(TOPLEVEL * pr_current, NETLIST * head)
 			    s_net_name(pr_current,
 				       head,
 				       pl_current->nets,
-				       nl_current->hierarchy_tag);
+				       nl_current->hierarchy_tag,
+				       pl_current->type);
 
 			/* put this name also in the first 
 			   node of the nets linked list */
diff --git a/gnetlist/src/s_traverse.c b/gnetlist/src/s_traverse.c
index 31ba9ef..4613c82 100644
--- a/gnetlist/src/s_traverse.c
+++ b/gnetlist/src/s_traverse.c
@@ -286,6 +286,7 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
     /* add cpin node */
     cpins = s_cpinlist_add(cpins);
     cpins->plid = o_current->sid;
+    cpins->type = o_current->pin_type;
 
     /* search the object only */
     cpins->pin_number =
@@ -302,7 +303,7 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
     /* This avoids us adding an unnamed net for an unconnected pin */
     if (o_current->conn_list != NULL) {
       nets = s_traverse_net (pr_current, nets, TRUE,
-                             o_current, hierarchy_tag);
+                             o_current, hierarchy_tag, cpins->type);
       s_traverse_clear_all_visited (s_page_objects (pr_current->page_current));
     }
 
@@ -315,29 +316,48 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
 }
 
 
+static int connection_type (OBJECT *object)
+{
+  switch (object->type) {
+    case OBJ_PIN:  return object->pin_type;
+    case OBJ_NET:  return PIN_TYPE_NET;
+    case OBJ_BUS:  return PIN_TYPE_BUS;
+    default:
+      g_critical ("Non-connectable object being queried for connection type\n");
+      return PIN_TYPE_NET;
+  }
+}
+
+
 NET *s_traverse_net (TOPLEVEL *pr_current, NET *nets, int starting,
-                     OBJECT *object, char *hierarchy_tag)
+                     OBJECT *object, char *hierarchy_tag, int type)
 {
   NET *new_net;
   CONN *c_current;
   GList *cl_current;
-  char *temp;
+  char *temp = NULL;
 
   visit (object);
+
+  if (connection_type (object) != type)
+    return nets;
+
   new_net = nets = s_net_add(nets);
   new_net->nid = object->sid;
 
   /* pins are not allowed to have the netname attribute attached to them */
   if (object->type != OBJ_PIN) {
-    temp = o_attrib_search_name_single (object, "netname", NULL);
+    /* Ignore netname attributes on buses */
+    if (object->type == OBJ_NET)
+      temp = o_attrib_search_name_single (object, "netname", NULL);
 
     if (temp) {
       new_net->net_name =
         s_hierarchy_create_netname(pr_current, temp,
                                    hierarchy_tag);
       g_free(temp);
-    } else {
-      /* search for the old label= attribute */
+    } else if (object->type == OBJ_NET) {
+      /* search for the old label= attribute on nets */
       temp = o_attrib_search_name_single (object, "label", NULL);
       if (temp) {
         printf("WARNING: Found label=%s. label= is deprecated, please use netname=\n", temp);
@@ -366,7 +386,8 @@ NET *s_traverse_net (TOPLEVEL *pr_current, NET *nets, int starting,
     }
 
     /* net= new */
-    if (strstr(nets->connected_to, "POWER")) {
+    if (strstr(nets->connected_to, "POWER") &&
+        type == PIN_TYPE_NET) {
 
 #if DEBUG
       printf("going to find netname %s \n", nets->connected_to);
@@ -411,10 +432,9 @@ NET *s_traverse_net (TOPLEVEL *pr_current, NET *nets, int starting,
 #endif
 
       if (!is_visited(c_current->other_object) &&
-          c_current->other_object != object &&
-          (starting || c_current->other_object->type != OBJ_BUS)) {
+          c_current->other_object != object) {
         nets = s_traverse_net (pr_current, nets, FALSE,
-                               c_current->other_object, hierarchy_tag);
+                               c_current->other_object, hierarchy_tag, type);
       }
 
     }
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index b2c0084..b29634a 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -575,6 +575,7 @@ struct st_toplevel {
   int hierarchy_netname_order;
   int hierarchy_uref_order;
   char *unnamed_netname;
+  char *unnamed_busname;
 
   /* Callback function for calculating text bounds */
   RenderedBoundsFunc rendered_text_bounds_func;
@@ -605,6 +606,7 @@ struct st_netlist {
 /* for every pin on a component */
 struct st_cpinlist {
   int plid;
+  int type;                             /* PIN_TYPE_NET or PIN_TYPE_BUS */
 
   char *pin_number;
   char *net_name;			/* this is resolved at very end */
diff --git a/libgeda/src/s_toplevel.c b/libgeda/src/s_toplevel.c
index 0b7da2d..57269d3 100644
--- a/libgeda/src/s_toplevel.c
+++ b/libgeda/src/s_toplevel.c
@@ -142,6 +142,7 @@ TOPLEVEL *s_toplevel_new (void)
   toplevel->hierarchy_netname_order = 0;
   toplevel->hierarchy_uref_order = 0;
   toplevel->unnamed_netname = NULL;
+  toplevel->unnamed_busname = NULL;
 
   toplevel->rendered_text_bounds_func = NULL;
   toplevel->rendered_text_bounds_data = NULL;




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs