VPR-6.0

libvpr/include/read_xml_arch_file.h File Reference

#include "util.h"
#include "arch_types.h"
Include dependency graph for read_xml_arch_file.h:

Go to the source code of this file.

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)

Function Documentation

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

Output the data from architecture data so user can verify it was interpretted correctly.

Definition at line 2520 of file read_xml_arch_file.c.

{
    int i, j;
    FILE * Echo;
        t_model * cur_model;
        t_model_ports * model_port;
        struct s_linked_vptr *cur_vptr;


    Echo = my_fopen(EchoFile, "w", 0);
        cur_model = NULL;

        for( j = 0; j < 2; j++ ) {
                if(j == 0) {
                        fprintf(Echo, "Printing user models \n");
                        cur_model = arch->models;
                } else if(j == 1) {
                        fprintf(Echo, "Printing library models \n");
                        cur_model = arch->model_library;
                }
                while(cur_model) {
                        fprintf(Echo, "Model: \"%s\"\n", cur_model->name);
                        model_port = cur_model->inputs;
                        while(model_port) {
                                fprintf(Echo, "\tInput Ports: \"%s\" \"%d\" min_size=\"%d\"\n", model_port->name, model_port->size, model_port->min_size);
                                model_port = model_port->next;
                        }
                        model_port = cur_model->outputs;
                        while(model_port) {
                                fprintf(Echo, "\tOutput Ports: \"%s\" \"%d\" min_size=\"%d\"\n", model_port->name, model_port->size, model_port->min_size);
                                model_port = model_port->next;
                        }
                        cur_vptr = cur_model->pb_types;
                        i = 0;
                        while(cur_vptr != NULL) {
                                fprintf(Echo, "\tpb_type %d: \"%s\"\n", i, ((t_pb_type*)cur_vptr->data_vptr)->name);
                                cur_vptr = cur_vptr->next;
                                i++;
                        }
                        
                        cur_model = cur_model->next;
                }
        }

    for(i = 0; i < NumTypes; ++i)
        {
            fprintf(Echo, "Type: \"%s\"\n", Types[i].name);
            fprintf(Echo, "\tcapacity: %d\n", Types[i].capacity);
            fprintf(Echo, "\theight: %d\n", Types[i].height);
            
            fprintf(Echo, "\tis_Fc_frac: %s\n",
                      (Types[i].is_Fc_frac ? "TRUE" : "FALSE"));
            fprintf(Echo, "\tis_Fc_out_full_flex: %s\n",
                     (Types[i].is_Fc_out_full_flex ? "TRUE" : "FALSE"));
            fprintf(Echo, "\tFc_in: %f\n", Types[i].Fc_in);
            fprintf(Echo, "\tFc_out: %f\n", Types[i].Fc_out);

                
            fprintf(Echo, "\tnum_drivers: %d\n", Types[i].num_drivers);
            fprintf(Echo, "\tnum_receivers: %d\n", Types[i].num_receivers);
                fprintf(Echo, "\tindex: %d\n", Types[i].index);
                if(Types[i].pb_type) {
                        PrintPb_types_rec(Echo, Types[i].pb_type, 2);
                }
            fprintf(Echo, "\n");
        }
    fclose(Echo);
}

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 
)

Loads the given architecture file. Currently only handles type information

Definition at line 1821 of file read_xml_arch_file.c.

{
    ezxml_t Cur, Next;
        const char *Prop;
    
        /* Parse the file */ 
        Cur = ezxml_parse_file(ArchFile);
    if(NULL == Cur)
        {
            printf(ERRTAG "Unable to load architecture file '%s'.\n",
                    ArchFile);
                exit(1);
        }
    
        /* Root node should be architecture */ 
        CheckElement(Cur, "architecture");
        /* TODO: do version processing properly with string delimiting on the . */
        Prop = FindProperty(Cur, "version", FALSE);
    if(Prop != NULL)
        {
                if (atof(Prop) > atof(VPR_VERSION)) {
                        printf(WARNTAG "This architecture version is for VPR %f while your current VPR version is " VPR_VERSION ", compatability issues may arise\n",
                                atof(Prop));
                }
            ezxml_set_attr(Cur, "version", NULL);
        }
    
        /* Process models */ 
        Next = FindElement(Cur, "models", TRUE);
        ProcessModels(Next, arch);
        FreeNode(Next);
        CreateModelLibrary(arch);
    
        /* Process layout */ 
        Next = FindElement(Cur, "layout", TRUE);
    ProcessLayout(Next, arch);
    FreeNode(Next);
    
        /* Process device */ 
        Next = FindElement(Cur, "device", TRUE);
    ProcessDevice(Next, arch, timing_enabled);
    FreeNode(Next);
    
        /* Process types */ 
        Next = FindElement(Cur, "complexblocklist", TRUE);
    ProcessComplexBlocks(Next, Types, NumTypes, timing_enabled);
    FreeNode(Next);
    
        /* Process switches */ 
        Next = FindElement(Cur, "switchlist", TRUE);
    ProcessSwitches(Next, &(arch->Switches), &(arch->num_switches),
                     timing_enabled);
    FreeNode(Next);
    
        /* Process segments. This depends on switches */ 
        Next = FindElement(Cur, "segmentlist", TRUE);
    ProcessSegments(Next, &(arch->Segments), &(arch->num_segments),
                     arch->Switches, arch->num_switches, timing_enabled);
    FreeNode(Next);

        SyncModelsPbTypes(arch, *Types, *NumTypes);
        UpdateAndCheckModels(arch);
    
        /* Release the full XML tree */ 
        FreeNode(Cur);
}

Here is the call graph for this function:

Here is the caller graph for this function: