Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /* |
| 2 | * $Id: acf_fns.c,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ |
||
| 3 | * |
||
| 4 | * $Log: acf_fns.c,v $ |
||
| 5 | * Revision 1.1.1.1 2003/11/04 23:34:56 mjames |
||
| 6 | * Imported into local repositrory |
||
| 7 | * |
||
| 8 | * Revision 1.5 2001/11/09 22:17:00 mjames |
||
| 9 | * changed some comments |
||
| 10 | * |
||
| 11 | * Revision 1.4 2001/10/31 22:19:56 mjames |
||
| 12 | * Tidying up problematical comments caused by CVS |
||
| 13 | * 'intelligent' comment guessing |
||
| 14 | * |
||
| 15 | */ |
||
| 16 | |||
| 17 | #include "acf_fns.h" |
||
| 18 | |||
| 19 | #include "cmdlog.h" |
||
| 20 | #include "cmdparse.h" |
||
| 21 | #include "database.h" |
||
| 22 | #include "expression.h" |
||
| 23 | #include "generic.h" |
||
| 24 | #include "jumpering.h" |
||
| 25 | #include "lx_support.h" |
||
| 26 | #include "routing.h" |
||
| 27 | |||
| 28 | #include <stdio.h> |
||
| 29 | #include <stdlib.h> |
||
| 30 | #include <string.h> |
||
| 31 | |||
| 32 | socket_t *current_chip; |
||
| 33 | node_t *current_node; |
||
| 34 | net_t *current_net; |
||
| 35 | net_t **current_list; |
||
| 36 | |||
| 37 | /* used in net joining in the YACC parser */ |
||
| 38 | |||
| 39 | net_t **join_context; |
||
| 40 | JoinMode_t join_mode; |
||
| 41 | net_t *top_net; |
||
| 42 | |||
| 43 | char curr_pin_name[MAXIDLEN]; |
||
| 44 | char curr_pin_ident[MAXIDLEN]; |
||
| 45 | int curr_pin_dir; |
||
| 46 | |||
| 47 | int chip_context; |
||
| 48 | |||
| 49 | node_context_t node_context; |
||
| 50 | |||
| 51 | /* if the user types something like U1(10) or U1(22) */ |
||
| 52 | /* this determines the node and socket */ |
||
| 53 | void handle_jumper_node_text (char *text) |
||
| 54 | { |
||
| 55 | if (top_net && current_chip) |
||
| 56 | { |
||
| 57 | /* find node itself */ |
||
| 58 | current_node = find_node (current_chip, Ident, text, Search); |
||
| 59 | if (!current_node) |
||
| 60 | { |
||
| 61 | Log ( |
||
| 62 | LOG_GENERAL, |
||
| 63 | "-- Cannot locate node '%s(%s)'\n", |
||
| 64 | current_chip->identifier, |
||
| 65 | text); |
||
| 66 | return; |
||
| 67 | } /* use net that node is on */ |
||
| 68 | |||
| 69 | if (!current_node->net) |
||
| 70 | { |
||
| 71 | Log ( |
||
| 72 | LOG_GENERAL, |
||
| 73 | "-- Cannot locate net for node '%s(%s)'\n", |
||
| 74 | current_chip->identifier, |
||
| 75 | text); |
||
| 76 | return; |
||
| 77 | } |
||
| 78 | |||
| 79 | /* this node is a normal jumper of a routed list node e.g. IC1(100) */ |
||
| 80 | |||
| 81 | if (current_node->net->list_ref == &routed_list) |
||
| 82 | { |
||
| 83 | /* mark this as a net referred to by node ID not net name */ |
||
| 84 | if (transfer_net_to_subnet (join_context, top_net, current_node->net)) |
||
| 85 | { |
||
| 86 | /* if a net has an external connection then this node is the |
||
| 87 | * one that provides it */ |
||
| 88 | current_node->net->external_node = current_node; |
||
| 89 | } |
||
| 90 | else |
||
| 91 | { |
||
| 92 | Log ( |
||
| 93 | LOG_GENERAL, |
||
| 94 | "-- node '%s(%s)' is not on routed list\n", |
||
| 95 | current_chip->identifier, |
||
| 96 | text); |
||
| 97 | return; |
||
| 98 | } |
||
| 99 | } |
||
| 100 | } |
||
| 101 | } |
||
| 102 | |||
| 103 | void handle_alias_node_text (char *text) |
||
| 104 | { |
||
| 105 | noderef_t *unlink_noderef; |
||
| 106 | node_t *unlink_node; |
||
| 107 | net_t *unlink_net; |
||
| 108 | char *newname; |
||
| 109 | Log (LOG_GENERAL, "-- in handle_alias_node_text --\n"); |
||
| 110 | |||
| 111 | if (current_chip && top_net) |
||
| 112 | { |
||
| 113 | /* this is a jumper of the type IC.name which is a way of connecting a net to a |
||
| 114 | * named list */ |
||
| 115 | |||
| 116 | Log (LOG_GENERAL, "-- Looking for net '%s'\n", text); |
||
| 117 | current_net = find_net (&unrouted_list, Ident, text, Search); |
||
| 118 | if (current_net) |
||
| 119 | { |
||
| 120 | Log ( |
||
| 121 | LOG_GENERAL, |
||
| 122 | "-- alias of type chip.pin found :%s.%s\n", |
||
| 123 | current_chip->name, |
||
| 124 | text); |
||
| 125 | /* locate the appropriate node reference from unrouted list net */ |
||
| 126 | unlink_noderef = remove_noderef_from_list (current_net, current_chip); |
||
| 127 | if (unlink_noderef) |
||
| 128 | { |
||
| 129 | /* now we have a node reference, we need to create a new net */ |
||
| 130 | unlink_node = unlink_noderef->node; |
||
| 131 | /* |
||
| 132 | newname = |
||
| 133 | malloc(strlen(current_chip->name)+strlen(current_net->identifier)+2); |
||
| 134 | sprintf |
||
| 135 | (newname,"%s_%s",current_chip->name,current_net->identifier); |
||
| 136 | */ |
||
| 137 | newname = malloc ( |
||
| 138 | strlen (current_chip->name) + |
||
| 139 | strlen (current_net->identifier) + 2); |
||
| 140 | sprintf ( |
||
| 141 | newname, |
||
| 142 | "%s.%s", |
||
| 143 | current_chip->name, |
||
| 144 | current_net->identifier); |
||
| 145 | unlink_net = find_net (&unrouted_list, Ident, newname, Create); |
||
| 146 | Log (LOG_GENERAL, "-- created new net '%s'\n", newname); |
||
| 147 | /* set new net identifier */ |
||
| 148 | unlink_net->name = allocstr (text); |
||
| 149 | |||
| 150 | unlink_noderef->net = unlink_net; /* this node reference refers |
||
| 151 | back to its parent net */ |
||
| 152 | |||
| 153 | unlink_net->nodecount = 1; /* one more node on this net */ |
||
| 154 | |||
| 155 | /* link node reference to the net */ |
||
| 156 | unlink_noderef->next = NULL; |
||
| 157 | unlink_net->nodes = |
||
| 158 | unlink_noderef; /* place reference on head of list */ |
||
| 159 | unlink_net->how_joined = Aliased_Pin; |
||
| 160 | |||
| 161 | transfer_net_to_subnet (&unrouted_list, top_net, unlink_net); |
||
| 162 | unlink_net->how_joined = Aliased_Pin; |
||
| 163 | |||
| 164 | free (newname); |
||
| 165 | } |
||
| 166 | else |
||
| 167 | Log (LOG_GENERAL, "-- failed to remove node from list\n"); |
||
| 168 | } |
||
| 169 | } |
||
| 170 | Log (LOG_GENERAL, "-- leaving handle_alias_node_text --\n\n"); |
||
| 171 | } |