VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
CheckArch.c
Go to the documentation of this file.
1 #include <assert.h>
2 #include "util.h"
3 #include "vpr_types.h"
4 #include "globals.h"
5 #include "OptionTokens.h"
6 #include "ReadOptions.h"
7 #include "read_xml_arch_file.h"
8 #include "SetupVPR.h"
9 
10 /******** Function Prototypes ********/
11 static void CheckSwitches(INP t_arch Arch, INP boolean TimingEnabled);
12 
13 static void CheckSegments(INP t_arch Arch);
14 
15 /******** Function Implementations ********/
16 
17 void CheckArch(INP t_arch Arch, INP boolean TimingEnabled) {
18  CheckSwitches(Arch, TimingEnabled);
19  CheckSegments(Arch);
20 }
21 
22 static void CheckSwitches(INP t_arch Arch, INP boolean TimingEnabled) {
23  struct s_switch_inf *CurSwitch;
24  int i;
25 
26  /* Check transistors in switches won't be less than minimum size */
27  CurSwitch = Arch.Switches;
28  for (i = 0; i < Arch.num_switches; i++) {
29  /* This assumes all segments have the same directionality */
30  if (CurSwitch->buffered
31  && Arch.Segments[0].directionality == BI_DIRECTIONAL) {
32  /* Largest resistance tri-state buffer would have a minimum
33  * width transistor in the buffer pull-down and a min-width
34  * pass transistoron the output.
35  * Hence largest R = 2 * largest_transistor_R. */
36  if (CurSwitch->R > 2 * Arch.R_minW_nmos) {
37  vpr_printf(TIO_MESSAGE_ERROR, "Switch %s R value (%g) is greater than 2 * R_minW_nmos (%g).\n",
38  CurSwitch->name, CurSwitch->R, (2 * Arch.R_minW_nmos));
39  exit(1);
40  }
41  } else { /* Pass transistor switch */
42  if (CurSwitch->R > Arch.R_minW_nmos) {
43  vpr_printf(TIO_MESSAGE_ERROR, "Switch %s R value (%g) is greater than R_minW_nmos (%g).\n",
44  CurSwitch->name, CurSwitch->R, Arch.R_minW_nmos);
45  exit(1);
46  }
47  }
48  }
49 }
50 
51 static void CheckSegments(INP t_arch Arch) {
52  t_segment_inf *CurSeg;
53  int i;
54 
55  CurSeg = Arch.Segments;
56  for (i = 0; i < Arch.num_segments; i++) {
57  if (CurSeg[i].directionality == UNI_DIRECTIONAL
58  && CurSeg[i].longline == TRUE) {
59  vpr_printf(TIO_MESSAGE_ERROR, "Long lines not supported for unidirectional architectures.\n");
60  exit(1);
61  }
62  }
63 }
static void CheckSegments(INP t_arch Arch)
Definition: CheckArch.c:51
static void CheckSwitches(INP t_arch Arch, INP boolean TimingEnabled)
Definition: CheckArch.c:22
void CheckArch(INP t_arch Arch, INP boolean TimingEnabled)
Definition: CheckArch.c:17
#define INP
Definition: util.h:19
boolean buffered
messagelogger vpr_printf
Definition: util.c:17
Definition: util.h:12