VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
read_xml_arch_file.h File Reference
#include "util.h"
#include "arch_types.h"
+ Include dependency graph for read_xml_arch_file.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NUM_MODELS_IN_LIBRARY   4
 
#define EMPTY_TYPE_INDEX   0
 
#define IO_TYPE_INDEX   1
 

Functions

void XmlReadArch (INP const char *ArchFile, INP boolean timing_enabled, OUTP struct s_arch *arch, OUTP t_type_descriptor **Types, OUTP int *NumTypes)
 
void EchoArch (INP const char *EchoFile, INP const t_type_descriptor *Types, INP int NumTypes, struct s_arch *arch)
 

Macro Definition Documentation

#define EMPTY_TYPE_INDEX   0

Definition at line 15 of file read_xml_arch_file.h.

#define IO_TYPE_INDEX   1

Definition at line 16 of file read_xml_arch_file.h.

#define NUM_MODELS_IN_LIBRARY   4

Definition at line 14 of file read_xml_arch_file.h.

Function Documentation

void EchoArch ( INP const char *  EchoFile,
INP const t_type_descriptor Types,
INP int  NumTypes,
struct s_arch arch 
)

Definition at line 3294 of file read_xml_arch_file.c.

3295  {
3296  int i, j;
3297  FILE * Echo;
3298  t_model * cur_model;
3299  t_model_ports * model_port;
3300  struct s_linked_vptr *cur_vptr;
3301 
3302  Echo = my_fopen(EchoFile, "w", 0);
3303  cur_model = NULL;
3304 
3305  for (j = 0; j < 2; j++) {
3306  if (j == 0) {
3307  fprintf(Echo, "Printing user models \n");
3308  cur_model = arch->models;
3309  } else if (j == 1) {
3310  fprintf(Echo, "Printing library models \n");
3311  cur_model = arch->model_library;
3312  }
3313  while (cur_model) {
3314  fprintf(Echo, "Model: \"%s\"\n", cur_model->name);
3315  model_port = cur_model->inputs;
3316  while (model_port) {
3317  fprintf(Echo, "\tInput Ports: \"%s\" \"%d\" min_size=\"%d\"\n",
3318  model_port->name, model_port->size,
3319  model_port->min_size);
3320  model_port = model_port->next;
3321  }
3322  model_port = cur_model->outputs;
3323  while (model_port) {
3324  fprintf(Echo, "\tOutput Ports: \"%s\" \"%d\" min_size=\"%d\"\n",
3325  model_port->name, model_port->size,
3326  model_port->min_size);
3327  model_port = model_port->next;
3328  }
3329  cur_vptr = cur_model->pb_types;
3330  i = 0;
3331  while (cur_vptr != NULL) {
3332  fprintf(Echo, "\tpb_type %d: \"%s\"\n", i,
3333  ((t_pb_type*) cur_vptr->data_vptr)->name);
3334  cur_vptr = cur_vptr->next;
3335  i++;
3336  }
3337 
3338  cur_model = cur_model->next;
3339  }
3340  }
3341 
3342  for (i = 0; i < NumTypes; ++i) {
3343  fprintf(Echo, "Type: \"%s\"\n", Types[i].name);
3344  fprintf(Echo, "\tcapacity: %d\n", Types[i].capacity);
3345  fprintf(Echo, "\theight: %d\n", Types[i].height);
3346 
3347  for (j = 0; j < Types[i].num_pins; j++) {
3348  fprintf(Echo, "\tis_Fc_frac: \n");
3349  fprintf(Echo, "\t\tPin number %d: %s\n", j,
3350  (Types[i].is_Fc_frac[j] ? "TRUE" : "FALSE"));
3351  fprintf(Echo, "\tis_Fc_full_flex: \n");
3352  fprintf(Echo, "\t\tPin number %d: %s\n", j,
3353  (Types[i].is_Fc_full_flex[j] ? "TRUE" : "FALSE"));
3354  fprintf(Echo, "\tFc_val: \n");
3355  fprintf(Echo, "\tPin number %d: %f\n", j, Types[i].Fc[j]);
3356  }
3357  fprintf(Echo, "\tnum_drivers: %d\n", Types[i].num_drivers);
3358  fprintf(Echo, "\tnum_receivers: %d\n", Types[i].num_receivers);
3359  fprintf(Echo, "\tindex: %d\n", Types[i].index);
3360  if (Types[i].pb_type) {
3361  PrintPb_types_rec(Echo, Types[i].pb_type, 2);
3362  }
3363  fprintf(Echo, "\n");
3364  }
3365  fclose(Echo);
3366 }
FILE * my_fopen(const char *fname, const char *flag, int prompt)
Definition: util.c:54
t_model * model_library
t_model * models
struct s_model_ports * next
Definition: logic_types.h:28
struct s_model * next
Definition: logic_types.h:40
t_model_ports * inputs
Definition: logic_types.h:35
t_model_ports * outputs
Definition: logic_types.h:36
struct s_linked_vptr * pb_types
Definition: logic_types.h:39
struct s_linked_vptr * next
Definition: util.h:36
void * data_vptr
Definition: util.h:35
char * name
Definition: logic_types.h:34
static void PrintPb_types_rec(INP FILE *Echo, INP const t_pb_type *pb_type, int level)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void XmlReadArch ( INP const char *  ArchFile,
INP boolean  timing_enabled,
OUTP struct s_arch arch,
OUTP t_type_descriptor **  Types,
OUTP int *  NumTypes 
)

Definition at line 2519 of file read_xml_arch_file.c.

2521  {
2522  ezxml_t Cur, Next;
2523  const char *Prop;
2524  boolean power_reqd;
2525 
2526  /* Parse the file */
2527  Cur = ezxml_parse_file(ArchFile);
2528  if (NULL == Cur) {
2529  vpr_printf(TIO_MESSAGE_ERROR,
2530  "Unable to load architecture file '%s'.\n", ArchFile);
2531  exit(1);
2532  }
2533 
2534  /* Root node should be architecture */
2535  CheckElement(Cur, "architecture");
2536  /* TODO: do version processing properly with string delimiting on the . */
2537  Prop = FindProperty(Cur, "version", FALSE);
2538  if (Prop != NULL) {
2539  if (atof(Prop) > atof(VPR_VERSION)) {
2540  vpr_printf(TIO_MESSAGE_WARNING,
2541  "This architecture version is for VPR %f while your current VPR version is " VPR_VERSION ", compatability issues may arise\n",
2542  atof(Prop));
2543  }
2544  ezxml_set_attr(Cur, "version", NULL);
2545  }
2546 
2547  /* Process models */
2548  Next = FindElement(Cur, "models", TRUE);
2549  ProcessModels(Next, arch);
2550  FreeNode(Next);
2551  CreateModelLibrary(arch);
2552 
2553  /* Process layout */
2554  Next = FindElement(Cur, "layout", TRUE);
2555  ProcessLayout(Next, arch);
2556  FreeNode(Next);
2557 
2558  /* Process device */
2559  Next = FindElement(Cur, "device", TRUE);
2560  ProcessDevice(Next, arch, timing_enabled);
2561  FreeNode(Next);
2562 
2563  /* Process types */
2564  Next = FindElement(Cur, "complexblocklist", TRUE);
2565  ProcessComplexBlocks(Next, Types, NumTypes, timing_enabled);
2566  FreeNode(Next);
2567 
2568  /* Process switches */
2569  Next = FindElement(Cur, "switchlist", TRUE);
2570  ProcessSwitches(Next, &(arch->Switches), &(arch->num_switches),
2571  timing_enabled);
2572  FreeNode(Next);
2573 
2574  /* Process segments. This depends on switches */
2575  Next = FindElement(Cur, "segmentlist", TRUE);
2576  ProcessSegments(Next, &(arch->Segments), &(arch->num_segments),
2577  arch->Switches, arch->num_switches, timing_enabled);
2578  FreeNode(Next);
2579 
2580  /* Process directs */
2581  Next = FindElement(Cur, "directlist", FALSE);
2582  if (Next) {
2583  ProcessDirects(Next, &(arch->Directs), &(arch->num_directs),
2584  timing_enabled);
2585  FreeNode(Next);
2586  }
2587 
2588  /* Process architecture power information */
2589 
2590  /* If arch->power has been initialized, meaning the user has requested power estimation,
2591  * then the power architecture information is required.
2592  */
2593  if (arch->power) {
2594  power_reqd = TRUE;
2595  } else {
2596  power_reqd = FALSE;
2597  }
2598 
2599  Next = FindElement(Cur, "power", power_reqd);
2600  if (Next) {
2601  if (arch->power) {
2602  ProcessPower(Next, arch->power, *Types, *NumTypes);
2603  } else {
2604  /* This information still needs to be read, even if it is just
2605  * thrown away.
2606  */
2607  t_power_arch * power_arch_fake = (t_power_arch*) my_calloc(1,
2608  sizeof(t_power_arch));
2609  ProcessPower(Next, power_arch_fake, *Types, *NumTypes);
2610  free(power_arch_fake);
2611  }
2612  FreeNode(Next);
2613  }
2614 
2615 // Process Clocks
2616  Next = FindElement(Cur, "clocks", power_reqd);
2617  if (Next) {
2618  if (arch->clocks) {
2619  ProcessClocks(Next, arch->clocks);
2620  } else {
2621  /* This information still needs to be read, even if it is just
2622  * thrown away.
2623  */
2624  t_clock_arch * clocks_fake = (t_clock_arch*) my_calloc(1,
2625  sizeof(t_clock_arch));
2626  ProcessClocks(Next, clocks_fake);
2627  free(clocks_fake->clock_inf);
2628  free(clocks_fake);
2629  }
2630  FreeNode(Next);
2631  }
2632  SyncModelsPbTypes(arch, *Types, *NumTypes);
2633  UpdateAndCheckModels(arch);
2634 
2635  /* Release the full XML tree */
2636  FreeNode(Cur);
2637 }
static void CreateModelLibrary(OUTP struct s_arch *arch)
t_clock_network * clock_inf
Definition: ezxml.h:44
static void SyncModelsPbTypes(INOUTP struct s_arch *arch, INP t_type_descriptor *Types, INP int NumTypes)
static void ProcessSwitches(INOUTP ezxml_t Node, OUTP struct s_switch_inf **Switches, OUTP int *NumSwitches, INP boolean timing_enabled)
#define VPR_VERSION
Definition: arch_types.h:16
static void ProcessModels(INOUTP ezxml_t Node, OUTP struct s_arch *arch)
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
Definition: util.h:12
static void ProcessDirects(INOUTP ezxml_t Parent, OUTP t_direct_inf **Directs, OUTP int *NumDirects, INP boolean timing_enabled)
ezxml_t ezxml_set_attr(ezxml_t xml, char *name, char *value)
Definition: ezxml.c:1165
static void ProcessClocks(ezxml_t Parent, t_clock_arch *clocks)
ezxml_t FindElement(INP ezxml_t Parent, INP const char *Name, INP boolean Required)
Definition: read_xml_util.c:11
void FreeNode(INOUTP ezxml_t Node)
Definition: read_xml_util.c:73
static void ProcessComplexBlocks(INOUTP ezxml_t Node, OUTP t_type_descriptor **Types, OUTP int *NumTypes, INP boolean timing_enabled)
static void ProcessLayout(INOUTP ezxml_t Node, OUTP struct s_arch *arch)
ezxml_t ezxml_parse_file(const char *file)
Definition: ezxml.c:846
static void ProcessSegments(INOUTP ezxml_t Parent, OUTP struct s_segment_inf **Segs, OUTP int *NumSegs, INP struct s_switch_inf *Switches, INP int NumSwitches, INP boolean timing_enabled)
static void ProcessDevice(INOUTP ezxml_t Node, OUTP struct s_arch *arch, INP boolean timing_enabled)
messagelogger vpr_printf
Definition: util.c:17
void CheckElement(INP ezxml_t Node, INP const char *Name)
Definition: read_xml_util.c:59
static void ProcessPower(INOUTP ezxml_t parent, INOUTP t_power_arch *power_arch, INP t_type_descriptor *Types, INP int NumTypes)
const char * FindProperty(INP ezxml_t Parent, INP const char *Name, INP boolean)
Definition: util.h:12
static void UpdateAndCheckModels(INOUTP struct s_arch *arch)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: