#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "types.h"
#include "globals.h"
#include "netlist_utils.h"
#include "odin_util.h"
#include "node_creation_library.h"
#include "util.h"
Go to the source code of this file.
Functions | |
npin_t * | get_a_pad_pin (netlist_t *netlist) |
npin_t * | get_a_zero_pin (netlist_t *netlist) |
npin_t * | get_a_one_pin (netlist_t *netlist) |
nnode_t * | make_not_gate_with_input (npin_t *input_pin, nnode_t *node, short mark) |
nnode_t * | make_not_gate (nnode_t *node, short mark) |
nnode_t * | make_1port_gate (operation_list type, int width_input, int width_output, nnode_t *node, short mark) |
nnode_t * | make_1port_logic_gate (operation_list type, int width, nnode_t *node, short mark) |
nnode_t * | make_1port_logic_gate_with_inputs (operation_list type, int width, signal_list_t *pin_list, nnode_t *node, short mark) |
nnode_t * | make_3port_gate (operation_list type, int width_port1, int width_port2, int width_port3, int width_output, nnode_t *node, short mark) |
nnode_t * | make_2port_gate (operation_list type, int width_port1, int width_port2, int width_output, nnode_t *node, short mark) |
char * | node_name_based_on_op (nnode_t *node) |
char * | hard_node_name (nnode_t *node, char *instance_name_prefix, char *hb_name, char *hb_inst) |
char * | node_name (nnode_t *node, char *instance_name_prefix) |
nnode_t * | make_mult_block (nnode_t *node, short mark) |
Variables | |
long | unique_node_name_id = 0 |
char * | MULTI_PORT_MUX_string = "MULTI_PORT_MUX" |
char * | FF_NODE_string = "FF_NODE" |
char * | BUF_NODE_string = "BUF_NODE" |
char * | INPUT_NODE_string = "INPUT_NODE" |
char * | CLOCK_NODE_string = "CLOCK_NODE" |
char * | OUTPUT_NODE_string = "OUTPUT_NODE" |
char * | GND_NODE_string = "GND_NODE" |
char * | VCC_NODE_string = "VCC_NODE" |
char * | ADD_string = "ADD" |
char * | MINUS_string = "MINUS" |
char * | BITWISE_NOT_string = "BITWISE_NOT" |
char * | BITWISE_AND_string = "BITWISE_AND" |
char * | BITWISE_OR_string = "BITWISE_OR" |
char * | BITWISE_NAND_string = "BITWISE_NAND" |
char * | BITWISE_NOR_string = "BITWISE_NOR" |
char * | BITWISE_XNOR_string = "BITWISE_XNOR" |
char * | BITWISE_XOR_string = "BITWISE_XOR" |
char * | LOGICAL_NOT_string = "LOGICAL_NOT" |
char * | LOGICAL_OR_string = "LOGICAL_OR" |
char * | LOGICAL_AND_string = "LOGICAL_AND" |
char * | LOGICAL_NAND_string = "LOGICAL_NAND" |
char * | LOGICAL_NOR_string = "LOGICAL_NOR" |
char * | LOGICAL_XOR_string = "LOGICAL_XOR" |
char * | LOGICAL_XNOR_string = "LOGICAL_XNOR" |
char * | MULTIPLY_string = "MULTIPLY" |
char * | DIVIDE_string = "DIVIDE" |
char * | MODULO_string = "MODULO" |
char * | LT_string = "LT" |
char * | GT_string = "GT" |
char * | LOGICAL_EQUAL_string = "LOGICAL_EQUAL" |
char * | NOT_EQUAL_string = "NOT_EQUAL" |
char * | LTE_string = "LTE" |
char * | GTE_string = "GTE" |
char * | SR_string = "SR" |
char * | SL_string = "SL" |
char * | CASE_EQUAL_string = "CASE_EQUAL" |
char * | CASE_NOT_EQUAL_string = "CASE_NOT_EQUAL" |
char * | ADDER_FUNC_string = "ADDER_FUNC" |
char * | CARRY_FUNC_string = "CARRY_FUNC" |
char * | MUX_2_string = "MUX_2" |
char * | HARD_IP_string = "HARD_IP" |
char * | MEMORY_string = "MEMORY" |
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 }
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 }
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 }
char* hard_node_name | ( | nnode_t * | node, | |
char * | instance_name_prefix, | |||
char * | hb_name, | |||
char * | hb_inst | |||
) |
Definition at line 409 of file node_creation_library.c.
00410 { 00411 char *return_node_name; 00412 00413 /* create the unique name for this node */ 00414 return_node_name = make_full_ref_name(instance_name_prefix, hb_name, hb_inst, NULL, -1); 00415 00416 unique_node_name_id ++; 00417 00418 return return_node_name; 00419 }
nnode_t* make_1port_gate | ( | operation_list | type, | |
int | width_input, | |||
int | width_output, | |||
nnode_t * | node, | |||
short | mark | |||
) |
Definition at line 115 of file node_creation_library.c.
00116 { 00117 nnode_t *logic_node; 00118 00119 logic_node = allocate_nnode(); 00120 logic_node->traverse_visited = mark; 00121 logic_node->type = type; 00122 logic_node->name = node_name(logic_node, node->name); 00123 logic_node->related_ast_node = node->related_ast_node; 00124 00125 /* add the input ports as needed */ 00126 allocate_more_node_input_pins(logic_node, width_input); 00127 add_input_port_information(logic_node, width_input); 00128 /* add output */ 00129 allocate_more_node_output_pins(logic_node, width_output); 00130 add_output_port_information(logic_node, width_output); 00131 00132 return logic_node; 00133 }
nnode_t* make_1port_logic_gate | ( | operation_list | type, | |
int | width, | |||
nnode_t * | node, | |||
short | mark | |||
) |
Definition at line 138 of file node_creation_library.c.
00139 { 00140 nnode_t *logic_node; 00141 00142 logic_node = make_1port_gate(type, width, 1, node, mark); 00143 00144 return logic_node; 00145 }
nnode_t* make_1port_logic_gate_with_inputs | ( | operation_list | type, | |
int | width, | |||
signal_list_t * | pin_list, | |||
nnode_t * | node, | |||
short | mark | |||
) |
Definition at line 151 of file node_creation_library.c.
00152 { 00153 nnode_t *logic_node; 00154 int i; 00155 00156 logic_node = make_1port_gate(type, width, 1, node, mark); 00157 00158 /* hookup all the pins */ 00159 for (i = 0; i < width; i++) 00160 { 00161 add_a_input_pin_to_node_spot_idx(logic_node, pin_list->signal_list[i], i); 00162 } 00163 00164 return logic_node; 00165 }
nnode_t* make_2port_gate | ( | operation_list | type, | |
int | width_port1, | |||
int | width_port2, | |||
int | width_output, | |||
nnode_t * | node, | |||
short | mark | |||
) |
Definition at line 198 of file node_creation_library.c.
00199 { 00200 nnode_t *logic_node = allocate_nnode(); 00201 logic_node->traverse_visited = mark; 00202 logic_node->type = type; 00203 logic_node->name = node_name(logic_node, node->name); 00204 logic_node->related_ast_node = node->related_ast_node; 00205 00206 /* add the input ports as needed */ 00207 allocate_more_node_input_pins(logic_node, width_port1); 00208 add_input_port_information(logic_node, width_port1); 00209 allocate_more_node_input_pins(logic_node, width_port2); 00210 add_input_port_information(logic_node, width_port2); 00211 /* add output */ 00212 allocate_more_node_output_pins(logic_node, width_output); 00213 add_output_port_information(logic_node, width_output); 00214 00215 return logic_node; 00216 }
nnode_t* make_3port_gate | ( | operation_list | type, | |
int | width_port1, | |||
int | width_port2, | |||
int | width_port3, | |||
int | width_output, | |||
nnode_t * | node, | |||
short | mark | |||
) |
Definition at line 171 of file node_creation_library.c.
00172 { 00173 nnode_t *logic_node = allocate_nnode(); 00174 logic_node->traverse_visited = mark; 00175 logic_node->type = type; 00176 logic_node->name = node_name(logic_node, node->name); 00177 logic_node->related_ast_node = node->related_ast_node; 00178 00179 /* add the input ports as needed */ 00180 allocate_more_node_input_pins(logic_node, width_port1); 00181 add_input_port_information(logic_node, width_port1); 00182 allocate_more_node_input_pins(logic_node, width_port2); 00183 add_input_port_information(logic_node, width_port2); 00184 allocate_more_node_input_pins(logic_node, width_port3); 00185 add_input_port_information(logic_node, width_port3); 00186 /* add output */ 00187 allocate_more_node_output_pins(logic_node, width_output); 00188 add_output_port_information(logic_node, width_output); 00189 00190 return logic_node; 00191 }
Definition at line 441 of file node_creation_library.c.
00442 { 00443 nnode_t *logic_node; 00444 00445 logic_node = allocate_nnode(); 00446 logic_node->traverse_visited = mark; 00447 logic_node->type = MULTIPLY; 00448 logic_node->name = node_name(logic_node, node->name); 00449 logic_node->related_ast_node = node->related_ast_node; 00450 logic_node->input_port_sizes = node->input_port_sizes; 00451 logic_node->num_input_port_sizes = node->num_input_port_sizes; 00452 logic_node->output_port_sizes = node->output_port_sizes; 00453 logic_node->num_output_port_sizes = node->num_output_port_sizes; 00454 00455 allocate_more_node_input_pins(logic_node, node->num_input_pins); 00456 allocate_more_node_output_pins(logic_node, node->num_output_pins); 00457 00458 return logic_node; 00459 }
Definition at line 94 of file node_creation_library.c.
00095 { 00096 nnode_t *logic_node; 00097 00098 logic_node = allocate_nnode(); 00099 logic_node->traverse_visited = mark; 00100 logic_node->type = LOGICAL_NOT; 00101 logic_node->name = node_name(logic_node, node->name); 00102 logic_node->related_ast_node = node->related_ast_node; 00103 00104 allocate_more_node_input_pins(logic_node, 1); 00105 allocate_more_node_output_pins(logic_node, 1); 00106 00107 return logic_node; 00108 00109 }
Definition at line 77 of file node_creation_library.c.
00078 { 00079 nnode_t *logic_node; 00080 00081 logic_node = make_not_gate(node, mark); 00082 00083 /* add the input ports as needed */ 00084 add_a_input_pin_to_node_spot_idx(logic_node, input_pin, 0); 00085 00086 return logic_node; 00087 00088 }
char* node_name | ( | nnode_t * | node, | |
char * | instance_name_prefix | |||
) |
Definition at line 425 of file node_creation_library.c.
00426 { 00427 char *return_node_name; 00428 00429 /* create the unique name for this node */ 00430 return_node_name = make_full_ref_name(instance_name_prefix, NULL, NULL, node_name_based_on_op(node), unique_node_name_id); 00431 00432 unique_node_name_id ++; 00433 00434 return return_node_name; 00435 }
char* node_name_based_on_op | ( | nnode_t * | node | ) |
Definition at line 266 of file node_creation_library.c.
00267 { 00268 char *return_string; 00269 00270 switch(node->type) 00271 { 00272 case MULTI_PORT_MUX: 00273 return_string = MULTI_PORT_MUX_string; 00274 break; 00275 case FF_NODE: 00276 return_string = FF_NODE_string; 00277 break; 00278 case BUF_NODE: 00279 return_string = BUF_NODE_string; 00280 break; 00281 case CLOCK_NODE: 00282 return_string = CLOCK_NODE_string; 00283 break; 00284 case INPUT_NODE: 00285 return_string = INPUT_NODE_string; 00286 break; 00287 case OUTPUT_NODE: 00288 return_string = OUTPUT_NODE_string; 00289 break; 00290 case GND_NODE: 00291 return_string = GND_NODE_string; 00292 break; 00293 case VCC_NODE: 00294 return_string = VCC_NODE_string; 00295 break; 00296 case ADD: 00297 return_string = ADD_string; 00298 break; 00299 case MINUS: 00300 return_string = MINUS_string; 00301 break; 00302 case BITWISE_NOT: 00303 return_string = BITWISE_NOT_string; 00304 break; 00305 case BITWISE_AND: 00306 return_string = BITWISE_AND_string; 00307 break; 00308 case BITWISE_OR: 00309 return_string = BITWISE_OR_string; 00310 break; 00311 case BITWISE_NAND: 00312 return_string = BITWISE_NAND_string; 00313 break; 00314 case BITWISE_NOR: 00315 return_string = BITWISE_NOR_string; 00316 break; 00317 case BITWISE_XNOR: 00318 return_string = BITWISE_XNOR_string; 00319 break; 00320 case BITWISE_XOR: 00321 return_string = BITWISE_XOR_string; 00322 break; 00323 case LOGICAL_NOT: 00324 return_string = LOGICAL_NOT_string; 00325 break; 00326 case LOGICAL_OR: 00327 return_string = LOGICAL_OR_string; 00328 break; 00329 case LOGICAL_AND: 00330 return_string = LOGICAL_AND_string; 00331 break; 00332 case LOGICAL_NOR: 00333 return_string = LOGICAL_NOR_string; 00334 break; 00335 case LOGICAL_NAND: 00336 return_string = LOGICAL_NAND_string; 00337 break; 00338 case LOGICAL_XOR: 00339 return_string = LOGICAL_XOR_string; 00340 break; 00341 case LOGICAL_XNOR: 00342 return_string = LOGICAL_XNOR_string; 00343 break; 00344 case MULTIPLY: 00345 return_string = MULTIPLY_string; 00346 break; 00347 case DIVIDE: 00348 return_string = DIVIDE_string; 00349 break; 00350 case MODULO: 00351 return_string = MODULO_string; 00352 break; 00353 case LT: 00354 return_string = LT_string; 00355 break; 00356 case GT: 00357 return_string = GT_string; 00358 break; 00359 case LOGICAL_EQUAL: 00360 return_string = LOGICAL_EQUAL_string; 00361 break; 00362 case NOT_EQUAL: 00363 return_string = NOT_EQUAL_string; 00364 break; 00365 case LTE: 00366 return_string = LTE_string; 00367 break; 00368 case GTE: 00369 return_string = GTE_string; 00370 break; 00371 case SR: 00372 return_string = SR_string; 00373 break; 00374 case SL: 00375 return_string = SL_string; 00376 break; 00377 case CASE_EQUAL: 00378 return_string = CASE_EQUAL_string; 00379 break; 00380 case CASE_NOT_EQUAL: 00381 return_string = CASE_NOT_EQUAL_string; 00382 break; 00383 case ADDER_FUNC: 00384 return_string = ADDER_FUNC_string; 00385 break; 00386 case CARRY_FUNC: 00387 return_string = CARRY_FUNC_string; 00388 break; 00389 case MUX_2: 00390 return_string = MUX_2_string; 00391 break; 00392 case MEMORY: 00393 return_string = MEMORY_string; 00394 break; 00395 case HARD_IP: 00396 return_string = HARD_IP_string; 00397 break; 00398 default: 00399 oassert(FALSE); 00400 break; 00401 } 00402 return return_string; 00403 }
char* ADD_string = "ADD" |
Definition at line 227 of file node_creation_library.c.
char* ADDER_FUNC_string = "ADDER_FUNC" |
Definition at line 256 of file node_creation_library.c.
char* BITWISE_AND_string = "BITWISE_AND" |
Definition at line 230 of file node_creation_library.c.
char* BITWISE_NAND_string = "BITWISE_NAND" |
Definition at line 232 of file node_creation_library.c.
char* BITWISE_NOR_string = "BITWISE_NOR" |
Definition at line 233 of file node_creation_library.c.
char* BITWISE_NOT_string = "BITWISE_NOT" |
Definition at line 229 of file node_creation_library.c.
char* BITWISE_OR_string = "BITWISE_OR" |
Definition at line 231 of file node_creation_library.c.
char* BITWISE_XNOR_string = "BITWISE_XNOR" |
Definition at line 234 of file node_creation_library.c.
char* BITWISE_XOR_string = "BITWISE_XOR" |
Definition at line 235 of file node_creation_library.c.
char* BUF_NODE_string = "BUF_NODE" |
Definition at line 221 of file node_creation_library.c.
char* CARRY_FUNC_string = "CARRY_FUNC" |
Definition at line 257 of file node_creation_library.c.
char* CASE_EQUAL_string = "CASE_EQUAL" |
Definition at line 254 of file node_creation_library.c.
char* CASE_NOT_EQUAL_string = "CASE_NOT_EQUAL" |
Definition at line 255 of file node_creation_library.c.
char* CLOCK_NODE_string = "CLOCK_NODE" |
Definition at line 223 of file node_creation_library.c.
char* DIVIDE_string = "DIVIDE" |
Definition at line 244 of file node_creation_library.c.
char* FF_NODE_string = "FF_NODE" |
Definition at line 220 of file node_creation_library.c.
char* GND_NODE_string = "GND_NODE" |
Definition at line 225 of file node_creation_library.c.
char* GT_string = "GT" |
Definition at line 247 of file node_creation_library.c.
char* GTE_string = "GTE" |
Definition at line 251 of file node_creation_library.c.
char* HARD_IP_string = "HARD_IP" |
Definition at line 259 of file node_creation_library.c.
char* INPUT_NODE_string = "INPUT_NODE" |
Definition at line 222 of file node_creation_library.c.
char* LOGICAL_AND_string = "LOGICAL_AND" |
Definition at line 238 of file node_creation_library.c.
char* LOGICAL_EQUAL_string = "LOGICAL_EQUAL" |
Definition at line 248 of file node_creation_library.c.
char* LOGICAL_NAND_string = "LOGICAL_NAND" |
Definition at line 239 of file node_creation_library.c.
char* LOGICAL_NOR_string = "LOGICAL_NOR" |
Definition at line 240 of file node_creation_library.c.
char* LOGICAL_NOT_string = "LOGICAL_NOT" |
Definition at line 236 of file node_creation_library.c.
char* LOGICAL_OR_string = "LOGICAL_OR" |
Definition at line 237 of file node_creation_library.c.
char* LOGICAL_XNOR_string = "LOGICAL_XNOR" |
Definition at line 242 of file node_creation_library.c.
char* LOGICAL_XOR_string = "LOGICAL_XOR" |
Definition at line 241 of file node_creation_library.c.
char* LT_string = "LT" |
Definition at line 246 of file node_creation_library.c.
char* LTE_string = "LTE" |
Definition at line 250 of file node_creation_library.c.
char* MEMORY_string = "MEMORY" |
Definition at line 260 of file node_creation_library.c.
char* MINUS_string = "MINUS" |
Definition at line 228 of file node_creation_library.c.
char* MODULO_string = "MODULO" |
Definition at line 245 of file node_creation_library.c.
char* MULTI_PORT_MUX_string = "MULTI_PORT_MUX" |
Definition at line 219 of file node_creation_library.c.
char* MULTIPLY_string = "MULTIPLY" |
Definition at line 243 of file node_creation_library.c.
char* MUX_2_string = "MUX_2" |
Definition at line 258 of file node_creation_library.c.
char* NOT_EQUAL_string = "NOT_EQUAL" |
Definition at line 249 of file node_creation_library.c.
char* OUTPUT_NODE_string = "OUTPUT_NODE" |
Definition at line 224 of file node_creation_library.c.
char* SL_string = "SL" |
Definition at line 253 of file node_creation_library.c.
char* SR_string = "SR" |
Definition at line 252 of file node_creation_library.c.
long unique_node_name_id = 0 |
Definition at line 34 of file node_creation_library.c.
char* VCC_NODE_string = "VCC_NODE" |
Definition at line 226 of file node_creation_library.c.