VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
read_blif.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void read_and_process_blif (char *blif_file, boolean sweep_hanging_nets_and_inputs, t_model *user_models, t_model *library_models, boolean read_activity_file, char *activity_file)
 
void echo_input (char *blif_file, char *echo_file, t_model *library_models)
 
void dum_parse (char *buf)
 

Function Documentation

void dum_parse ( char *  buf)

Definition at line 358 of file read_blif.c.

358  {
359 
360  /* Continue parsing to the end of this (possibly continued) line. */
361 
362  while (my_strtok(NULL, TOKENS, blif, buf) != NULL )
363  ;
364 }
#define TOKENS
Definition: vpr_types.h:66
static FILE * blif
Definition: read_blif.c:46
char * my_strtok(char *ptr, const char *tokens, FILE *fp, char *buf)
Definition: util.c:472

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void echo_input ( char *  blif_file,
char *  echo_file,
t_model library_models 
)

Definition at line 980 of file read_blif.c.

980  {
981 
982  /* Echo back the netlist data structures to file input.echo to *
983  * allow the user to look at the internal state of the program *
984  * and check the parsing. */
985 
986  int i, j;
987  FILE *fp;
988  t_model_ports *port;
989  t_model *latch_model;
990  t_model *logic_model;
991  t_model *cur;
992  int *lut_distribution;
993  int num_absorbable_latch;
994  int inet;
995 
996  cur = library_models;
997  logic_model = latch_model = NULL;
998  while (cur) {
999  if (strcmp(cur->name, MODEL_LOGIC) == 0) {
1000  logic_model = cur;
1001  assert(logic_model->inputs->next == NULL);
1002  } else if (strcmp(cur->name, MODEL_LATCH) == 0) {
1003  latch_model = cur;
1004  assert(latch_model->inputs->size == 1);
1005  }
1006  cur = cur->next;
1007  }
1008 
1009  lut_distribution = (int*) my_calloc(logic_model->inputs[0].size + 1,
1010  sizeof(int));
1011  num_absorbable_latch = 0;
1012  for (i = 0; i < num_logical_blocks; i++) {
1013  if (logical_block[i].model == logic_model) {
1014  if (logic_model == NULL )
1015  continue;
1016  for (j = 0; j < logic_model->inputs[0].size; j++) {
1017  if (logical_block[i].input_nets[0][j] == OPEN) {
1018  break;
1019  }
1020  }
1021  lut_distribution[j]++;
1022  } else if (logical_block[i].model == latch_model) {
1023  if (latch_model == NULL )
1024  continue;
1025  inet = logical_block[i].input_nets[0][0];
1026  if (vpack_net[inet].num_sinks == 1
1027  && logical_block[vpack_net[inet].node_block[0]].model
1028  == logic_model) {
1029  num_absorbable_latch++;
1030  }
1031  }
1032  }
1033 
1034  vpr_printf(TIO_MESSAGE_INFO, "Input netlist file: '%s', model: %s\n",
1035  blif_file, model);
1036  vpr_printf(TIO_MESSAGE_INFO, "Primary inputs: %d, primary outputs: %d\n",
1038  vpr_printf(TIO_MESSAGE_INFO, "LUTs: %d, latches: %d, subckts: %d\n",
1040  vpr_printf(TIO_MESSAGE_INFO, "# standard absorbable latches: %d\n",
1041  num_absorbable_latch);
1042  vpr_printf(TIO_MESSAGE_INFO, "\t");
1043  for (i = 0; i < logic_model->inputs[0].size + 1; i++) {
1044  if (i > 0)
1045  vpr_printf(TIO_MESSAGE_DIRECT, ", ");
1046  vpr_printf(TIO_MESSAGE_DIRECT, "LUT size %d = %d", i,
1047  lut_distribution[i]);
1048  }
1049  vpr_printf(TIO_MESSAGE_DIRECT, "\n");
1050  vpr_printf(TIO_MESSAGE_INFO, "Total blocks: %d, total nets: %d\n",
1051  num_logical_blocks, num_logical_nets);
1052 
1053  fp = my_fopen(echo_file, "w", 0);
1054 
1055  fprintf(fp, "Input netlist file: '%s', model: %s\n", blif_file, model);
1056  fprintf(fp,
1057  "num_p_inputs: %d, num_p_outputs: %d, num_luts: %d, num_latches: %d\n",
1059  fprintf(fp, "num_logical_blocks: %d, num_logical_nets: %d\n",
1060  num_logical_blocks, num_logical_nets);
1061 
1062  fprintf(fp, "\nNet\tName\t\t#Pins\tDriver\tRecvs.\n");
1063  for (i = 0; i < num_logical_nets; i++) {
1064  fprintf(fp, "\n%d\t%s\t", i, vpack_net[i].name);
1065  if (strlen(vpack_net[i].name) < 8)
1066  fprintf(fp, "\t"); /* Name field is 16 chars wide */
1067  fprintf(fp, "%d", vpack_net[i].num_sinks + 1);
1068  for (j = 0; j <= vpack_net[i].num_sinks; j++)
1069  fprintf(fp, "\t(%d,%d,%d)", vpack_net[i].node_block[j],
1070  vpack_net[i].node_block_port[j],
1071  vpack_net[i].node_block_pin[j]);
1072  }
1073 
1074  fprintf(fp, "\n\nBlocks\t\tBlock type legend:\n");
1075  fprintf(fp, "\t\tINPAD = %d\tOUTPAD = %d\n", VPACK_INPAD, VPACK_OUTPAD);
1076  fprintf(fp, "\t\tCOMB = %d\tLATCH = %d\n", VPACK_COMB, VPACK_LATCH);
1077  fprintf(fp, "\t\tEMPTY = %d\n", VPACK_EMPTY);
1078 
1079  for (i = 0; i < num_logical_blocks; i++) {
1080  fprintf(fp, "\nblock %d %s ", i, logical_block[i].name);
1081  fprintf(fp, "\ttype: %d ", logical_block[i].type);
1082  fprintf(fp, "\tmodel name: %s\n", logical_block[i].model->name);
1083 
1084  port = logical_block[i].model->inputs;
1085 
1086  while (port) {
1087  fprintf(fp, "\tinput port: %s \t", port->name);
1088  for (j = 0; j < port->size; j++) {
1089  if (logical_block[i].input_nets[port->index][j] == OPEN)
1090  fprintf(fp, "OPEN ");
1091  else
1092  fprintf(fp, "%d ",
1093  logical_block[i].input_nets[port->index][j]);
1094  }
1095  fprintf(fp, "\n");
1096  port = port->next;
1097  }
1098 
1099  port = logical_block[i].model->outputs;
1100  while (port) {
1101  fprintf(fp, "\toutput port: %s \t", port->name);
1102  for (j = 0; j < port->size; j++) {
1103  if (logical_block[i].output_nets[port->index][j] == OPEN) {
1104  fprintf(fp, "OPEN ");
1105  } else {
1106  fprintf(fp, "%d ",
1107  logical_block[i].output_nets[port->index][j]);
1108  }
1109  }
1110  fprintf(fp, "\n");
1111  port = port->next;
1112  }
1113 
1114  fprintf(fp, "\tclock net: %d\n", logical_block[i].clock_net);
1115  }
1116  fclose(fp);
1117 }
int num_p_inputs
Definition: globals.c:18
FILE * my_fopen(const char *fname, const char *flag, int prompt)
Definition: util.c:54
int ** input_nets
Definition: vpr_types.h:211
#define MODEL_LOGIC
Definition: vpr_types.h:274
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
struct s_model_ports * next
Definition: logic_types.h:28
int num_logical_nets
Definition: globals.c:17
static int num_luts
Definition: read_blif.c:40
struct s_model * next
Definition: logic_types.h:40
#define MODEL_LATCH
Definition: vpr_types.h:275
int num_p_outputs
Definition: globals.c:18
t_model_ports * inputs
Definition: logic_types.h:35
t_model_ports * outputs
Definition: logic_types.h:36
static char * model
Definition: read_blif.c:45
char * name
Definition: logic_types.h:34
static int num_subckts
Definition: read_blif.c:40
static int num_latches
Definition: read_blif.c:40
int num_logical_blocks
Definition: globals.c:17
Definition: slre.c:50
struct s_net * vpack_net
Definition: globals.c:19
t_model * model
Definition: vpr_types.h:209
messagelogger vpr_printf
Definition: util.c:17
int num_sinks
Definition: vpr_types.h:506
struct s_logical_block * logical_block
Definition: globals.c:20

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void read_and_process_blif ( char *  blif_file,
boolean  sweep_hanging_nets_and_inputs,
t_model user_models,
t_model library_models,
boolean  read_activity_file,
char *  activity_file 
)

Definition at line 1765 of file read_blif.c.

1767  {
1768 
1769  /* begin parsing blif input file */
1770  read_blif(blif_file, sweep_hanging_nets_and_inputs, user_models,
1771  library_models, read_activity_file, activity_file);
1772 
1773  /* TODO: Do check blif here
1774  eg.
1775  for (i = 0; i < num_logical_blocks; i++) {
1776  if (logical_block[i].model->num_inputs > max_subblock_inputs) {
1777  vpr_printf(TIO_MESSAGE_ERROR, "logical_block %s of model %s has %d inputs but architecture only supports subblocks up to %d inputs.\n",
1778  logical_block[i].name, logical_block[i].model->name, logical_block[i].model->num_inputs, max_subblock_inputs);
1779  exit(1);
1780  }
1781  }
1782  */
1783 
1786  library_models);
1787  } else
1788  ;
1789 
1791  compress_netlist(); /* remove unused inputs */
1792 
1793  /* NB: It's important to mark clocks and such *after* compressing the *
1794  * netlist because the vpack_net numbers, etc. may be changed by removing *
1795  * unused inputs . */
1796 
1797  show_blif_stats(user_models, library_models);
1800  free(model);
1803  model = NULL;
1804 }
static int * logical_block_input_count
Definition: read_blif.c:38
static void read_blif(char *blif_file, boolean sweep_hanging_nets_and_inputs, t_model *user_models, t_model *library_models, boolean read_activity_file, char *activity_file)
Definition: read_blif.c:77
static void compress_netlist(void)
Definition: read_blif.c:1587
static void show_blif_stats(t_model *user_models, t_model *library_models)
Definition: read_blif.c:1807
static int * logical_block_output_count
Definition: read_blif.c:38
boolean getEchoEnabled(void)
Definition: ReadOptions.c:67
boolean isEchoFileEnabled(enum e_echo_files echo_option)
Definition: ReadOptions.c:115
void echo_input(char *blif_file, char *echo_file, t_model *library_models)
Definition: read_blif.c:980
static char * model
Definition: read_blif.c:45
char * getEchoFileName(enum e_echo_files echo_option)
Definition: ReadOptions.c:122
static void absorb_buffer_luts(void)
Definition: read_blif.c:1503

+ Here is the call graph for this function:

+ Here is the caller graph for this function: