Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 11 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | * $Id: unrouted.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
2 | * $Id: unrouted.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
| 3 | * |
3 | * |
| 4 | * $Log: unrouted.c,v $ |
4 | * $Log: unrouted.c,v $ |
| 5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
| 6 | * Imported into local repositrory |
6 | * Imported into local repositrory |
| 7 | * |
7 | * |
| Line 19... | Line 19... | ||
| 19 | * Tidying up problematical comments caused by CVS |
19 | * Tidying up problematical comments caused by CVS |
| 20 | * 'intelligent' comment guessing |
20 | * 'intelligent' comment guessing |
| 21 | * |
21 | * |
| 22 | */ |
22 | */ |
| 23 | 23 | ||
| - | 24 | #include <stdio.h> |
|
| 24 | #include "unrouted.h" |
25 | #include <string.h> |
| - | 26 | #include <stdlib.h> |
|
| - | 27 | #include <ctype.h> |
|
| 25 | 28 | ||
| 26 | #include "cmdlog.h" |
- | |
| 27 | #include "cmdparse.h" |
- | |
| 28 | #include "database.h" |
29 | #include "vertcl_main.h" |
| 29 | #include "expression.h" |
30 | #include "expression.h" |
| 30 | #include "generic.h" |
31 | #include "generic.h" |
| - | 32 | #include "database.h" |
|
| 31 | #include "lx_support.h" |
33 | #include "lx_support.h" |
| - | 34 | #include "unrouted.h" |
|
| 32 | #include "statistics.h" |
35 | #include "statistics.h" |
| 33 | #include "vertcl_main.h" |
36 | #include "cmdparse.h" |
| - | 37 | #include "cmdlog.h" |
|
| - | 38 | ||
| - | 39 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/unrouted.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
|
| 34 | 40 | ||
| 35 | #include <ctype.h> |
- | |
| 36 | #include <stdio.h> |
- | |
| 37 | #include <stdlib.h> |
- | |
| 38 | #include <string.h> |
- | |
| 39 | 41 | ||
| 40 | #ident \ |
- | |
| 41 | "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/unrouted.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
- | |
| 42 | 42 | ||
| 43 | /* function that creates the node reference lists for one chip in the list , |
43 | /* function that creates the node reference lists for one chip in the list , |
| 44 | these functions perform operations that were done inside database.c. |
44 | these functions perform operations that were done inside database.c. |
| 45 | */ |
45 | */ |
| 46 | 46 | ||
| 47 | int create_nodes_from_refs (socket_t *socket, int donesomething) |
47 | int create_nodes_from_refs(socket_t * socket,int donesomething) |
| 48 | { |
48 | { |
| 49 | unrouted_ref_t *ref, *prev; |
49 | unrouted_ref_t * ref,*prev; |
| 50 | node_t *cnode; |
50 | node_t * cnode; |
| 51 | net_t *cnet; |
51 | net_t * cnet; |
| 52 | char null_name; |
52 | char null_name; |
| 53 | char *netname; |
53 | char * netname; |
| 54 | int errseen = 0; |
54 | int errseen = 0; |
| 55 | if (!socket) |
55 | if(!socket) { |
| - | 56 | Log(LOG_ERROR,"-- missing socket \n"); |
|
| - | 57 | return(1); |
|
| - | 58 | } |
|
| - | 59 | ||
| - | 60 | ref = socket->unrouted_refs; |
|
| - | 61 | while(ref) { |
|
| - | 62 | ||
| - | 63 | /* pick up any new pin identifiers */ |
|
| - | 64 | cnode = find_node(socket,Ident,ref->identifier,Create); |
|
| - | 65 | ||
| - | 66 | /* if this node is already on a net on the routed list, |
|
| - | 67 | it has already been linked up |
|
| - | 68 | so it should not be duplicated !! */ |
|
| - | 69 | /* iterate each node on the chip */ |
|
| - | 70 | ||
| - | 71 | if ((ref->listref == &routed_list) && cnode->net) /* duplicate !!! */ |
|
| 56 | { |
72 | { |
| 57 | Log (LOG_ERROR, "-- missing socket \n"); |
73 | if(! errseen) { |
| 58 | return (1); |
74 | errseen=1; |
| - | 75 | Log(LOG_ERROR,"-- Errors while creating unrouted list from pins :\n"); |
|
| 59 | } |
76 | } |
| 60 | - | ||
| 61 | ref = socket->unrouted_refs; |
- | |
| 62 | while (ref) |
- | |
| 63 | { |
- | |
| 64 | /* pick up any new pin identifiers */ |
- | |
| 65 | cnode = find_node (socket, Ident, ref->identifier, Create); |
- | |
| 66 | - | ||
| 67 | /* if this node is already on a net on the routed list, |
77 | Log(LOG_ERROR,"-- Error ! node %s(%s) is already in existence on routed net %s\n", |
| 68 | it has already been linked up |
- | |
| 69 | so it should not be duplicated !! */ |
- | |
| 70 | /* iterate each node on the chip */ |
78 | socket->identifier,ref->identifier,cnode->net->name); |
| 71 | 79 | ||
| 72 | if ((ref->listref == &routed_list) && cnode->net) /* duplicate !!! */ |
- | |
| 73 | { |
- | |
| 74 | if (!errseen) |
- | |
| 75 | { |
- | |
| 76 | errseen = 1; |
- | |
| 77 | Log ( |
- | |
| 78 | LOG_ERROR, |
- | |
| 79 | "-- Errors while creating unrouted list from pins :\n"); |
- | |
| 80 | } |
- | |
| 81 | Log ( |
- | |
| 82 | LOG_ERROR, |
- | |
| 83 | "-- Error ! node %s(%s) is already in existence on routed net " |
- | |
| 84 | "%s\n", |
- | |
| 85 | socket->identifier, |
- | |
| 86 | ref->identifier, |
- | |
| 87 | cnode->net->name); |
- | |
| 88 | } |
80 | } |
| 89 | else |
- | |
| 90 | { |
81 | else { |
| 91 | netname = ref->name; |
82 | netname = ref->name; |
| 92 | null_name = ISNULLSTR (netname); |
83 | null_name = ISNULLSTR(netname); |
| 93 | /* bidir pins are essentially free for routing */ |
84 | /* bidir pins are essentially free for routing */ |
| 94 | if (null_name || socket->is_template) |
85 | if (null_name || socket->is_template) { |
| 95 | { |
- | |
| 96 | if (ref->pindir != BIDIR) |
86 | if(ref->pindir != BIDIR) |
| 97 | cnode->fixed_pin = 1; |
87 | cnode->fixed_pin = 1; |
| 98 | cnode->pindir = ref->pindir; |
88 | cnode->pindir = ref->pindir; |
| 99 | } |
89 | } |
| 100 | if (socket->is_template || ref->listref == &routed_list) |
90 | if(socket->is_template || ref->listref == &routed_list) { |
| 101 | { |
- | |
| 102 | cnode->pin_group = ref->pin_group; |
91 | cnode->pin_group = ref->pin_group; |
| - | 92 | ||
| 103 | 93 | ||
| 104 | cnode->vhdltype = ref->vhdltype; |
94 | cnode->vhdltype = ref->vhdltype; |
| 105 | #if defined DEBUG_EXPRESSION |
95 | #if defined DEBUG_EXPRESSION |
| 106 | if (cnode->vhdltype) |
96 | if (cnode->vhdltype) { |
| 107 | { |
- | |
| 108 | print_msg_expression ( |
- | |
| 109 | stdout, "COPYING ", cnode->vhdltype->expr); |
97 | print_msg_expression(stdout,"COPYING ",cnode->vhdltype->expr); |
| 110 | } |
98 | } |
| 111 | #endif |
99 | #endif |
| 112 | if (!null_name) |
100 | if(!null_name) |
| 113 | cnode->name = strdup (netname); |
101 | cnode->name = strdup(netname); |
| 114 | } |
102 | } |
| 115 | if (!socket->is_template && !null_name) |
103 | if (!socket->is_template && !null_name ) { |
| 116 | { |
- | |
| 117 | cnet = find_net (ref->listref, Ident, netname, Create); |
104 | cnet = find_net(ref->listref, |
| 118 | connect_node_net ( |
105 | Ident, |
| 119 | ref->orig_name, |
106 | netname, |
| 120 | cnode, |
107 | Create); |
| 121 | cnet, |
108 | connect_node_net(ref->orig_name, |
| 122 | ref->pindir, |
109 | cnode,cnet,ref->pindir, |
| 123 | ref->vhdltype, |
110 | ref->vhdltype, |
| 124 | ref->orig_vhdltype, |
111 | ref->orig_vhdltype, |
| 125 | ref->lhs_expr); |
112 | ref->lhs_expr); |
| 126 | donesomething = 1; |
113 | donesomething = 1; |
| 127 | }; |
114 | }; |
| 128 | } |
115 | } |
| 129 | prev = ref; |
116 | prev=ref; |
| 130 | ref = ref->next; |
117 | ref= ref->next; |
| 131 | free (prev); |
118 | free(prev); |
| 132 | } |
119 | } |
| 133 | socket->unrouted_refs = NULL; /* remove any references to unrouted stuff, |
120 | socket->unrouted_refs = NULL; /* remove any references to unrouted stuff, |
| 134 | they are all free()'d now */ |
121 | they are all free()'d now */ |
| 135 | 122 | ||
| 136 | return 0; |
123 | return 0; |
| 137 | } |
124 | } |
| 138 | 125 | ||
| 139 | /* creates the unrouted list from unrouted_refs list for all sockets */ |
- | |
| 140 | 126 | ||
| - | 127 | /* creates the unrouted list from unrouted_refs list for all sockets */ |
|
| - | 128 | ||
| 141 | void create_unrouted_list (void) |
129 | void create_unrouted_list(void) |
| 142 | { |
130 | { |
| 143 | socket_t *socket = socket_head; |
131 | socket_t * socket = socket_head; |
| 144 | int donesomething = 0; |
132 | int donesomething = 0; |
| 145 | while (socket) |
133 | while(socket) { |
| 146 | { |
- | |
| 147 | donesomething = create_nodes_from_refs (socket, donesomething); |
134 | donesomething = create_nodes_from_refs(socket,donesomething); |
| 148 | socket = socket->next; |
135 | socket=socket->next; |
| - | 136 | ||
| 149 | } |
137 | } |
| 150 | if (donesomething) |
138 | if(donesomething) |
| 151 | Log (LOG_GENERAL, "-- New pins converted to unrouted net\n"); |
139 | Log(LOG_GENERAL,"-- New pins converted to unrouted net\n"); |
| 152 | } |
- | |
| 153 | 140 | ||
| 154 | void rename_unrouted_pin_socket ( |
- | |
| 155 | socket_t *socket, char *old_name, char *new_name, vhdl_t *vhdl_type) |
- | |
| 156 | { |
141 | } |
| 157 | unrouted_ref_t *ref; |
- | |
| 158 | char *socket_name; |
- | |
| 159 | 142 | ||
| 160 | socket_name = socket->identifier; |
- | |
| 161 | 143 | ||
| - | 144 | void rename_unrouted_pin_socket(socket_t * socket, |
|
| - | 145 | char * old_name, |
|
| - | 146 | char * new_name,vhdl_t * vhdl_type) { |
|
| - | 147 | unrouted_ref_t * ref; |
|
| - | 148 | char * socket_name; |
|
| - | 149 | ||
| - | 150 | ||
| - | 151 | socket_name = socket->identifier; |
|
| - | 152 | ||
| 162 | ref = socket->unrouted_refs; |
153 | ref = socket->unrouted_refs; |
| - | 154 | ||
| - | 155 | if(!ref) |
|
| - | 156 | Log(LOG_ERROR,"# ERROR pin rename : no pin '%s.%s'\n",socket_name,old_name); |
|
| - | 157 | ||
| - | 158 | ||
| - | 159 | while(ref) { |
|
| - | 160 | if(strcmp2(old_name,ref->name)==0) { |
|
| - | 161 | /* do rename only if there is a rename */ |
|
| - | 162 | if(strcmp2(ref->orig_name,ref->name)!=0) { |
|
| - | 163 | ref->orig_name = ref->name; /* keep old name in alias part */ |
|
| - | 164 | ref->name = strdup(new_name); /* and rename the unrouted node */ |
|
| - | 165 | } |
|
| - | 166 | /* if it does not have a base type then copy it */ |
|
| - | 167 | if(!vhdl_type->basetype) |
|
| - | 168 | vhdl_type->basetype = default_vhdl_datatype->basetype; |
|
| - | 169 | ||
| - | 170 | /* do pinslicing only if there is a pin slice involved */ |
|
| - | 171 | ||
| - | 172 | if(vhdl_type != default_vhdl_datatype) { |
|
| - | 173 | ref->orig_vhdltype = ref->vhdltype; /* keep old VHDL type around */ |
|
| - | 174 | if(vhdl_type) |
|
| - | 175 | ref->vhdltype = copy_vhdl(vhdl_type,socket); /* assign the new vhdl type */ |
|
| 163 | 176 | ||
| 164 | if (!ref) |
- | |
| 165 | Log ( |
- | |
| 166 | LOG_ERROR, "# ERROR pin rename : no pin '%s.%s'\n", socket_name, old_name); |
- | |
| 167 | - | ||
| 168 | while (ref) |
- | |
| 169 | { |
- | |
| 170 | if (strcmp2 (old_name, ref->name) == 0) |
- | |
| 171 | { |
- | |
| 172 | /* do rename only if there is a rename */ |
- | |
| 173 | if (strcmp2 (ref->orig_name, ref->name) != 0) |
- | |
| 174 | { |
- | |
| 175 | ref->orig_name = ref->name; /* keep old name in alias part */ |
- | |
| 176 | ref->name = |
- | |
| 177 | strdup (new_name); /* and rename the unrouted node */ |
- | |
| 178 | } |
- | |
| 179 | /* if it does not have a base type then copy it */ |
- | |
| 180 | if (!vhdl_type->basetype) |
- | |
| 181 | vhdl_type->basetype = default_vhdl_datatype->basetype; |
- | |
| 182 | - | ||
| 183 | /* do pinslicing only if there is a pin slice involved */ |
- | |
| 184 | - | ||
| 185 | if (vhdl_type != default_vhdl_datatype) |
- | |
| 186 | { |
- | |
| 187 | ref->orig_vhdltype = |
- | |
| 188 | ref->vhdltype; /* keep old VHDL type around */ |
- | |
| 189 | if (vhdl_type) |
- | |
| 190 | ref->vhdltype = copy_vhdl ( |
- | |
| 191 | vhdl_type, socket); /* assign the new vhdl type */ |
- | |
| 192 | } |
- | |
| 193 | - | ||
| 194 | if (level & 16) |
- | |
| 195 | { |
- | |
| 196 | Log ( |
- | |
| 197 | LOG_GENERAL, |
- | |
| 198 | "# renaming '%s.%s' to be '%s'\n", |
- | |
| 199 | socket_name, |
- | |
| 200 | ref->orig_name, |
- | |
| 201 | ref->name); |
- | |
| 202 | } |
- | |
| 203 | break; |
- | |
| 204 | } |
- | |
| 205 | ref = ref->next; |
- | |
| 206 | } |
177 | } |
| 207 | } |
178 | |
| 208 | 179 | ||
| 209 | void rename_unrouted_pin (char *socket_name, char *old_name, char *new_name, vhdl_t *vhdl_type) |
- | |
| 210 | { |
- | |
| 211 | socket_t *socket; |
- | |
| 212 | socket = find_socket (Ident, socket_name, Search, &socket_head); |
- | |
| 213 | if (!socket) |
180 | if(level & 16) |
| 214 | { |
181 | { |
| 215 | Log ( |
- | |
| 216 | LOG_ERROR, |
- | |
| 217 | "# ERROR connecting port : Cannot Locate socket identified as '%s'\n", |
182 | Log(LOG_GENERAL,"# renaming '%s.%s' to be '%s'\n",socket_name,ref->orig_name,ref->name); |
| 218 | socket_name); |
- | |
| 219 | } |
183 | } |
| 220 | else |
184 | break; |
| - | 185 | } |
|
| - | 186 | ref=ref->next; |
|
| - | 187 | } |
|
| - | 188 | } |
|
| - | 189 | ||
| - | 190 | ||
| - | 191 | void rename_unrouted_pin(char * socket_name,char * old_name,char * new_name,vhdl_t * vhdl_type) { |
|
| - | 192 | socket_t * socket; |
|
| - | 193 | socket = find_socket(Ident,socket_name,Search,&socket_head); |
|
| - | 194 | if(!socket) { |
|
| - | 195 | Log(LOG_ERROR,"# ERROR connecting port : Cannot Locate socket identified as '%s'\n",socket_name); |
|
| - | 196 | } |
|
| - | 197 | else |
|
| 221 | rename_unrouted_pin_socket (socket, old_name, new_name, vhdl_type); |
198 | rename_unrouted_pin_socket(socket,old_name,new_name,vhdl_type); |
| 222 | } |
199 | } |