VPR-6.0

vpr/SRC/base/CheckArch.c

Go to the documentation of this file.
00001 #include <assert.h>
00002 #include "util.h"
00003 #include "vpr_types.h"
00004 #include "globals.h"
00005 #include "OptionTokens.h"
00006 #include "ReadOptions.h"
00007 #include "read_xml_arch_file.h"
00008 #include "SetupVPR.h"
00009 
00010 /******** Function Prototypes ********/
00011 static void CheckSwitches(INP t_arch Arch,
00012                           INP boolean TimingEnabled);
00013 
00014 static void CheckSegments(INP t_arch Arch);
00015 
00016 /******** Function Implementations ********/
00017 
00018 void
00019 CheckArch(INP t_arch Arch,
00020           INP boolean TimingEnabled)
00021 {
00022         CheckSwitches(Arch, TimingEnabled);
00023         CheckSegments(Arch);
00024 }
00025 
00026 static void
00027 CheckSwitches(INP t_arch Arch,
00028               INP boolean TimingEnabled)
00029 {
00030     struct s_switch_inf *CurSwitch;
00031     int i;
00032 
00033     /* Check transistors in switches won't be less than minimum size */
00034     CurSwitch = Arch.Switches;
00035     for(i = 0; i < Arch.num_switches; i++)
00036         {
00037                 /* This assumes all segments have the same directionality */
00038                 if(CurSwitch->buffered && Arch.Segments[0].directionality == BI_DIRECTIONAL)
00039                 {
00040                     /* Largest resistance tri-state buffer would have a minimum 
00041                      * width transistor in the buffer pull-down and a min-width 
00042                      * pass transistoron the output.  
00043                      * Hence largest R = 2 * largest_transistor_R. */
00044                     if(CurSwitch->R > 2 * Arch.R_minW_nmos)
00045                         {
00046                             printf(ERRTAG
00047                                    "Switch %s R value (%g) is greater than "
00048                                    "2 * R_minW_nmos (%g).\n", CurSwitch->name,
00049                                    CurSwitch->R, (2 * Arch.R_minW_nmos));
00050                             exit(1);
00051                         }
00052                 }
00053             else
00054                 {               /* Pass transistor switch */
00055                     if(CurSwitch->R > Arch.R_minW_nmos)
00056                         {
00057                             printf(ERRTAG
00058                                    "Switch %s R value (%g) is greater than "
00059                                    "R_minW_nmos (%g).\n", CurSwitch->name,
00060                                    CurSwitch->R, Arch.R_minW_nmos);
00061                             exit(1);
00062                         }
00063                 }
00064         }
00065 }
00066 
00067 static void CheckSegments(INP t_arch Arch) {
00068         t_segment_inf *CurSeg;
00069     int i;
00070 
00071     CurSeg = Arch.Segments;
00072     for(i = 0; i < Arch.num_segments; i++)
00073         {
00074                 if(CurSeg[i].directionality == UNI_DIRECTIONAL && CurSeg[i].longline == TRUE) {
00075                         printf("Long lines not supported for unidirectional architectures\n");
00076                         exit(1);
00077                 }
00078         }
00079 }