2038 if (strcmp(lut_pb_type->name,
"lut") != 0) {
2044 lut_pb_type->num_modes = 2;
2045 lut_pb_type->pb_type_power->leakage_default_mode = 1;
2050 lut_pb_type->modes[0].name =
my_strdup(
"wire");
2051 lut_pb_type->modes[0].parent_pb_type = lut_pb_type;
2052 lut_pb_type->modes[0].index = 0;
2053 lut_pb_type->modes[0].num_pb_type_children = 0;
2059 assert(lut_pb_type->num_ports == 2);
2060 if (strcmp(lut_pb_type->ports[0].port_class,
"lut_in") == 0) {
2061 assert(strcmp(lut_pb_type->ports[1].port_class,
"lut_out") == 0);
2062 in_port = &lut_pb_type->ports[0];
2063 out_port = &lut_pb_type->ports[1];
2065 assert(strcmp(lut_pb_type->ports[0].port_class,
"lut_out") == 0);
2066 assert(strcmp(lut_pb_type->ports[1].port_class,
"lut_in") == 0);
2067 out_port = &lut_pb_type->ports[0];
2068 in_port = &lut_pb_type->ports[1];
2070 lut_pb_type->modes[0].num_interconnect = 1;
2073 lut_pb_type->modes[0].interconnect[0].name = (
char*)
my_calloc(
2074 strlen(lut_pb_type->name) + 10,
sizeof(char));
2075 sprintf(lut_pb_type->modes[0].interconnect[0].name,
"complete:%s",
2078 lut_pb_type->modes[0].interconnect[0].input_string = (
char*)
my_calloc(
2079 strlen(lut_pb_type->name) + strlen(in_port->
name) + 2,
2081 sprintf(lut_pb_type->modes[0].interconnect[0].input_string,
"%s.%s",
2082 lut_pb_type->name, in_port->
name);
2083 lut_pb_type->modes[0].interconnect[0].output_string = (
char*)
my_calloc(
2084 strlen(lut_pb_type->name) + strlen(out_port->
name) + 2,
2086 sprintf(lut_pb_type->modes[0].interconnect[0].output_string,
"%s.%s",
2087 lut_pb_type->name, out_port->
name);
2089 lut_pb_type->modes[0].interconnect[0].parent_mode_index = 0;
2090 lut_pb_type->modes[0].interconnect[0].parent_mode = &lut_pb_type->modes[0];
2091 lut_pb_type->modes[0].interconnect[0].interconnect_power =
2094 lut_pb_type->modes[0].interconnect[0].annotations =
2097 lut_pb_type->modes[0].interconnect[0].num_annotations =
2098 lut_pb_type->num_annotations;
2099 for (i = 0; i < lut_pb_type->modes[0].interconnect[0].num_annotations;
2101 lut_pb_type->modes[0].interconnect[0].annotations[i].clock =
my_strdup(
2102 lut_pb_type->annotations[i].clock);
2103 lut_pb_type->modes[0].interconnect[0].annotations[i].input_pins =
2104 my_strdup(lut_pb_type->annotations[i].input_pins);
2105 lut_pb_type->modes[0].interconnect[0].annotations[i].output_pins =
2106 my_strdup(lut_pb_type->annotations[i].output_pins);
2107 lut_pb_type->modes[0].interconnect[0].annotations[i].line_num =
2108 lut_pb_type->annotations[i].line_num;
2109 lut_pb_type->modes[0].interconnect[0].annotations[i].format =
2110 lut_pb_type->annotations[i].format;
2111 lut_pb_type->modes[0].interconnect[0].annotations[i].type =
2112 lut_pb_type->annotations[i].type;
2113 lut_pb_type->modes[0].interconnect[0].annotations[i].num_value_prop_pairs =
2114 lut_pb_type->annotations[i].num_value_prop_pairs;
2115 lut_pb_type->modes[0].interconnect[0].annotations[i].prop =
2118 * lut_pb_type->annotations[i].num_value_prop_pairs);
2119 lut_pb_type->modes[0].interconnect[0].annotations[i].value =
2122 * lut_pb_type->annotations[i].num_value_prop_pairs);
2123 for (j = 0; j < lut_pb_type->annotations[i].num_value_prop_pairs; j++) {
2124 lut_pb_type->modes[0].interconnect[0].annotations[i].prop[j] =
2125 lut_pb_type->annotations[i].prop[j];
2126 lut_pb_type->modes[0].interconnect[0].annotations[i].value[j] =
2127 my_strdup(lut_pb_type->annotations[i].value[j]);
2133 lut_pb_type->modes[1].name =
my_strdup(lut_pb_type->name);
2134 lut_pb_type->modes[1].parent_pb_type = lut_pb_type;
2135 lut_pb_type->modes[1].index = 1;
2136 lut_pb_type->modes[1].num_pb_type_children = 1;
2142 lut_pb_type->modes[1].pb_type_children);
2144 for (i = 0; i < lut_pb_type->num_annotations; i++) {
2145 for (j = 0; j < lut_pb_type->annotations[i].num_value_prop_pairs; j++) {
2146 free(lut_pb_type->annotations[i].value[j]);
2148 free(lut_pb_type->annotations[i].value);
2149 free(lut_pb_type->annotations[i].prop);
2150 if (lut_pb_type->annotations[i].input_pins) {
2151 free(lut_pb_type->annotations[i].input_pins);
2153 if (lut_pb_type->annotations[i].output_pins) {
2154 free(lut_pb_type->annotations[i].output_pins);
2156 if (lut_pb_type->annotations[i].clock) {
2157 free(lut_pb_type->annotations[i].clock);
2160 lut_pb_type->num_annotations = 0;
2161 free(lut_pb_type->annotations);
2162 lut_pb_type->annotations = NULL;
2163 lut_pb_type->modes[1].pb_type_children[0].depth = lut_pb_type->depth + 1;
2164 lut_pb_type->modes[1].pb_type_children[0].parent_mode =
2165 &lut_pb_type->modes[1];
2168 lut_pb_type->modes[1].num_interconnect = 2;
2171 lut_pb_type->modes[1].interconnect[0].name = (
char*)
my_calloc(
2172 strlen(lut_pb_type->name) + 10,
sizeof(char));
2173 sprintf(lut_pb_type->modes[1].interconnect[0].name,
"direct:%s",
2176 lut_pb_type->modes[1].interconnect[0].input_string = (
char*)
my_calloc(
2177 strlen(lut_pb_type->name) + strlen(in_port->
name) + 2,
2179 sprintf(lut_pb_type->modes[1].interconnect[0].input_string,
"%s.%s",
2180 lut_pb_type->name, in_port->
name);
2181 lut_pb_type->modes[1].interconnect[0].output_string = (
char*)
my_calloc(
2182 strlen(default_name) + strlen(in_port->
name) + 2,
sizeof(char));
2183 sprintf(lut_pb_type->modes[1].interconnect[0].output_string,
"%s.%s",
2184 default_name, in_port->
name);
2185 lut_pb_type->modes[1].interconnect[0].infer_annotations =
TRUE;
2187 lut_pb_type->modes[1].interconnect[0].parent_mode_index = 1;
2188 lut_pb_type->modes[1].interconnect[0].parent_mode = &lut_pb_type->modes[1];
2189 lut_pb_type->modes[1].interconnect[0].interconnect_power =
2192 lut_pb_type->modes[1].interconnect[1].name = (
char*)
my_calloc(
2193 strlen(lut_pb_type->name) + 11,
sizeof(char));
2194 sprintf(lut_pb_type->modes[1].interconnect[1].name,
"direct:%s",
2198 lut_pb_type->modes[1].interconnect[1].input_string = (
char*)
my_calloc(
2199 strlen(default_name) + strlen(out_port->
name) + 4,
sizeof(char));
2200 sprintf(lut_pb_type->modes[1].interconnect[1].input_string,
"%s.%s",
2201 default_name, out_port->
name);
2202 lut_pb_type->modes[1].interconnect[1].output_string = (
char*)
my_calloc(
2203 strlen(lut_pb_type->name) + strlen(out_port->
name)
2204 + strlen(in_port->
name) + 2,
sizeof(char));
2205 sprintf(lut_pb_type->modes[1].interconnect[1].output_string,
"%s.%s",
2206 lut_pb_type->name, out_port->
name);
2207 lut_pb_type->modes[1].interconnect[1].infer_annotations =
TRUE;
2209 lut_pb_type->modes[1].interconnect[1].parent_mode_index = 1;
2210 lut_pb_type->modes[1].interconnect[1].parent_mode = &lut_pb_type->modes[1];
2211 lut_pb_type->modes[1].interconnect[1].interconnect_power =
2216 free(lut_pb_type->blif_model);
2217 lut_pb_type->blif_model = NULL;
2218 lut_pb_type->model = NULL;
void * my_calloc(size_t nelem, size_t size)
static void * my_malloc(int ibytes)
static void alloc_and_load_default_child_for_pb_type(INOUTP t_pb_type *pb_type, char *new_name, t_pb_type *copy)
char * my_strdup(const char *str)