530 int subckt_index_signals = 0;
531 char **subckt_signal_name = NULL;
532 char *port_name, *pin_number;
533 char **circuit_signal_name = NULL;
534 char *subckt_logical_block_name = NULL;
536 int input_net_count, output_net_count, input_port_count, output_port_count;
539 boolean found_subckt_signal;
554 if (ptr == NULL && toggle == 0)
556 else if (ptr == NULL && toggle == 1) {
558 "subckt %s formed incorrectly with signal=signal at %s.\n",
561 }
else if (toggle == 0) {
564 subckt_signal_name = (
char**)
my_realloc(subckt_signal_name,
565 (subckt_index_signals + 1) *
sizeof(
char**));
566 circuit_signal_name = (
char**)
my_realloc(circuit_signal_name,
567 (subckt_index_signals + 1) *
sizeof(
char**));
570 subckt_signal_name[subckt_index_signals] =
my_strdup(ptr);
573 }
else if (toggle == 1) {
575 circuit_signal_name[subckt_index_signals] =
my_strdup(ptr);
583 subckt_index_signals++;
593 output_net_count = 0;
598 cur_model = user_models;
599 while (cur_model != NULL ) {
600 if (strcmp(cur_model->
name, subckt_name) == 0) {
603 cur_model = cur_model->
next;
605 if (cur_model == NULL ) {
607 "Did not find matching model to subckt %s.\n", subckt_name);
619 input_port_count = 0;
628 input_port_count *
sizeof(
int *));
637 assert(port->
size >= 0);
640 for (j = 0; j < port->
size; j++) {
646 assert(port == NULL || (port->
is_clock && port->
next == NULL));
649 output_port_count = 0;
656 output_port_count *
sizeof(
int *));
660 assert(port->
size >= 0);
663 for (j = 0; j < port->
size; j++) {
669 assert(port == NULL);
680 for (i = 0; i < subckt_index_signals; i++) {
681 found_subckt_signal =
FALSE;
683 port_name =
my_strdup(subckt_signal_name[i]);
684 pin_number = strrchr(port_name,
'[');
685 if (pin_number == NULL ) {
691 close_bracket = pin_number;
692 while (*close_bracket !=
'\0' && *close_bracket !=
']') {
695 *close_bracket =
'\0';
700 if (strcmp(port_name, port->
name) == 0) {
701 if (found_subckt_signal) {
703 "Two instances of %s subckt signal found in subckt %s.\n",
704 subckt_signal_name[i], subckt_name);
706 found_subckt_signal =
TRUE;
710 assert(
my_atoi(pin_number) == 0);
729 if (strcmp(port_name, port->
name) == 0) {
730 if (found_subckt_signal) {
732 "Two instances of %s subckt signal found in subckt %s.\n",
733 subckt_signal_name[i], subckt_name);
735 found_subckt_signal =
TRUE;
740 if (subckt_logical_block_name == NULL
741 && circuit_signal_name[i] != NULL ) {
742 subckt_logical_block_name = circuit_signal_name[i];
752 subckt_logical_block_name);
755 if (!found_subckt_signal) {
756 vpr_printf(TIO_MESSAGE_ERROR,
"Unknown subckt port %s.\n",
757 subckt_signal_name[i]);
764 for (i = 0; i < subckt_index_signals; i++) {
765 free(subckt_signal_name[i]);
766 free(circuit_signal_name[i]);
768 free(subckt_signal_name);
769 free(circuit_signal_name);
static int add_vpack_net(char *ptr, int type, int bnum, int bport, int bpin, boolean is_global, int doall)
struct s_model_ports * next
struct s_linked_vptr * truth_table
static void * my_malloc(int ibytes)
char * my_strtok(char *ptr, const char *tokens, FILE *fp, char *buf)
enum logical_block_types type
static void * my_realloc(void *memblk, int ibytes)
int my_atoi(const char *str)
char * my_strdup(const char *str)
struct s_logical_block * logical_block