netlist_utils.h File Reference

#include "types.h"
Include dependency graph for netlist_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nnode_tallocate_nnode ()
npin_tallocate_npin ()
void free_npin (npin_t *to_free)
npin_tget_a_zero_pin (netlist_t *netlist)
npin_tget_a_pad_pin (netlist_t *netlist)
npin_tget_a_one_pin (netlist_t *netlist)
npin_tcopy_input_npin (npin_t *copy_pin)
npin_tcopy_output_npin (npin_t *copy_pin)
nnet_tallocate_nnet ()
void free_nnode (nnode_t *to_free)
void free_nnet (nnet_t *to_free)
void allocate_more_node_input_pins (nnode_t *node, int width)
void allocate_more_node_output_pins (nnode_t *node, int width)
void move_a_input_pin (nnode_t *node, int old_idx, int new_idx)
void move_a_output_pin (nnode_t *node, int old_idx, int new_idx)
void add_a_input_pin_to_node_spot_idx (nnode_t *node, npin_t *pin, int pin_idx)
void add_a_fanout_pin_to_net (nnet_t *net, npin_t *pin)
void add_a_output_pin_to_node_spot_idx (nnode_t *node, npin_t *pin, int pin_idx)
void add_a_driver_pin_to_net (nnet_t *net, npin_t *pin)
void add_output_port_information (nnode_t *node, int port_width)
void add_input_port_information (nnode_t *node, int port_width)
void combine_nets (nnet_t *output_net, nnet_t *input_net, netlist_t *netlist)
void join_nets (nnet_t *net, nnet_t *input_net)
void remap_pin_to_new_net (npin_t *pin, nnet_t *new_net)
void remap_pin_to_new_node (npin_t *pin, nnode_t *new_node, int pin_idx)
signal_list_tinit_signal_list_structure ()
void add_pin_to_signal_list (signal_list_t *list, npin_t *pin)
void sort_signal_list_alphabetically (signal_list_t *list)
signal_list_tcombine_lists (signal_list_t **signal_lists, int num_signal_lists)
signal_list_tcombine_lists_without_freeing_originals (signal_list_t **signal_lists, int num_signal_lists)
void clean_signal_list_structure (signal_list_t *list)
void hookup_hb_input_pins_from_signal_list (nnode_t *node, int n_start_idx, signal_list_t *input_list, int il_start_idx, int width, netlist_t *netlist)
void hookup_input_pins_from_signal_list (nnode_t *node, int n_start_idx, signal_list_t *input_list, int il_start_idx, int width, netlist_t *netlist)
void hookup_output_pins_from_signal_list (nnode_t *node, int n_start_idx, signal_list_t *output_list, int ol_start_idx, int width)
signal_list_tmake_output_pins_for_existing_node (nnode_t *node, int width)
void connect_nodes (nnode_t *out_node, int out_idx, nnode_t *in_node, int in_idx)
int count_nodes_in_netlist (netlist_t *netlist)
netlist_tallocate_netlist ()
void free_netlist (netlist_t *to_free)
void add_node_to_netlist (netlist_t *netlist, nnode_t *node, short special_node)
void mark_clock_node (netlist_t *netlist, char *clock_name)

Function Documentation

void add_a_driver_pin_to_net ( nnet_t net,
npin_t pin 
)

Definition at line 393 of file netlist_utils.c.

00394 {
00395         oassert(net != NULL);
00396         oassert(pin != NULL);
00397         oassert(pin->type != INPUT);
00398         /* assumes the pin spots have been allocated and the pin */
00399         net->driver_pin = pin;
00400         /* record the node and pin spot in the pin */
00401         pin->net = net;
00402         pin->type = OUTPUT;
00403 }

Here is the caller graph for this function:

void add_a_fanout_pin_to_net ( nnet_t net,
npin_t pin 
)

Definition at line 359 of file netlist_utils.c.

00360 {
00361         oassert(net != NULL);
00362         oassert(pin != NULL);
00363         oassert(pin->type != OUTPUT);
00364         /* assumes the pin spots have been allocated and the pin */
00365         net->fanout_pins = (npin_t**)realloc(net->fanout_pins, sizeof(npin_t*)*(net->num_fanout_pins+1));
00366         net->fanout_pins[net->num_fanout_pins] = pin;
00367         net->num_fanout_pins++;
00368         /* record the node and pin spot in the pin */
00369         pin->net = net;
00370         pin->pin_net_idx = net->num_fanout_pins-1;
00371         pin->type = INPUT;
00372 }

Here is the caller graph for this function:

void add_a_input_pin_to_node_spot_idx ( nnode_t node,
npin_t pin,
int  pin_idx 
)

Definition at line 343 of file netlist_utils.c.

00344 {
00345         oassert(node != NULL);
00346         oassert(pin != NULL);
00347         oassert(pin_idx < node->num_input_pins);
00348         /* assumes the pin spots have been allocated and the pin */
00349         node->input_pins[pin_idx] = pin;
00350         /* record the node and pin spot in the pin */
00351         pin->type = INPUT;
00352         pin->node = node;
00353         pin->pin_node_idx = pin_idx;
00354 }

Here is the caller graph for this function:

void add_a_output_pin_to_node_spot_idx ( nnode_t node,
npin_t pin,
int  pin_idx 
)

Definition at line 377 of file netlist_utils.c.

00378 {
00379         oassert(node != NULL);
00380         oassert(pin != NULL);
00381         oassert(pin_idx < node->num_output_pins);
00382         /* assumes the pin spots have been allocated and the pin */
00383         node->output_pins[pin_idx] = pin;
00384         /* record the node and pin spot in the pin */
00385         pin->type = OUTPUT;
00386         pin->node = node;
00387         pin->pin_node_idx = pin_idx;
00388 }

Here is the caller graph for this function:

void add_input_port_information ( nnode_t node,
int  port_width 
)

Definition at line 186 of file netlist_utils.c.

00187 {
00188         node->input_port_sizes = (int *)realloc(node->input_port_sizes, sizeof(int)*(node->num_input_port_sizes+1));
00189         node->input_port_sizes[node->num_input_port_sizes] = port_width;
00190         node->num_input_port_sizes++;
00191 }

Here is the caller graph for this function:

void add_node_to_netlist ( netlist_t netlist,
nnode_t node,
short  special_node 
)

Definition at line 894 of file netlist_utils.c.

00895 {
00896         long sc_spot;
00897 
00898 //      if (node->type != OUTPUT_NODE)
00899         {
00900                 /* add the node to the list */
00901                 sc_spot = sc_add_string(netlist->nodes_sc, node->name);
00902                 if (netlist->nodes_sc->data[sc_spot] != NULL)
00903                 {
00904                         error_message(NETLIST_ERROR, linenum, -1, "Two nodes with the same name (%s)\n", node->name);
00905                 }
00906                 netlist->nodes_sc->data[sc_spot] = (void*)node;
00907         }
00908                 
00909         if (special_node == INPUT_NODE)
00910         {
00911                 /* This is for clocks, gnd, and vcc */
00912                 /* store the input nodes for traversal */
00913                 netlist->top_input_nodes = (nnode_t**)realloc(netlist->top_input_nodes, sizeof(nnode_t*)*(netlist->num_top_input_nodes+1));
00914                 netlist->top_input_nodes[netlist->num_top_input_nodes] = node;
00915                 netlist->num_top_input_nodes++;
00916         }
00917         else if (node->type == INPUT_NODE)
00918         {
00919                 /* store the input nodes for traversal */
00920                 netlist->top_input_nodes = (nnode_t**)realloc(netlist->top_input_nodes, sizeof(nnode_t*)*(netlist->num_top_input_nodes+1));
00921                 netlist->top_input_nodes[netlist->num_top_input_nodes] = node;
00922                 netlist->num_top_input_nodes++;
00923         }
00924         else if (node->type == OUTPUT_NODE)
00925         {
00926                 netlist->top_output_nodes = (nnode_t**)realloc(netlist->top_output_nodes, sizeof(nnode_t*)*(netlist->num_top_output_nodes+1));
00927                 netlist->top_output_nodes[netlist->num_top_output_nodes] = node;
00928                 netlist->num_top_output_nodes++;
00929         }
00930         else if (node->type == FF_NODE)
00931         {
00932                 netlist->ff_nodes = (nnode_t**)realloc(netlist->ff_nodes, sizeof(nnode_t*)*(netlist->num_ff_nodes+1));
00933                 netlist->ff_nodes[netlist->num_ff_nodes] = node;
00934                 netlist->num_ff_nodes++;
00935         }
00936         else 
00937         {
00938                 netlist->internal_nodes = (nnode_t**)realloc(netlist->internal_nodes, sizeof(nnode_t*)*(netlist->num_internal_nodes+1));
00939                 netlist->internal_nodes[netlist->num_internal_nodes] = node;
00940                 netlist->num_internal_nodes++;
00941         }
00942 }

Here is the call graph for this function:

void add_output_port_information ( nnode_t node,
int  port_width 
)

Definition at line 176 of file netlist_utils.c.

00177 {
00178         node->output_port_sizes = (int *)realloc(node->output_port_sizes, sizeof(int)*(node->num_output_port_sizes+1));
00179         node->output_port_sizes[node->num_output_port_sizes] = port_width;
00180         node->num_output_port_sizes++;
00181 }

Here is the caller graph for this function:

void add_pin_to_signal_list ( signal_list_t list,
npin_t pin 
)

Definition at line 570 of file netlist_utils.c.

00571 {
00572         list->signal_list = (npin_t**)realloc(list->signal_list, sizeof(npin_t*)*(list->signal_list_size+1));
00573         list->signal_list[list->signal_list_size] = pin;
00574         list->signal_list_size++;
00575 }

Here is the caller graph for this function:

void allocate_more_node_input_pins ( nnode_t node,
int  width 
)

Definition at line 133 of file netlist_utils.c.

00134 {
00135         int i;
00136 
00137         if (width <= 0)
00138         {
00139                 warning_message(NETLIST_ERROR, -1, -1, "tried adding output pins for with <= 0 %s\n", node->name);
00140                 return;
00141         }
00142 
00143         node->input_pins = (npin_t**)realloc(node->input_pins, sizeof(npin_t*)*(node->num_input_pins+width));
00144         for (i = 0; i < width; i++)
00145         {
00146                 node->input_pins[node->num_input_pins+i] = NULL;
00147         }
00148         node->num_input_pins += width;
00149 }

Here is the call graph for this function:

Here is the caller graph for this function:

void allocate_more_node_output_pins ( nnode_t node,
int  width 
)

Definition at line 155 of file netlist_utils.c.

00156 {
00157         int i;
00158 
00159         if (width <= 0)
00160         {
00161                 warning_message(NETLIST_ERROR, -1, -1, "tried adding output pins for with <= 0 %s\n", node->name);
00162                 return;
00163         }
00164 
00165         node->output_pins = (npin_t**)realloc(node->output_pins, sizeof(npin_t*)*(node->num_output_pins+width));
00166         for (i = 0; i < width; i++)
00167         {
00168                 node->output_pins[node->num_output_pins+i] = NULL;
00169         }
00170         node->num_output_pins += width;
00171 }

Here is the call graph for this function:

Here is the caller graph for this function:

netlist_t* allocate_netlist (  ) 

Definition at line 835 of file netlist_utils.c.

00836 {
00837         netlist_t *new_netlist;
00838 
00839         new_netlist = (netlist_t *)my_malloc_struct(sizeof(netlist_t));
00840 
00841         new_netlist->gnd_node = NULL;
00842         new_netlist->vcc_node = NULL;
00843         new_netlist->pad_node = NULL;
00844         new_netlist->zero_net = NULL;
00845         new_netlist->one_net = NULL;
00846         new_netlist->pad_net = NULL;
00847         new_netlist->top_input_nodes = NULL;
00848         new_netlist->num_top_input_nodes = 0;
00849         new_netlist->top_output_nodes = NULL;
00850         new_netlist->num_top_output_nodes = 0;
00851         new_netlist->ff_nodes = NULL;
00852         new_netlist->num_ff_nodes = 0;
00853         new_netlist->internal_nodes = NULL;
00854         new_netlist->num_internal_nodes = 0;
00855         new_netlist->clocks = NULL;
00856         new_netlist->num_clocks = 0;
00857 
00858         new_netlist->forward_levels = NULL;
00859         new_netlist->num_forward_levels = 0;
00860         new_netlist->num_at_forward_level = NULL;
00861         new_netlist->backward_levels = NULL; 
00862         new_netlist->num_backward_levels = 0;
00863         new_netlist->num_at_backward_level = NULL;
00864         new_netlist->sequential_level_nodes = NULL; 
00865         new_netlist->num_sequential_levels = 0;
00866         new_netlist->num_at_sequential_level = NULL;
00867         new_netlist->sequential_level_combinational_termination_node = NULL;
00868         new_netlist->num_sequential_level_combinational_termination_nodes = 0;
00869         new_netlist->num_at_sequential_level_combinational_termination_node = NULL;
00870 
00871         /* initialize the string chaches */
00872         new_netlist->nets_sc = sc_new_string_cache();
00873         new_netlist->out_pins_sc = sc_new_string_cache();
00874         new_netlist->nodes_sc = sc_new_string_cache();
00875 
00876         new_netlist->stats = NULL;
00877 
00878         return new_netlist;
00879 }

Here is the call graph for this function:

Here is the caller graph for this function:

nnet_t* allocate_nnet (  ) 

Definition at line 270 of file netlist_utils.c.

00271 {
00272         nnet_t *new_net;
00273 
00274         new_net = (nnet_t*)my_malloc_struct(sizeof(nnet_t));
00275         
00276         new_net->name = NULL;
00277         new_net->driver_pin = NULL;
00278         new_net->fanout_pins = NULL;
00279         new_net->num_fanout_pins = 0;
00280         new_net->combined = FALSE;
00281 
00282         new_net->net_data = NULL;
00283         new_net->unique_net_data_id = -1;
00284 
00285         return new_net;
00286 }

Here is the call graph for this function:

Here is the caller graph for this function:

nnode_t* allocate_nnode (  ) 

Definition at line 38 of file netlist_utils.c.

00039 {
00040         nnode_t *new_node;
00041 
00042         new_node = (nnode_t *)my_malloc_struct(sizeof(nnode_t));
00043         
00044         new_node->name = NULL;
00045         new_node->type = NO_OP;
00046         new_node->related_ast_node = NULL;
00047         new_node->traverse_visited = -1;
00048 
00049         new_node->input_pins = NULL;
00050         new_node->num_input_pins = 0;
00051         new_node->output_pins = NULL;
00052         new_node->num_output_pins = 0;
00053         
00054         new_node->input_port_sizes = NULL;
00055         new_node->num_input_port_sizes = 0;
00056         new_node->output_port_sizes = NULL;
00057         new_node->num_output_port_sizes = 0;
00058 
00059         new_node->node_data = NULL;
00060         new_node->unique_node_data_id = -1;
00061 
00062         new_node->forward_level = -1;
00063         new_node->backward_level = -1;
00064         new_node->sequential_level = -1;
00065         new_node->sequential_terminator = FALSE;
00066 
00067         new_node->internal_netlist = NULL;
00068 
00069         new_node->associated_function = NULL;
00070 
00071         new_node->simulate_block_cycle = NULL;
00072         new_node->memory_data = NULL;
00073         
00074         new_node->bit_map= NULL;
00075         new_node->bit_map_line_count=0;
00076 
00077         return new_node;
00078 }

Here is the call graph for this function:

Here is the caller graph for this function:

npin_t* allocate_npin (  ) 

Definition at line 196 of file netlist_utils.c.

00197 {
00198         npin_t *new_pin;
00199 
00200         new_pin = (npin_t *)my_malloc_struct(sizeof(npin_t));
00201         
00202         new_pin->name = NULL;
00203         new_pin->type = NO_ID;
00204         new_pin->net = NULL;
00205         new_pin->pin_net_idx = -1;
00206         new_pin->node = NULL;
00207         new_pin->pin_node_idx = -1;
00208         new_pin->mapping = NULL;
00209 
00210         new_pin->sim_state = (sim_state_t *)malloc(sizeof(sim_state_t));
00211         new_pin->sim_state->cycle = -1;
00212         new_pin->sim_state->value = -1;
00213         new_pin->sim_state->prev_value = -1;
00214 
00215         return new_pin;
00216 }

Here is the call graph for this function:

Here is the caller graph for this function:

void clean_signal_list_structure ( signal_list_t list  ) 

Definition at line 677 of file netlist_utils.c.

00678 {
00679         if (list == NULL)
00680                 return;
00681         if (list->signal_list != NULL)
00682                 free(list->signal_list);
00683         list->signal_list_size = 0;
00684 
00685         free(list);
00686 }

Here is the caller graph for this function:

signal_list_t* combine_lists ( signal_list_t **  signal_lists,
int  num_signal_lists 
)

Definition at line 580 of file netlist_utils.c.

00581 {
00582         int i, j;
00583         
00584         for (i = 1; i < num_signal_lists; i++)
00585         {
00586                 for (j = 0; j < signal_lists[i]->signal_list_size; j++)
00587                 {
00588                         add_pin_to_signal_list(signal_lists[0], signal_lists[i]->signal_list[j]);
00589                 }
00590                 clean_signal_list_structure(signal_lists[i]);
00591         }
00592 
00593         return signal_lists[0];
00594 }

Here is the call graph for this function:

Here is the caller graph for this function:

signal_list_t* combine_lists_without_freeing_originals ( signal_list_t **  signal_lists,
int  num_signal_lists 
)

Definition at line 599 of file netlist_utils.c.

00600 {
00601         int i, j;
00602         signal_list_t *return_list = init_signal_list_structure();
00603         
00604         for (i = 0; i < num_signal_lists; i++)
00605         {
00606                 for (j = 0; j < signal_lists[i]->signal_list_size; j++)
00607                 {
00608                         add_pin_to_signal_list(return_list, signal_lists[i]->signal_list[j]);
00609                 }
00610         }
00611 
00612         return return_list;
00613 }

Here is the call graph for this function:

Here is the caller graph for this function:

void combine_nets ( nnet_t output_net,
nnet_t input_net,
netlist_t netlist 
)

Definition at line 411 of file netlist_utils.c.

00412 {
00413         /* copy the driver over to the new_net */       
00414         if (output_net->driver_pin != NULL)
00415         {
00416                 /* IF - there is a pin assigned to this net, then copy it */
00417                 add_a_driver_pin_to_net(input_net, output_net->driver_pin);
00418         }
00419         /* in case there are any fanouts in output net (should only be zero and one nodes */
00420         join_nets(input_net, output_net);
00421         /* mark that this is combined */
00422         input_net->combined = TRUE;
00423         
00424         /* special cases for global nets */
00425         if (output_net == netlist->zero_net) 
00426         {
00427                 netlist->zero_net = input_net;
00428         }
00429         else if (output_net == netlist->one_net)
00430         {
00431                 netlist->one_net = input_net;
00432         }
00433 
00434         /* free the driver net */       
00435         free_nnet(output_net);
00436 }

Here is the call graph for this function:

Here is the caller graph for this function:

void connect_nodes ( nnode_t out_node,
int  out_idx,
nnode_t in_node,
int  in_idx 
)

Definition at line 514 of file netlist_utils.c.

00515 {
00516         npin_t *new_in_pin;
00517 
00518         oassert(out_node->num_output_pins > out_idx);
00519         oassert(in_node->num_input_pins > in_idx);
00520 
00521         new_in_pin = allocate_npin();
00522         
00523         /* create the pin that hooks up to the input */
00524         add_a_input_pin_to_node_spot_idx(in_node, new_in_pin, in_idx);
00525         
00526         if (out_node->output_pins[out_idx] == NULL)
00527         {
00528                 /* IF - this node has no output net or pin */
00529                 npin_t *new_out_pin;
00530                 nnet_t *new_net;
00531                 new_net = allocate_nnet();
00532                 new_out_pin = allocate_npin();
00533         
00534                 /* create the pin that hooks up to the input */
00535                 add_a_output_pin_to_node_spot_idx(out_node, new_out_pin, out_idx);
00536                 /* hook up in pin out of the new net */
00537                 add_a_fanout_pin_to_net(new_net, new_in_pin);
00538                 /* hook up the new pin 2 to this new net */
00539                 add_a_driver_pin_to_net(new_net, new_out_pin);
00540         }
00541         else
00542         {
00543                 /* ELSE - there is a net so we just add a fanout */
00544                 /* hook up in pin out of the new net */
00545                 add_a_fanout_pin_to_net(out_node->output_pins[out_idx]->net, new_in_pin);
00546         }
00547 }

Here is the call graph for this function:

Here is the caller graph for this function:

npin_t* copy_input_npin ( npin_t copy_pin  ) 

Definition at line 238 of file netlist_utils.c.

00239 {
00240         npin_t *new_pin = allocate_npin();
00241         oassert(copy_pin->type == INPUT);
00242 
00243         new_pin->name = copy_pin->name;
00244         new_pin->type = copy_pin->type;
00245         new_pin->mapping = copy_pin->mapping;
00246         if (copy_pin->net != NULL)
00247         {
00248                 add_a_fanout_pin_to_net(copy_pin->net, new_pin);
00249         }
00250 
00251         return new_pin;
00252 }

Here is the call graph for this function:

Here is the caller graph for this function:

npin_t* copy_output_npin ( npin_t copy_pin  ) 

Definition at line 222 of file netlist_utils.c.

00223 {
00224         npin_t *new_pin = allocate_npin();
00225         oassert(copy_pin->type == OUTPUT);
00226 
00227         new_pin->name = copy_pin->name;
00228         new_pin->type = copy_pin->type;
00229         new_pin->net = copy_pin->net;
00230         new_pin->mapping = copy_pin->mapping;
00231         return new_pin;
00232 }

Here is the call graph for this function:

Here is the caller graph for this function:

int count_nodes_in_netlist ( netlist_t netlist  ) 

Definition at line 768 of file netlist_utils.c.

00769 {
00770         int i;
00771         int count = 0;
00772 
00773         /* now traverse the ground and vcc pins */
00774         depth_traverse_count(netlist->gnd_node, &count,  COUNT_NODES);
00775         depth_traverse_count(netlist->vcc_node, &count, COUNT_NODES);
00776         depth_traverse_count(netlist->pad_node, &count, COUNT_NODES);
00777 
00778         /* start with the primary input list */
00779         for (i = 0; i < netlist->num_top_input_nodes; i++)
00780         {
00781                 if (netlist->top_input_nodes[i] != NULL)
00782                 {
00783                         depth_traverse_count(netlist->top_input_nodes[i], &count,  COUNT_NODES);
00784                 }
00785         }
00786 
00787         return count;
00788 }

Here is the call graph for this function:

void free_netlist ( netlist_t to_free  ) 

Definition at line 884 of file netlist_utils.c.

00885 {
00886         sc_free_string_cache(to_free->nets_sc);
00887         sc_free_string_cache(to_free->out_pins_sc);
00888         sc_free_string_cache(to_free->nodes_sc);
00889 }

Here is the call graph for this function:

void free_nnet ( nnet_t to_free  ) 

Definition at line 292 of file netlist_utils.c.

00293 {
00294         if (to_free != NULL)
00295         {
00296                 free(to_free);
00297         }
00298 }

Here is the caller graph for this function:

void free_nnode ( nnode_t to_free  ) 

Definition at line 83 of file netlist_utils.c.

00084 {
00085         int i;
00086 
00087         if (to_free != NULL)
00088         {
00089                 /* need to free node_data */
00090                 
00091                 for (i = 0; i < to_free->num_input_pins; i++)
00092                 {
00093                         if (to_free->input_pins[i] != NULL)
00094                         {
00095                                 free_npin(to_free->input_pins[i]);
00096                                 to_free->input_pins[i] = NULL;
00097                         }
00098                 }       
00099                 if (to_free->input_pins != NULL)
00100                 {
00101                         free(to_free->input_pins);
00102                         to_free->input_pins = NULL;
00103                 }
00104         
00105                 for (i = 0; i < to_free->num_output_pins; i++)
00106                 {
00107                         if (to_free->output_pins[i] != NULL)
00108                         {
00109                                 free_npin(to_free->output_pins[i]);
00110                                 to_free->output_pins[i] = NULL;
00111                         }
00112                 }
00113                 if (to_free->output_pins != NULL)
00114                 {
00115                         free(to_free->output_pins);
00116                         to_free->output_pins = NULL;
00117                 }
00118 
00119                 if (to_free->input_port_sizes != NULL)
00120                         free(to_free->input_port_sizes);
00121                 if (to_free->output_port_sizes != NULL)
00122                         free(to_free->output_port_sizes);
00123         
00124                 /* now free the node */
00125                 free(to_free);
00126         }       
00127 }

Here is the call graph for this function:

void free_npin ( npin_t to_free  ) 

Definition at line 258 of file netlist_utils.c.

00259 {
00260         if (to_free != NULL)
00261         {
00262                 free(to_free->sim_state);
00263                 free(to_free);
00264         }
00265 }

Here is the caller graph for this function:

npin_t* get_a_one_pin ( netlist_t netlist  ) 

Definition at line 64 of file node_creation_library.c.

00065 {
00066         npin_t *one_fanout_pin = allocate_npin();       
00067         one_fanout_pin->name = one_string;
00068         add_a_fanout_pin_to_net(netlist->one_net, one_fanout_pin);
00069         return one_fanout_pin;
00070 }

Here is the call graph for this function:

Here is the caller graph for this function:

npin_t* get_a_pad_pin ( netlist_t netlist  ) 

Definition at line 40 of file node_creation_library.c.

00041 {
00042         npin_t *pad_fanout_pin = allocate_npin();       
00043         pad_fanout_pin->name = pad_string;
00044         add_a_fanout_pin_to_net(netlist->pad_net, pad_fanout_pin);
00045         return pad_fanout_pin;
00046 }

Here is the call graph for this function:

Here is the caller graph for this function:

npin_t* get_a_zero_pin ( netlist_t netlist  ) 

Definition at line 52 of file node_creation_library.c.

00053 {
00054         npin_t *zero_fanout_pin = allocate_npin();      
00055         zero_fanout_pin->name = zero_string;
00056         add_a_fanout_pin_to_net(netlist->zero_net, zero_fanout_pin);
00057         return zero_fanout_pin;
00058 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hookup_hb_input_pins_from_signal_list ( nnode_t node,
int  n_start_idx,
signal_list_t input_list,
int  il_start_idx,
int  width,
netlist_t netlist 
)

Definition at line 717 of file netlist_utils.c.

00718 {
00719         int i;
00720 
00721         for (i = 0; i < width; i++)
00722         {
00723                 if (il_start_idx+i < input_list->signal_list_size)
00724                 {
00725                         oassert(input_list->signal_list_size > (il_start_idx+i));
00726                         add_a_input_pin_to_node_spot_idx(node, input_list->signal_list[il_start_idx+i], n_start_idx+i);
00727                 }
00728                 else
00729                 {
00730                         /* connect with "pad" signal for later resolution */
00731                         add_a_input_pin_to_node_spot_idx(node, get_a_pad_pin(netlist), n_start_idx+i);
00732                         warning_message(NETLIST_ERROR, -1, -1, "padding an input port with HB_PAD for node %s\n", node->name);
00733                 }
00734         }       
00735 }

Here is the call graph for this function:

void hookup_input_pins_from_signal_list ( nnode_t node,
int  n_start_idx,
signal_list_t input_list,
int  il_start_idx,
int  width,
netlist_t netlist 
)

Definition at line 692 of file netlist_utils.c.

00693 {
00694         int i;
00695 
00696         for (i = 0; i < width; i++)
00697         {
00698                 if (il_start_idx+i < input_list->signal_list_size)
00699                 {
00700                         oassert(input_list->signal_list_size > (il_start_idx+i));
00701                         add_a_input_pin_to_node_spot_idx(node, input_list->signal_list[il_start_idx+i], n_start_idx+i);
00702                 }
00703                 else
00704                 {
00705                         /* pad with 0's */
00706                         add_a_input_pin_to_node_spot_idx(node, get_a_zero_pin(netlist), n_start_idx+i);
00707                         warning_message(NETLIST_ERROR, -1, -1, "padding an input port with 0 for node %s\n", node->name);
00708                 }
00709         }       
00710 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hookup_output_pins_from_signal_list ( nnode_t node,
int  n_start_idx,
signal_list_t output_list,
int  ol_start_idx,
int  width 
)

Definition at line 741 of file netlist_utils.c.

00742 {
00743         int i;
00744         long sc_spot_output;
00745 
00746         for (i = 0; i < width; i++)
00747         {
00748                 oassert(output_list->signal_list_size > (ol_start_idx+i));
00749         
00750                 /* hook outpin to the node */
00751                 add_a_output_pin_to_node_spot_idx(node, output_list->signal_list[ol_start_idx+i], n_start_idx+i);
00752 
00753                 if ((sc_spot_output = sc_lookup_string(output_nets_sc, output_list->signal_list[ol_start_idx+i]->name)) == -1)
00754                 {
00755                         /* this output pin does not have a net OR we couldn't find it */
00756                         error_message(NETLIST_ERROR, -1, -1, "Net for driver (%s) doesn't exist for node %s\n", output_list->signal_list[ol_start_idx+i]->name, node->name);
00757                 }
00758         
00759                 /* hook the outpin into the net */
00760                 add_a_driver_pin_to_net(((nnet_t*)output_nets_sc->data[sc_spot_output]), output_list->signal_list[ol_start_idx+i]);
00761         }       
00762 }

Here is the call graph for this function:

Here is the caller graph for this function:

signal_list_t* init_signal_list_structure (  ) 

Definition at line 554 of file netlist_utils.c.

00555 {
00556         signal_list_t *list;
00557         list = (signal_list_t*)malloc(sizeof(signal_list_t));
00558 
00559         list->signal_list_size = 0;
00560         list->signal_list = NULL;
00561         list->is_memory = FALSE;
00562 
00563         return list;
00564 }

Here is the caller graph for this function:

void join_nets ( nnet_t net,
nnet_t input_net 
)

Definition at line 442 of file netlist_utils.c.

00443 {
00444         int i;
00445 
00446         if (join_to_net == other_net)
00447         {
00448                 if ((join_to_net->driver_pin != NULL ) && (join_to_net->driver_pin->node != NULL) && join_to_net->driver_pin->node->related_ast_node != NULL)
00449                         error_message(NETLIST_ERROR, join_to_net->driver_pin->node->related_ast_node->line_number, join_to_net->driver_pin->node->related_ast_node->file_number, "This is a combinational loop\n");
00450                 else
00451                         error_message(NETLIST_ERROR, -1, -1, "This is a combinational loop\n");
00452                 if ((join_to_net->fanout_pins[0] != NULL ) && (join_to_net->fanout_pins[0]->node != NULL) && join_to_net->fanout_pins[0]->node->related_ast_node != NULL)
00453                         error_message(NETLIST_ERROR, join_to_net->fanout_pins[0]->node->related_ast_node->line_number, join_to_net->fanout_pins[0]->node->related_ast_node->file_number, "This is a combinational loop with more info\n");
00454                 else
00455                         error_message(NETLIST_ERROR, -1, -1, "Same error - This is a combinational loop\n");
00456         }
00457 
00458         /* copy the driver over to the new_net */       
00459         for (i = 0; i < other_net->num_fanout_pins; i++)
00460         {
00461                 if (other_net->fanout_pins[i] != NULL)
00462                 {
00463                         add_a_fanout_pin_to_net(join_to_net, other_net->fanout_pins[i]);
00464                 }
00465         }       
00466 }

Here is the call graph for this function:

Here is the caller graph for this function:

signal_list_t* make_output_pins_for_existing_node ( nnode_t node,
int  width 
)

Definition at line 644 of file netlist_utils.c.

00645 {
00646         signal_list_t *return_list = init_signal_list_structure();
00647         int i; 
00648 
00649         oassert(node->num_output_pins == width);
00650 
00651         for (i = 0; i < width; i++)
00652         {
00653                 npin_t *new_pin1;
00654                 npin_t *new_pin2;
00655                 nnet_t *new_net;
00656                 new_pin1 = allocate_npin();
00657                 new_pin2 = allocate_npin();
00658                 new_net = allocate_nnet();
00659                 new_net->name = node->name;
00660                 /* hook the output pin into the node */
00661                 add_a_output_pin_to_node_spot_idx(node, new_pin1, i);
00662                 /* hook up new pin 1 into the new net */
00663                 add_a_driver_pin_to_net(new_net, new_pin1);
00664                 /* hook up the new pin 2 to this new net */
00665                 add_a_fanout_pin_to_net(new_net, new_pin2);
00666                 
00667                 /* add the new_pin2 to the list of pins */
00668                 add_pin_to_signal_list(return_list, new_pin2);
00669         }
00670 
00671         return return_list;
00672 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mark_clock_node ( netlist_t netlist,
char *  clock_name 
)

Definition at line 948 of file netlist_utils.c.

00952 {
00953         long sc_spot;
00954         nnet_t *clock_net;
00955         nnode_t *clock_node;
00956 
00957         /* lookup the node */
00958         if ((sc_spot = sc_lookup_string(netlist->nets_sc, clock_name)) == -1)
00959         {
00960                 error_message(NETLIST_ERROR, linenum, -1, "clock input does not exist (%s)\n", clock_name);
00961         }
00962         clock_net = (nnet_t*)netlist->nets_sc->data[sc_spot];
00963         clock_node = clock_net->driver_pin->node;
00964 
00965         netlist->clocks = (nnode_t**)realloc(netlist->clocks, sizeof(nnode_t*)*(netlist->num_clocks+1));
00966         netlist->clocks[netlist->num_clocks] = clock_node;
00967         netlist->num_clocks++;
00968 
00969         /* Mark it as a special set of inputs */
00970         clock_node->type = CLOCK_NODE;
00971 }

Here is the call graph for this function:

void move_a_input_pin ( nnode_t node,
int  old_idx,
int  new_idx 
)

Definition at line 323 of file netlist_utils.c.

00324 {
00325         npin_t *pin;
00326 
00327         oassert(node != NULL);
00328         oassert(((old_idx >= 0) && (old_idx < node->num_input_pins)));
00329         oassert(((new_idx >= 0) && (new_idx < node->num_input_pins)));
00330         /* assumes the pin spots have been allocated and the pin */
00331         node->input_pins[new_idx] = node->input_pins[old_idx];
00332         pin = node->input_pins[old_idx];
00333         node->input_pins[old_idx] = NULL;
00334         /* record the node and pin spot in the pin */
00335         pin->type = INPUT;
00336         pin->node = node;
00337         pin->pin_node_idx = new_idx;
00338 }

void move_a_output_pin ( nnode_t node,
int  old_idx,
int  new_idx 
)

Definition at line 303 of file netlist_utils.c.

00304 {
00305         npin_t *pin;
00306 
00307         oassert(node != NULL);
00308         oassert(((old_idx >= 0) && (old_idx < node->num_output_pins)));
00309         oassert(((new_idx >= 0) && (new_idx < node->num_output_pins)));
00310         /* assumes the pin spots have been allocated and the pin */
00311         pin = node->output_pins[old_idx];
00312         node->output_pins[new_idx] = node->output_pins[old_idx];
00313         node->output_pins[old_idx] = NULL;
00314         /* record the node and pin spot in the pin */
00315         pin->type = OUTPUT;
00316         pin->node = node;
00317         pin->pin_node_idx = new_idx;
00318 }

void remap_pin_to_new_net ( npin_t pin,
nnet_t new_net 
)

Definition at line 471 of file netlist_utils.c.

00472 {
00473         if (pin->type == INPUT)
00474         {
00475                 /* clean out the entry in the old net */
00476                 pin->net->fanout_pins[pin->pin_net_idx] = NULL;
00477                 /* do the new addition */
00478                 add_a_fanout_pin_to_net(new_net, pin);
00479         }
00480         else if (pin->type == OUTPUT)
00481         {
00482                 /* clean out the entry in the old net */
00483                 pin->net->driver_pin = NULL;    
00484                 /* do the new addition */
00485                 add_a_driver_pin_to_net(new_net, pin);
00486         }
00487 }

Here is the call graph for this function:

void remap_pin_to_new_node ( npin_t pin,
nnode_t new_node,
int  pin_idx 
)

Definition at line 492 of file netlist_utils.c.

00493 {
00494         if (pin->type == INPUT)
00495         {
00496                 /* clean out the entry in the old net */
00497                 pin->node->input_pins[pin->pin_node_idx] = NULL;
00498                 /* do the new addition */
00499                 add_a_input_pin_to_node_spot_idx(new_node, pin, pin_idx);
00500         }
00501         else if (pin->type == OUTPUT)
00502         {
00503                 /* clean out the entry in the old net */
00504                 pin->node->output_pins[pin->pin_node_idx] = NULL;       
00505                 /* do the new addition */
00506                 add_a_output_pin_to_node_spot_idx(new_node, pin, pin_idx);
00507         }
00508 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sort_signal_list_alphabetically ( signal_list_t list  ) 

Definition at line 619 of file netlist_utils.c.

00620 {
00621         int i, j;
00622         npin_t *tmp_pin;        
00623 
00624         for (i = 0; i < list->signal_list_size-1; i++)
00625         {
00626                 for (j = 0; j< (list->signal_list_size-1-i); j++) 
00627                 {
00628                         /* compare the neighbours */
00629                         if (strcmp(list->signal_list[j+1]->name, list->signal_list[j]->name) < 0 ) 
00630                         {
00631                                 tmp_pin = list->signal_list[j];
00632                                 list->signal_list[j] = list->signal_list[j+1]; 
00633                                 list->signal_list[j+1] = tmp_pin;
00634                         }
00635                 }
00636         }
00637 }

Here is the caller graph for this function:

Generated on Tue Aug 2 10:43:32 2011 for ODIN_II by  doxygen 1.6.3