torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XdlParser.cpp
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 2.3. */
2 
3 /* Skeleton implementation for Bison LALR(1) parsers in C++
4 
5  Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2, or (at your option)
10  any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA. */
21 
22 /* As a special exception, you may create a larger work that contains
23  part or all of the Bison parser skeleton and distribute that work
24  under terms of your choice, so long as that work isn't itself a
25  parser generator using the skeleton or a modified version thereof
26  as a parser skeleton. Alternatively, if you modify or redistribute
27  the parser skeleton itself, you may (at your option) remove this
28  special exception, which will cause the skeleton and the resulting
29  Bison output files to be licensed under the GNU General Public
30  License without this special exception.
31 
32  This special exception was added by the Free Software Foundation in
33  version 2.2 of Bison. */
34 
35 // Take the name prefix into account.
36 #define yylex torclex
37 
38 #include "y.tab.h"
39 
40 /* User implementation prologue. */
41 
42 
43 /* Line 317 of lalr1.cc. */
44 #line 45 "XdlParser.cpp"
45 
46 #ifndef YY_
47 # if defined YYENABLE_NLS && YYENABLE_NLS
48 # if ENABLE_NLS
49 # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
50 # define YY_(msgid) dgettext ("bison-runtime", msgid)
51 # endif
52 # endif
53 # ifndef YY_
54 # define YY_(msgid) msgid
55 # endif
56 #endif
57 
58 /* Suppress unused-variable warnings by "using" E. */
59 #define YYUSE(e) ((void) (e))
60 
61 /* A pseudo ostream that takes yydebug_ into account. */
62 # define YYCDEBUG \
63  for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
64  (*yycdebug_)
65 
66 /* Enable debugging if requested. */
67 #if YYDEBUG
68 
69 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
70 do { \
71  if (yydebug_) \
72  { \
73  *yycdebug_ << Title << ' '; \
74  yy_symbol_print_ ((Type), (Value), (Location)); \
75  *yycdebug_ << std::endl; \
76  } \
77 } while (false)
78 
79 # define YY_REDUCE_PRINT(Rule) \
80 do { \
81  if (yydebug_) \
82  yy_reduce_print_ (Rule); \
83 } while (false)
84 
85 # define YY_STACK_PRINT() \
86 do { \
87  if (yydebug_) \
88  yystack_print_ (); \
89 } while (false)
90 
91 #else /* !YYDEBUG */
92 
93 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
94 # define YY_REDUCE_PRINT(Rule)
95 # define YY_STACK_PRINT()
96 
97 #endif /* !YYDEBUG */
98 
99 #define YYACCEPT goto yyacceptlab
100 #define YYABORT goto yyabortlab
101 #define YYERROR goto yyerrorlab
102 
103 namespace torc
104 {
105 #if YYERROR_VERBOSE
106 
107  /* Return YYSTR after stripping away unnecessary quotes and
108  backslashes, so that it's suitable for yyerror. The heuristic is
109  that double-quoting is unnecessary unless the string contains an
110  apostrophe, a comma, or backslash (other than backslash-backslash).
111  YYSTR is taken from yytname. */
113  XdlParser::yytnamerr_ (const char *yystr)
114  {
115  if (*yystr == '"')
116  {
117  std::string yyr = "";
118  char const *yyp = yystr;
119 
120  for (;;)
121  switch (*++yyp)
122  {
123  case '\'':
124  case ',':
125  goto do_not_strip_quotes;
126 
127  case '\\':
128  if (*++yyp != '\\')
129  goto do_not_strip_quotes;
130  /* Fall through. */
131  default:
132  yyr += *yyp;
133  break;
134 
135  case '"':
136  return yyr;
137  }
138  do_not_strip_quotes: ;
139  }
140 
141  return yystr;
142  }
143 
144 #endif
145 
146  /// Build a parser object.
148  : yydebug_ (false),
149  yycdebug_ (&std::cerr),
150  xdl (xdl_yyarg)
151  {
152  }
153 
155  {
156  }
157 
158 #if YYDEBUG
159  /*--------------------------------.
160  | Print this symbol on YYOUTPUT. |
161  `--------------------------------*/
162 
163  inline void
164  XdlParser::yy_symbol_value_print_ (int yytype,
165  const semantic_type* yyvaluep, const location_type* yylocationp)
166  {
167  YYUSE (yylocationp);
168  YYUSE (yyvaluep);
169  switch (yytype)
170  {
171  default:
172  break;
173  }
174  }
175 
176 
177  void
178  XdlParser::yy_symbol_print_ (int yytype,
179  const semantic_type* yyvaluep, const location_type* yylocationp)
180  {
181  *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
182  << ' ' << yytname_[yytype] << " ("
183  << *yylocationp << ": ";
184  yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
185  *yycdebug_ << ')';
186  }
187 #endif /* ! YYDEBUG */
188 
189  void
190  XdlParser::yydestruct_ (const char* yymsg,
191  int yytype, semantic_type* yyvaluep, location_type* yylocationp)
192  {
193  YYUSE (yylocationp);
194  YYUSE (yymsg);
195  YYUSE (yyvaluep);
196 
197  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
198 
199  switch (yytype)
200  {
201 
202  default:
203  break;
204  }
205  }
206 
207  void
208  XdlParser::yypop_ (unsigned int n)
209  {
210  yystate_stack_.pop (n);
213  }
214 
215  std::ostream&
217  {
218  return *yycdebug_;
219  }
220 
221  void
222  XdlParser::set_debug_stream (std::ostream& o)
223  {
224  yycdebug_ = &o;
225  }
226 
227 
230  {
231  return yydebug_;
232  }
233 
234  void
236  {
237  yydebug_ = l;
238  }
239 
240 
241  int
243  {
244  /// Look-ahead and look-ahead in internal form.
245  int yychar = yyempty_;
246  int yytoken = 0;
247 
248  /* State. */
249  int yyn;
250  int yylen = 0;
251  int yystate = 0;
252 
253  /* Error handling. */
254  int yynerrs_ = 0;
255  int yyerrstatus_ = 0;
256 
257  /// Semantic value of the look-ahead.
258  semantic_type yylval;
259  /// Location of the look-ahead.
260  location_type yylloc;
261  /// The locations where the error started and ended.
262  location yyerror_range[2];
263 
264  /// $$.
265  semantic_type yyval;
266  /// @$.
267  location_type yyloc;
268 
269  int yyresult;
270 
271  YYCDEBUG << "Starting parse" << std::endl;
272 
273 
274  /* User initialization code. */
275  #line 93 "/Volumes/project/dev/torc/trunk/src/torc/physical/xdl/parser.yy"
276 {
277  // initialize the initial location object
278  yylloc.begin.filename = yylloc.end.filename = &xdl.mStreamName;
279 }
280  /* Line 555 of yacc.c. */
281 #line 282 "XdlParser.cpp"
282  /* Initialize the stacks. The initial state will be pushed in
283  yynewstate, since the latter expects the semantical and the
284  location values to have been already stored, initialize these
285  stacks with a primary value. */
289  yysemantic_stack_.push (yylval);
290  yylocation_stack_.push (yylloc);
291 
292  /* New state. */
293  yynewstate:
294  yystate_stack_.push (yystate);
295  YYCDEBUG << "Entering state " << yystate << std::endl;
296  goto yybackup;
297 
298  /* Backup. */
299  yybackup:
300 
301  /* Try to take a decision without look-ahead. */
302  yyn = yypact_[yystate];
303  if (yyn == yypact_ninf_)
304  goto yydefault;
305 
306  /* Read a look-ahead token. */
307  if (yychar == yyempty_)
308  {
309  YYCDEBUG << "Reading a token: ";
310  yychar = yylex (&yylval, &yylloc);
311  }
312 
313 
314  /* Convert token to internal form. */
315  if (yychar <= yyeof_)
316  {
317  yychar = yytoken = yyeof_;
318  YYCDEBUG << "Now at end of input." << std::endl;
319  }
320  else
321  {
322  yytoken = yytranslate_ (yychar);
323  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
324  }
325 
326  /* If the proper action on seeing token YYTOKEN is to reduce or to
327  detect an error, take that action. */
328  yyn += yytoken;
329  if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
330  goto yydefault;
331 
332  /* Reduce or error. */
333  yyn = yytable_[yyn];
334  if (yyn <= 0)
335  {
336  if (yyn == 0 || yyn == yytable_ninf_)
337  goto yyerrlab;
338  yyn = -yyn;
339  goto yyreduce;
340  }
341 
342  /* Accept? */
343  if (yyn == yyfinal_)
344  goto yyacceptlab;
345 
346  /* Shift the look-ahead token. */
347  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
348 
349  /* Discard the token being shifted unless it is eof. */
350  if (yychar != yyeof_)
351  yychar = yyempty_;
352 
353  yysemantic_stack_.push (yylval);
354  yylocation_stack_.push (yylloc);
355 
356  /* Count tokens shifted since error; after three, turn off error
357  status. */
358  if (yyerrstatus_)
359  --yyerrstatus_;
360 
361  yystate = yyn;
362  goto yynewstate;
363 
364  /*-----------------------------------------------------------.
365  | yydefault -- do the default action for the current state. |
366  `-----------------------------------------------------------*/
367  yydefault:
368  yyn = yydefact_[yystate];
369  if (yyn == 0)
370  goto yyerrlab;
371  goto yyreduce;
372 
373  /*-----------------------------.
374  | yyreduce -- Do a reduction. |
375  `-----------------------------*/
376  yyreduce:
377  yylen = yyr2_[yyn];
378  /* If YYLEN is nonzero, implement the default value of the action:
379  `$$ = $1'. Otherwise, use the top of the stack.
380 
381  Otherwise, the following line sets YYVAL to garbage.
382  This behavior is undocumented and Bison
383  users should not rely upon it. */
384  if (yylen)
385  yyval = yysemantic_stack_[yylen - 1];
386  else
387  yyval = yysemantic_stack_[0];
388 
389  {
391  YYLLOC_DEFAULT (yyloc, slice, yylen);
392  }
393  YY_REDUCE_PRINT (yyn);
394  switch (yyn)
395  {
396  case 3:
397 #line 177 "parser.yy"
398  {
399  std::clog << "INFO: Parsed " << xdl.mInstanceCount << " instances, "
400  << xdl.mNetCount << " nets, " << xdl.mConfigCount << " settings"
401  << std::endl;
402  }
403  break;
404 
405  case 9:
406 #line 192 "parser.yy"
407  { /*std::clog << "ERROR at " << yylval << std::endl;*/ }
408  break;
409 
410  case 11:
411 #line 201 "parser.yy"
412  { xdl.mConfigMap.clearConfig(); }
413  break;
414 
415  case 12:
416 #line 202 "parser.yy"
417  {
418  if(true) std::clog << "INFO: design \"" << xdl.mDesignName << "\" "
420  << std::endl;
421  // create the design
422  xdl.mDesignPtr = Factory::newDesignPtr(xdl.mDesignName,
425  // add the design configs
426  xdl.mDesignPtr->addConfigs(xdl.mConfigMap);
427  // the design is the de facto circuit for instances and nets encountered
429  // construct and initialize the device database if applicable
431  }
432  break;
433 
434  case 13:
435 #line 220 "parser.yy"
436  {
438  xdl.lexer->last_string.clear();
439  }
440  break;
441 
442  case 16:
443 #line 232 "parser.yy"
444  {
445  torc::common::DeviceDesignator designator((yysemantic_stack_[(2) - (1)]));
446  xdl.mDesignDevice = designator.getDeviceName();
447  xdl.mDesignPackage = designator.getDevicePackage();
448  xdl.mDesignSpeedGrade = (yysemantic_stack_[(2) - (2)]);
449  }
450  break;
451 
452  case 17:
453 #line 240 "parser.yy"
454  { xdl.mDesignDevice = (yysemantic_stack_[(1) - (1)]); }
455  break;
456 
457  case 18:
458 #line 243 "parser.yy"
459  { xdl.mDesignPackage = (yysemantic_stack_[(1) - (1)]); }
460  break;
461 
462  case 19:
463 #line 246 "parser.yy"
464  { xdl.mDesignSpeedGrade = (yysemantic_stack_[(1) - (1)]); }
465  break;
466 
467  case 21:
468 #line 251 "parser.yy"
469  { xdl.mDesignXdlVersion = (yysemantic_stack_[(1) - (1)]); }
470  break;
471 
472  case 28:
473 #line 284 "parser.yy"
475  break;
476 
477  case 29:
478 #line 285 "parser.yy"
480  break;
481 
482  case 30:
483 #line 286 "parser.yy"
485  break;
486 
487  case 31:
488 #line 287 "parser.yy"
489  {
490  xdl.mModuleCount++;
491  if(false) std::clog << "INFO: module \"" << xdl.mModuleName
492  << "\" @ \"" << xdl.mModuleAnchor << std::endl;
493  // create the module
494  xdl.mModulePtr = Factory::newModulePtr(xdl.mModuleName,
496  // add the instance to the design
497  xdl.mDesignPtr->addModule(xdl.mModulePtr);
498  xdl.mModulePtr->setParentWeakPtr(xdl.mDesignPtr);
499  // add the module configs
500  xdl.mModulePtr->addConfigs(xdl.mConfigMap);
501  // set this module as the current circuit
503  }
504  break;
505 
506  case 32:
507 #line 305 "parser.yy"
508  {
509  if(false) std::clog << "INFO: endmodule" << std::endl;
510  // iterate through the ports and instantiate them
511  PortTempVector::const_iterator p = xdl.mPortTempVector.begin();
512  PortTempVector::const_iterator e = xdl.mPortTempVector.end();
513  while(p < e) {
514  // get the port fields
515  const string& name = p->getName();
516  const string& instance = p->getInstance();
517  const string& pin = p->getPin();
518  // try to look up the instance in this module
519  // we should normally be more careful with lock(), but who else is
520  // going to discard our pointer targets if the parser hasn't even
521  // exposed the design to the world yet?
522  Circuit::InstanceSharedPtrIterator instanceIterator
523  = xdl.mCircuitPtr.lock()->findInstance(instance);
525  xdl.mCircuitPtr.lock()->instancesEnd();
526  // catch references to undeclared instances
527  if(instanceIterator == end) {
528  std::stringstream ss;
529  ss << "Error: unknown instance \"" << xdl.mInstanceName
530  << "\" for port \"" << xdl.mPortName << "\" in module \""
531  << xdl.mModuleName << "\".";
532  xdl.error(ss.str()); //YYERROR;
533  xdl.failure();
534  } else {
535  if(false) std::clog << "INFO: port \"" << name << "\" "
536  << instance << "." << pin << std::endl;
537  PortSharedPtr portPtr = Factory::newPortPtr(name,
538  *instanceIterator, pin);
539  xdl.mModulePtr->addPort(portPtr);
540  }
541  // proceed to the next port
542  p++;
543  }
544  // the design is the de facto circuit for instances and nets
545  // encountered outside of this module
547  }
548  break;
549 
550  case 33:
551 #line 351 "parser.yy"
553  break;
554 
555  case 34:
556 #line 352 "parser.yy"
558  break;
559 
560  case 35:
561 #line 353 "parser.yy"
563  break;
564 
565  case 36:
566 #line 353 "parser.yy"
567  {
569  xdl.mPortPin));
570  }
571  break;
572 
573  case 37:
574 #line 367 "parser.yy"
576  break;
577 
578  case 38:
579 #line 368 "parser.yy"
581  break;
582 
583  case 39:
584 #line 369 "parser.yy"
586  break;
587 
588  case 40:
589 #line 372 "parser.yy"
590  {
592  if(false) std::clog << "INFO: inst " << xdl.mInstanceType << " \""
593  << xdl.mInstanceName << "\"" << " @ " << xdl.mInstanceSite << " ("
594  << xdl.mInstanceTile << ")" << std::endl;
595  // create the instance
596  xdl.mInstancePtr = Factory::newInstancePtr(xdl.mInstanceName,
599  // add the instance to the current circuit
600  xdl.mCircuitPtr.lock()->addInstance(xdl.mInstancePtr);
601  xdl.mInstancePtr->setParentWeakPtr(xdl.mCircuitPtr);
602  // add the instance configs
603  xdl.mInstancePtr->addConfigs(xdl.mConfigMap);
604  }
605  break;
606 
607  case 41:
608 #line 390 "parser.yy"
609  {
610  xdl.mInstanceSite.clear(); xdl.mInstanceTile.clear();
612  }
613  break;
614 
615  case 42:
616 #line 394 "parser.yy"
617  {
618  xdl.mInstanceTile = (yysemantic_stack_[(4) - (2)]); xdl.mInstanceSite = (yysemantic_stack_[(4) - (3)]);
619  if(false) std::clog << "INFO: " << xdl.mInstanceTile << " " <<
620  xdl.mInstanceSite << " " << xdl.mInstanceBonding << std::endl;
621  }
622  break;
623 
624  case 43:
625 #line 402 "parser.yy"
627  break;
628 
629  case 44:
630 #line 403 "parser.yy"
632  break;
633 
634  case 45:
635 #line 404 "parser.yy"
637  break;
638 
639  case 50:
640 #line 415 "parser.yy"
641  { xdl.mReferenceModulePtr.reset(); xdl.mReferenceInstancePtr.reset(); }
642  break;
643 
644  case 51:
645 #line 416 "parser.yy"
647  = xdl.lexer->last_string; }
648  break;
649 
650  case 52:
651 #line 418 "parser.yy"
652  {
654  // look up the module
655  Design::ModuleSharedPtrIterator moduleIterator
656  = xdl.mDesignPtr->findModule(xdl.mReferenceModule);
657  Design::ModuleSharedPtrIterator end = xdl.mDesignPtr->modulesEnd();
658  if(moduleIterator == end) {
659  std::stringstream ss;
660  ss << "Error: unknown module \"" << xdl.mReferenceModule
661  << "\" referenced by instance \"" << xdl.mInstanceName << "\".";
662  xdl.error(ss.str()); YYERROR;
663  }
664  xdl.mReferenceModulePtr = *moduleIterator;
665  }
666  break;
667 
668  case 53:
669 #line 432 "parser.yy"
670  {
672  // look up the instance
673  Circuit::InstanceSharedPtrIterator instanceIterator
676  = xdl.mReferenceModulePtr->instancesEnd();
677  if(instanceIterator == end) {
678  std::stringstream ss;
679  ss << "Error: unknown instance \"" << xdl.mReferenceInstance
680  << "\" in module \"" << xdl.mReferenceModule
681  << "\" referenced by instance \"" << xdl.mInstanceName << "\".";
682  xdl.error(ss.str()); YYERROR;
683  }
684  xdl.mReferenceInstancePtr = *instanceIterator;
685  // create an instance reference
686  InstanceReferenceSharedPtr instanceReferencePtr
687  = Factory::newInstanceReferencePtr(xdl.mReferenceInstantiation,
689  xdl.mInstanceReferencePtr = instanceReferencePtr;
690  }
691  break;
692 
693  case 54:
694 #line 470 "parser.yy"
695  { xdl.mConfigMap.clearConfig(); }
696  break;
697 
698  case 55:
699 #line 471 "parser.yy"
701  break;
702 
703  case 56:
704 #line 472 "parser.yy"
705  {
706  xdl.mNetCount++;
707  // create the net
708  xdl.mNetPtr = Factory::newNetPtr(xdl.mNetName, xdl.mNetType);
709  }
710  break;
711 
712  case 57:
713 #line 476 "parser.yy"
714  {
715  // add the net to the current circuit
716  CircuitSharedPtr circuitPtr = xdl.mCircuitPtr.lock();
717  circuitPtr->addNet(xdl.mNetPtr);
718  // add the net configs
719  xdl.mNetPtr->addConfigs(xdl.mConfigMap);
720  if(false) std::clog << "INFO: net " << xdl.mNetName << std::endl;
721  }
722  break;
723 
724  case 58:
725 #line 487 "parser.yy"
727  break;
728 
729  case 59:
730 #line 488 "parser.yy"
731  { xdl.mNetType = eNetTypePower; }
732  break;
733 
734  case 60:
735 #line 489 "parser.yy"
737  break;
738 
739  case 70:
740 #line 513 "parser.yy"
741  {
743  xdl.mPinName = yylval;
744  CircuitSharedPtr circuitPtr = xdl.mCircuitPtr.lock();
745  Circuit::InstanceSharedPtrIterator instanceIterator
746  = circuitPtr->findInstance(xdl.mInstanceName);
747  Circuit::InstanceSharedPtrIterator end = circuitPtr->instancesEnd();
748  // catch references to undeclared instances
749  if(instanceIterator == end) {
750  std::stringstream ss;
751  ss << "Error: unknown instance \"" << xdl.mInstanceName
752  << "\" for pin \"" << xdl.mInstanceName << "."
753  << xdl.mPinName << "\".";
754  xdl.error(ss.str()); YYERROR;
755  }
756  // proceed with the instance pin creation
757  InstanceSharedPtr instancePtr = *instanceIterator;
758  InstancePinSharedPtr instancePinPtr
759  = Factory::newInstancePinPtr(instancePtr, xdl.mPinName);
760  xdl.bind(instancePinPtr);
761  switch(xdl.mPinDirection) {
762  case ePinDirectionInpin:
763  xdl.mNetPtr->addSink(instancePinPtr);
764  break;
765  case ePinDirectionOutpin:
766  xdl.mNetPtr->addSource(instancePinPtr);
767  break;
768  default:
769  break;
770  }
771  }
772  break;
773 
774  case 71:
775 #line 547 "parser.yy"
777  break;
778 
779  case 72:
780 #line 548 "parser.yy"
782  break;
783 
784  case 73:
785 #line 554 "parser.yy"
786  { xdl.mPipTile = yylval; }
787  break;
788 
789  case 74:
790 #line 555 "parser.yy"
791  { xdl.mPipSource = yylval; }
792  break;
793 
794  case 75:
795 #line 557 "parser.yy"
796  { xdl.mPipSink = yylval; }
797  break;
798 
799  case 76:
800 #line 562 "parser.yy"
802  break;
803 
804  case 77:
805 #line 564 "parser.yy"
807  break;
808 
809  case 78:
810 #line 566 "parser.yy"
812  break;
813 
814  case 79:
815 #line 568 "parser.yy"
817  break;
818 
819  case 80:
820 #line 572 "parser.yy"
821  {
822  Pip pip = Factory::newPip(xdl.mPipTile, xdl.mPipSource, xdl.mPipSink,
824  xdl.mNetPtr->addPip(pip);
825  xdl.bind(pip, XdlImporter::ePipTypeRegular);
826  }
827  break;
828 
829  case 81:
830 #line 578 "parser.yy"
831  { xdl.mRoutethroughConfigSetting = yylval; }
832  break;
833 
834  case 82:
835 #line 579 "parser.yy"
836  { xdl.mRoutethroughConfigName = yylval; }
837  break;
838 
839  case 83:
840 #line 580 "parser.yy"
841  { xdl.mRoutethroughConfigValue = yylval; }
842  break;
843 
844  case 84:
845 #line 581 "parser.yy"
847  break;
848 
849  case 85:
850 #line 582 "parser.yy"
851  { xdl.mRoutethroughSource = yylval; }
852  break;
853 
854  case 86:
855 #line 583 "parser.yy"
856  {
857  xdl.mRoutethroughSink = yylval;
858  // look up the routethrough instance
859  CircuitSharedPtr circuitPtr = xdl.mCircuitPtr.lock();
861  = circuitPtr->findInstance(xdl.mRoutethroughInstance);
863  = circuitPtr->instancesEnd();
864  // catch references to undeclared instances
865  if(instanceIterator == end) {
866  PipVector::const_iterator pipIter = --(xdl.mNetPtr->pipsEnd());
867  std::stringstream ss;
868  ss << "Error: unknown routhethrough instance \""
869  << xdl.mRoutethroughInstance << "\" for pip \"" << *pipIter
870  << "\".";
871  xdl.error(ss.str()); YYERROR;
872  }
873  // proceed with the routethrough creation
874  const InstanceWeakPtr instancePtr = *instanceIterator;
875  // create a routethrough
876  RoutethroughSharedPtr routethroughPtr
877  = Factory::newRoutethroughPtr(xdl.mRoutethroughConfigSetting,
880  Pip pip = Factory::newPip(xdl.mPipTile, xdl.mPipSource, xdl.mPipSink,
881  xdl.mPipDirection, routethroughPtr);
882  xdl.mNetPtr->addPip(pip);
883  xdl.bind(pip, XdlImporter::ePipTypeRoutethrough);
884  }
885  break;
886 
887  case 89:
888 #line 622 "parser.yy"
889  { xdl.mConfigMap.clearConfig(); }
890  break;
891 
892  case 93:
893 #line 631 "parser.yy"
894  {
895  if(xdl.mConfigValue.compare("#OFF")) {
897  xdl.mConfigValue);
898  if(false) std::clog << "INFO: " << xdl.mConfigSetting << ":"
899  << xdl.mConfigName << ":" << xdl.mConfigValue << std::endl;
900  xdl.mConfigCount++;
901  }
902  }
903  break;
904 
905  case 94:
906 #line 643 "parser.yy"
907  { xdl.mConfigSetting = (yysemantic_stack_[(1) - (1)]); }
908  break;
909 
910  case 95:
911 #line 647 "parser.yy"
912  { xdl.mConfigName.clear(); }
913  break;
914 
915  case 96:
916 #line 648 "parser.yy"
917  { xdl.mConfigName = (yysemantic_stack_[(1) - (1)]); }
918  break;
919 
920  case 97:
921 #line 652 "parser.yy"
922  { xdl.mConfigValue.clear(); }
923  break;
924 
925  case 98:
926 #line 653 "parser.yy"
927  { xdl.mConfigValue = (yysemantic_stack_[(1) - (1)]); }
928  break;
929 
930  case 99:
931 #line 659 "parser.yy"
932  {
933  if(false) std::clog << "STRING: \"" << xdl.lexer->last_string << "\""
934  << std::endl;
935  }
936  break;
937 
938 
939  /* Line 675 of lalr1.cc. */
940 #line 941 "XdlParser.cpp"
941  default: break;
942  }
943  YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
944 
945  yypop_ (yylen);
946  yylen = 0;
947  YY_STACK_PRINT ();
948 
949  yysemantic_stack_.push (yyval);
950  yylocation_stack_.push (yyloc);
951 
952  /* Shift the result of the reduction. */
953  yyn = yyr1_[yyn];
954  yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
955  if (0 <= yystate && yystate <= yylast_
956  && yycheck_[yystate] == yystate_stack_[0])
957  yystate = yytable_[yystate];
958  else
959  yystate = yydefgoto_[yyn - yyntokens_];
960  goto yynewstate;
961 
962  /*------------------------------------.
963  | yyerrlab -- here on detecting error |
964  `------------------------------------*/
965  yyerrlab:
966  /* If not already recovering from an error, report this error. */
967  if (!yyerrstatus_)
968  {
969  ++yynerrs_;
970  error (yylloc, yysyntax_error_ (yystate, yytoken));
971  }
972 
973  yyerror_range[0] = yylloc;
974  if (yyerrstatus_ == 3)
975  {
976  /* If just tried and failed to reuse look-ahead token after an
977  error, discard it. */
978 
979  if (yychar <= yyeof_)
980  {
981  /* Return failure if at end of input. */
982  if (yychar == yyeof_)
983  YYABORT;
984  }
985  else
986  {
987  yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
988  yychar = yyempty_;
989  }
990  }
991 
992  /* Else will try to reuse look-ahead token after shifting the error
993  token. */
994  goto yyerrlab1;
995 
996 
997  /*---------------------------------------------------.
998  | yyerrorlab -- error raised explicitly by YYERROR. |
999  `---------------------------------------------------*/
1000  yyerrorlab:
1001 
1002  /* Pacify compilers like GCC when the user code never invokes
1003  YYERROR and the label yyerrorlab therefore never appears in user
1004  code. */
1005  if (false)
1006  goto yyerrorlab;
1007 
1008  yyerror_range[0] = yylocation_stack_[yylen - 1];
1009  /* Do not reclaim the symbols of the rule which action triggered
1010  this YYERROR. */
1011  yypop_ (yylen);
1012  yylen = 0;
1013  yystate = yystate_stack_[0];
1014  goto yyerrlab1;
1015 
1016  /*-------------------------------------------------------------.
1017  | yyerrlab1 -- common code for both syntax error and YYERROR. |
1018  `-------------------------------------------------------------*/
1019  yyerrlab1:
1020  yyerrstatus_ = 3; /* Each real token shifted decrements this. */
1021 
1022  for (;;)
1023  {
1024  yyn = yypact_[yystate];
1025  if (yyn != yypact_ninf_)
1026  {
1027  yyn += yyterror_;
1028  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
1029  {
1030  yyn = yytable_[yyn];
1031  if (0 < yyn)
1032  break;
1033  }
1034  }
1035 
1036  /* Pop the current state because it cannot handle the error token. */
1037  if (yystate_stack_.height () == 1)
1038  YYABORT;
1039 
1040  yyerror_range[0] = yylocation_stack_[0];
1041  yydestruct_ ("Error: popping",
1042  yystos_[yystate],
1044  yypop_ ();
1045  yystate = yystate_stack_[0];
1046  YY_STACK_PRINT ();
1047  }
1048 
1049  if (yyn == yyfinal_)
1050  goto yyacceptlab;
1051 
1052  yyerror_range[1] = yylloc;
1053  // Using YYLLOC is tempting, but would change the location of
1054  // the look-ahead. YYLOC is available though.
1055  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
1056  yysemantic_stack_.push (yylval);
1057  yylocation_stack_.push (yyloc);
1058 
1059  /* Shift the error token. */
1060  YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
1062 
1063  yystate = yyn;
1064  goto yynewstate;
1065 
1066  /* Accept. */
1067  yyacceptlab:
1068  yyresult = 0;
1069  goto yyreturn;
1070 
1071  /* Abort. */
1072  yyabortlab:
1073  yyresult = 1;
1074  goto yyreturn;
1075 
1076  yyreturn:
1077  if (yychar != yyeof_ && yychar != yyempty_)
1078  yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
1079 
1080  /* Do not reclaim the symbols of the rule which action triggered
1081  this YYABORT or YYACCEPT. */
1082  yypop_ (yylen);
1083  while (yystate_stack_.height () != 1)
1084  {
1085  yydestruct_ ("Cleanup: popping",
1086  yystos_[yystate_stack_[0]],
1087  &yysemantic_stack_[0],
1088  &yylocation_stack_[0]);
1089  yypop_ ();
1090  }
1091 
1092  return yyresult;
1093  }
1094 
1095  // Generate an error message.
1096  std::string
1097  XdlParser::yysyntax_error_ (int yystate, int tok)
1098  {
1099  std::string res;
1100  YYUSE (yystate);
1101 #if YYERROR_VERBOSE
1102  int yyn = yypact_[yystate];
1103  if (yypact_ninf_ < yyn && yyn <= yylast_)
1104  {
1105  /* Start YYX at -YYN if negative to avoid negative indexes in
1106  YYCHECK. */
1107  int yyxbegin = yyn < 0 ? -yyn : 0;
1108 
1109  /* Stay within bounds of both yycheck and yytname. */
1110  int yychecklim = yylast_ - yyn + 1;
1111  int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
1112  int count = 0;
1113  for (int x = yyxbegin; x < yyxend; ++x)
1114  if (yycheck_[x + yyn] == x && x != yyterror_)
1115  ++count;
1116 
1117  // FIXME: This method of building the message is not compatible
1118  // with internationalization. It should work like yacc.c does it.
1119  // That is, first build a string that looks like this:
1120  // "syntax error, unexpected %s or %s or %s"
1121  // Then, invoke YY_ on this string.
1122  // Finally, use the string as a format to output
1123  // yytname_[tok], etc.
1124  // Until this gets fixed, this message appears in English only.
1125  res = "syntax error, unexpected ";
1126  res += yytnamerr_ (yytname_[tok]);
1127  if (count < 5)
1128  {
1129  count = 0;
1130  for (int x = yyxbegin; x < yyxend; ++x)
1131  if (yycheck_[x + yyn] == x && x != yyterror_)
1132  {
1133  res += (!count++) ? ", expecting " : " or ";
1134  res += yytnamerr_ (yytname_[x]);
1135  }
1136  }
1137  }
1138  else
1139 #endif
1140  res = YY_("syntax error");
1141  return res;
1142  }
1143 
1144 
1145  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1146  STATE-NUM. */
1147  const signed char XdlParser::yypact_ninf_ = -81;
1148  const signed char
1149  XdlParser::yypact_[] =
1150  {
1151  26, -81, 12, -81, -81, -9, -81, 28, 11, 9,
1152  -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
1153  -81, -17, 13, 14, -81, 10, 5, -9, -9, -9,
1154  39, -81, -81, -81, -81, -81, 17, -81, 13, -81,
1155  -81, -81, -81, -9, -9, -81, -81, -81, -81, -81,
1156  33, 19, -81, -9, -9, -7, 20, -81, -81, -81,
1157  -81, -81, -81, -81, -81, 21, -81, -9, 18, 17,
1158  22, -81, -81, -81, 24, 3, -81, -9, -16, -81,
1159  37, 8, 25, 1, -81, -81, -81, -81, 27, 40,
1160  -81, -81, -81, 0, 30, -81, -81, 43, -81, -81,
1161  31, 32, -9, -13, -81, 34, 41, 8, -81, 35,
1162  -81, -81, -81, -81, -81, 47, -81, 29, -81, -81,
1163  -81, 38, -81, -9, 33, 49, -81, 42, -81, 52,
1164  -81, -81, -81, 53, -81, -81, -9, 23, -81, -81,
1165  -81, -81, -81, -81, 54, 44, -9, -81, 55, -81,
1166  -81, -9, -81, 57, -81, 23, 59, -81
1167  };
1168 
1169  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
1170  doesn't specify something else to do. Zero means the default is an
1171  error. */
1172  const unsigned char
1174  {
1175  0, 11, 0, 2, 4, 0, 1, 0, 0, 0,
1176  13, 9, 28, 37, 54, 5, 6, 23, 7, 8,
1177  100, 0, 17, 20, 14, 0, 0, 0, 0, 0,
1178  0, 101, 99, 19, 16, 21, 87, 18, 0, 10,
1179  29, 38, 55, 0, 0, 24, 22, 25, 26, 27,
1180  0, 0, 15, 0, 0, 58, 0, 33, 89, 88,
1181  12, 30, 39, 59, 60, 0, 32, 0, 0, 87,
1182  0, 56, 34, 91, 0, 0, 61, 0, 0, 31,
1183  0, 43, 46, 0, 35, 94, 90, 92, 0, 0,
1184  44, 45, 41, 0, 0, 71, 72, 0, 57, 62,
1185  68, 64, 0, 80, 69, 0, 95, 43, 50, 48,
1186  47, 40, 73, 67, 63, 0, 81, 80, 66, 36,
1187  96, 0, 42, 0, 0, 0, 70, 0, 65, 97,
1188  51, 49, 74, 0, 98, 93, 0, 0, 82, 52,
1189  76, 77, 78, 79, 0, 0, 0, 75, 0, 53,
1190  83, 0, 84, 0, 85, 0, 0, 86
1191  };
1192 
1193  /* YYPGOTO[NTERM-NUM]. */
1194  const signed char
1196  {
1197  -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
1198  -81, -81, -81, 48, -81, -81, -81, -81, -81, -81,
1199  -81, -81, -81, -81, -81, -81, -81, 58, -81, -81,
1200  -81, -81, -22, -81, -81, -81, -81, -81, 60, -81,
1201  -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
1202  -81, -68, -28, -81, -81, -81, -81, -81, 36, -80,
1203  -81, -81, -81, -81, -81, -81, -27, -81
1204  };
1205 
1206  /* YYDEFGOTO[NTERM-NUM]. */
1207  const short int
1209  {
1210  -1, 2, 3, 7, 15, 26, 4, 5, 9, 23,
1211  24, 25, 38, 34, 36, 16, 30, 45, 17, 27,
1212  53, 69, 46, 47, 67, 77, 105, 18, 28, 54,
1213  70, 82, 92, 94, 109, 123, 136, 146, 19, 29,
1214  55, 76, 65, 83, 99, 100, 101, 102, 103, 125,
1215  137, 144, 118, 127, 145, 151, 153, 155, 51, 59,
1216  68, 78, 87, 88, 121, 135, 10, 21
1217  };
1218 
1219  /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1220  positive, shift that token. If negative, reduce the rule which
1221  number is the opposite. If zero, do what YYDEFACT says. */
1222  const signed char XdlParser::yytable_ninf_ = -4;
1223  const short int
1225  {
1226  40, 41, 42, 104, 31, 108, 85, 116, 63, 64,
1227  58, 58, 6, 110, 80, 81, 56, 57, 95, 96,
1228  97, 90, 91, 32, 86, 117, 61, 62, -3, 11,
1229  1, 8, 20, 12, 22, 37, 13, 14, 98, 33,
1230  72, 35, 39, 58, 131, 43, 44, 13, 14, 116,
1231  84, 140, 141, 142, 143, 50, 60, 66, 73, 71,
1232  75, 79, 89, 93, 120, 107, 106, 111, 112, 113,
1233  114, 119, 126, 124, 132, 115, 134, 129, 138, 147,
1234  150, 133, 154, 148, 157, 122, 52, 156, 48, 128,
1235  49, 0, 0, 0, 0, 0, 130, 0, 0, 0,
1236  0, 0, 0, 0, 0, 74, 0, 0, 0, 139,
1237  0, 0, 0, 0, 0, 0, 0, 0, 0, 149,
1238  0, 0, 0, 0, 152
1239  };
1240 
1241  /* YYCHECK. */
1242  const short int
1244  {
1245  27, 28, 29, 83, 21, 5, 22, 20, 15, 16,
1246  10, 10, 0, 93, 11, 12, 43, 44, 17, 18,
1247  19, 13, 14, 40, 40, 38, 53, 54, 0, 1,
1248  4, 40, 21, 5, 25, 25, 8, 9, 37, 26,
1249  67, 27, 37, 10, 124, 6, 7, 8, 9, 20,
1250  77, 28, 29, 30, 31, 38, 37, 37, 40, 38,
1251  38, 37, 25, 38, 23, 25, 39, 37, 25, 38,
1252  38, 37, 25, 38, 25, 102, 24, 39, 25, 25,
1253  25, 39, 25, 39, 25, 107, 38, 155, 30, 117,
1254  30, -1, -1, -1, -1, -1, 123, -1, -1, -1,
1255  -1, -1, -1, -1, -1, 69, -1, -1, -1, 136,
1256  -1, -1, -1, -1, -1, -1, -1, -1, -1, 146,
1257  -1, -1, -1, -1, 151
1258  };
1259 
1260  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
1261  symbol of state STATE-NUM. */
1262  const unsigned char
1263  XdlParser::yystos_[] =
1264  {
1265  0, 4, 42, 43, 47, 48, 0, 44, 40, 49,
1266  107, 1, 5, 8, 9, 45, 56, 59, 68, 79,
1267  21, 108, 25, 50, 51, 52, 46, 60, 69, 80,
1268  57, 21, 40, 26, 54, 27, 55, 25, 53, 37,
1269  107, 107, 107, 6, 7, 58, 63, 64, 68, 79,
1270  38, 99, 54, 61, 70, 81, 107, 107, 10, 100,
1271  37, 107, 107, 15, 16, 83, 37, 65, 101, 62,
1272  71, 38, 107, 40, 99, 38, 82, 66, 102, 37,
1273  11, 12, 72, 84, 107, 22, 40, 103, 104, 25,
1274  13, 14, 73, 38, 74, 17, 18, 19, 37, 85,
1275  86, 87, 88, 89, 100, 67, 39, 25, 5, 75,
1276  100, 37, 25, 38, 38, 107, 20, 38, 93, 37,
1277  23, 105, 73, 76, 38, 90, 25, 94, 93, 39,
1278  107, 100, 25, 39, 24, 106, 77, 91, 25, 107,
1279  28, 29, 30, 31, 92, 95, 78, 25, 39, 107,
1280  25, 96, 107, 97, 25, 98, 92, 25
1281  };
1282 
1283 #if YYDEBUG
1284  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
1285  to YYLEX-NUM. */
1286  const unsigned short int
1287  XdlParser::yytoken_number_[] =
1288  {
1289  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1290  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1291  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1292  285, 286, 287, 288, 289, 290, 291, 59, 44, 58,
1293  34
1294  };
1295 #endif
1296 
1297  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1298  const unsigned char
1299  XdlParser::yyr1_[] =
1300  {
1301  0, 41, 42, 43, 44, 44, 45, 45, 45, 46,
1302  45, 48, 47, 49, 50, 50, 51, 52, 53, 54,
1303  55, 55, 56, 57, 57, 58, 58, 58, 60, 61,
1304  62, 59, 63, 65, 66, 67, 64, 69, 70, 71,
1305  68, 72, 72, 73, 73, 73, 74, 74, 74, 74,
1306  76, 77, 78, 75, 80, 81, 82, 79, 83, 83,
1307  83, 84, 84, 85, 85, 85, 85, 85, 85, 86,
1308  87, 88, 88, 90, 91, 89, 92, 92, 92, 92,
1309  93, 94, 95, 96, 97, 98, 93, 99, 99, 101,
1310  100, 102, 102, 103, 104, 105, 105, 106, 106, 107,
1311  108, 108
1312  };
1313 
1314  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1315  const unsigned char
1316  XdlParser::yyr2_[] =
1317  {
1318  0, 2, 1, 2, 0, 2, 1, 1, 1, 0,
1319  3, 0, 7, 1, 1, 3, 2, 1, 1, 1,
1320  0, 1, 3, 0, 2, 1, 1, 1, 0, 0,
1321  0, 8, 3, 0, 0, 0, 8, 0, 0, 0,
1322  10, 2, 4, 0, 1, 1, 0, 2, 2, 4,
1323  0, 0, 0, 7, 0, 0, 0, 9, 0, 1,
1324  1, 0, 2, 2, 1, 3, 2, 2, 1, 1,
1325  3, 1, 1, 0, 0, 7, 1, 1, 1, 1,
1326  0, 0, 0, 0, 0, 0, 14, 0, 2, 0,
1327  5, 0, 2, 5, 1, 0, 1, 0, 1, 3,
1328  1, 2
1329  };
1330 
1331 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1332  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1333  First, the terminals, then, starting at \a yyntokens_, nonterminals. */
1334  const char*
1335  const XdlParser::yytname_[] =
1336  {
1337  "\"end of file\"", "error", "$undefined", "\"end of line\"", "DESIGN",
1338  "MODULE", "ENDMODULE", "PORT", "INST", "NET", "CFG", "PLACED",
1339  "UNPLACED", "BONDED", "UNBONDED", "POWER", "GROUND", "INPIN", "OUTPIN",
1340  "PIP", "ROUTETHROUGH", "STRING", "CFGSETTING", "CFGNAME", "CFGVALUE",
1341  "IDENTIFIER", "SPEEDGRADE", "XDLVERSION", "BIDIRUNBUF", "BIDIRUNIBUF",
1342  "BIDIRBIBUF", "UNIDIRBUF", "WORD", "CHAR", "QUOTE", "OBRACE", "EBRACE",
1343  "';'", "','", "':'", "'\"'", "$accept", "start", "design", "statements",
1344  "statement", "@1", "design_statement", "@2", "design_name",
1345  "device_info", "part", "device", "package", "speed", "version",
1346  "module_block", "module_elements", "module_element", "module_statement",
1347  "@3", "@4", "@5", "endmodule_statement", "port_statement", "@6", "@7",
1348  "@8", "instance_statement", "@9", "@10", "@11", "instance_placement",
1349  "instance_bonding", "reference_and_config", "module_reference", "@12",
1350  "@13", "@14", "net_statement", "@15", "@16", "@17", "net_power",
1351  "net_pins_or_pips_or_cfg", "net_pin_or_pip_or_cfg", "net_cfg", "net_pin",
1352  "net_pin_direction", "net_pip", "@18", "@19", "net_pip_direction",
1353  "routethrough", "@20", "@21", "@22", "@23", "@24", "optional_config",
1354  "config", "@25", "config_tuples", "config_tuple", "config_setting",
1355  "config_name", "config_value", "double_quoted_string", "string", 0
1356  };
1357 #endif
1358 
1359 #if YYDEBUG
1360  /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1361  const XdlParser::rhs_number_type
1362  XdlParser::yyrhs_[] =
1363  {
1364  42, 0, -1, 43, -1, 47, 44, -1, -1, 44,
1365  45, -1, 56, -1, 68, -1, 79, -1, -1, 1,
1366  46, 37, -1, -1, 4, 48, 49, 50, 55, 99,
1367  37, -1, 107, -1, 51, -1, 52, 53, 54, -1,
1368  25, 54, -1, 25, -1, 25, -1, 26, -1, -1,
1369  27, -1, 59, 57, 63, -1, -1, 57, 58, -1,
1370  64, -1, 68, -1, 79, -1, -1, -1, -1, 5,
1371  60, 107, 61, 107, 62, 99, 37, -1, 6, 107,
1372  37, -1, -1, -1, -1, 7, 107, 65, 107, 66,
1373  107, 67, 37, -1, -1, -1, -1, 8, 69, 107,
1374  70, 107, 71, 38, 72, 74, 37, -1, 12, 73,
1375  -1, 11, 25, 25, 73, -1, -1, 13, -1, 14,
1376  -1, -1, 38, 100, -1, 38, 75, -1, 38, 75,
1377  38, 100, -1, -1, -1, -1, 5, 76, 107, 77,
1378  107, 78, 107, -1, -1, -1, -1, 9, 80, 107,
1379  81, 83, 38, 82, 84, 37, -1, -1, 15, -1,
1380  16, -1, -1, 84, 85, -1, 87, 38, -1, 87,
1381  -1, 89, 38, 93, -1, 89, 93, -1, 86, 38,
1382  -1, 86, -1, 100, -1, 88, 107, 25, -1, 17,
1383  -1, 18, -1, -1, -1, 19, 25, 90, 25, 91,
1384  92, 25, -1, 28, -1, 29, -1, 30, -1, 31,
1385  -1, -1, -1, -1, -1, -1, -1, 20, 94, 39,
1386  25, 95, 39, 25, 96, 107, 97, 25, 98, 92,
1387  25, -1, -1, 38, 100, -1, -1, 10, 101, 40,
1388  102, 40, -1, -1, 102, 103, -1, 104, 39, 105,
1389  39, 106, -1, 22, -1, -1, 23, -1, -1, 24,
1390  -1, 40, 108, 40, -1, 21, -1, 108, 21, -1
1391  };
1392 
1393  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1394  YYRHS. */
1395  const unsigned short int
1396  XdlParser::yyprhs_[] =
1397  {
1398  0, 0, 3, 5, 8, 9, 12, 14, 16, 18,
1399  19, 23, 24, 32, 34, 36, 40, 43, 45, 47,
1400  49, 50, 52, 56, 57, 60, 62, 64, 66, 67,
1401  68, 69, 78, 82, 83, 84, 85, 94, 95, 96,
1402  97, 108, 111, 116, 117, 119, 121, 122, 125, 128,
1403  133, 134, 135, 136, 144, 145, 146, 147, 157, 158,
1404  160, 162, 163, 166, 169, 171, 175, 178, 181, 183,
1405  185, 189, 191, 193, 194, 195, 203, 205, 207, 209,
1406  211, 212, 213, 214, 215, 216, 217, 232, 233, 236,
1407  237, 243, 244, 247, 253, 255, 256, 258, 259, 261,
1408  265, 267
1409  };
1410 
1411  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1412  const unsigned short int
1413  XdlParser::yyrline_[] =
1414  {
1415  0, 171, 171, 177, 184, 185, 189, 190, 191, 192,
1416  192, 201, 201, 220, 227, 228, 232, 240, 243, 246,
1417  249, 251, 269, 272, 274, 278, 279, 280, 284, 285,
1418  286, 284, 305, 351, 352, 353, 350, 367, 368, 369,
1419  367, 390, 394, 402, 403, 404, 407, 409, 410, 411,
1420  415, 416, 418, 415, 470, 471, 472, 470, 487, 488,
1421  489, 492, 494, 498, 499, 500, 501, 502, 503, 507,
1422  513, 547, 548, 554, 555, 554, 561, 563, 565, 567,
1423  572, 578, 579, 580, 581, 582, 578, 616, 618, 622,
1424  622, 625, 627, 631, 643, 647, 648, 652, 653, 659,
1425  666, 667
1426  };
1427 
1428  // Print the state stack on the debug stream.
1429  void
1430  XdlParser::yystack_print_ ()
1431  {
1432  *yycdebug_ << "Stack now";
1434  i != yystate_stack_.end (); ++i)
1435  *yycdebug_ << ' ' << *i;
1436  *yycdebug_ << std::endl;
1437  }
1438 
1439  // Report on the debug stream that the rule \a yyrule is going to be reduced.
1440  void
1441  XdlParser::yy_reduce_print_ (int yyrule)
1442  {
1443  unsigned int yylno = yyrline_[yyrule];
1444  int yynrhs = yyr2_[yyrule];
1445  /* Print the symbols being reduced, and their result. */
1446  *yycdebug_ << "Reducing stack by rule " << yyrule - 1
1447  << " (line " << yylno << "), ";
1448  /* The symbols being reduced. */
1449  for (int yyi = 0; yyi < yynrhs; yyi++)
1450  YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
1451  yyrhs_[yyprhs_[yyrule] + yyi],
1452  &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
1453  &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
1454  }
1455 #endif // YYDEBUG
1456 
1457  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1460  {
1461  static
1462  const token_number_type
1463  translate_table[] =
1464  {
1465  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1466  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1467  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1468  2, 2, 2, 2, 40, 2, 2, 2, 2, 2,
1469  2, 2, 2, 2, 38, 2, 2, 2, 2, 2,
1470  2, 2, 2, 2, 2, 2, 2, 2, 39, 37,
1471  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1475  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1476  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1477  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1478  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1479  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1480  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1481  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1482  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1483  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1484  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1485  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1487  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1488  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1489  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1490  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1491  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1492  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1493  25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1494  35, 36
1495  };
1496  if ((unsigned int) t <= yyuser_token_number_max_)
1497  return translate_table[t];
1498  else
1499  return yyundef_token_;
1500  }
1501 
1502  const int XdlParser::yyeof_ = 0;
1503  const int XdlParser::yylast_ = 124;
1504  const int XdlParser::yynnts_ = 68;
1505  const int XdlParser::yyempty_ = -2;
1506  const int XdlParser::yyfinal_ = 6;
1507  const int XdlParser::yyterror_ = 1;
1508  const int XdlParser::yyerrcode_ = 256;
1509  const int XdlParser::yyntokens_ = 41;
1510 
1511  const unsigned int XdlParser::yyuser_token_number_max_ = 291;
1513 
1514 } // namespace torc
1515 
1516 #line 676 "parser.yy"
1517 
1518 
1519 
1520 // ------------------------------------------------------------------------------------------------
1521 // ------------------------------------- Additional parser code -----------------------------------
1522 // ------------------------------------------------------------------------------------------------
1523 
1524 
1526  xdl.error(l, m);
1527 }
1528 
1529 //namespace {
1530 // /// \brief Suppress GCC warnings about unused boost global variables.
1531 // void suppress_boost_gcc_warnings(void);
1532 // void suppress_boost_gcc_warnings(void) {
1533 // (void) boost::system::system_category;
1534 // (void) boost::system::generic_category;
1535 // (void) boost::system::posix_category;
1536 // (void) boost::system::errno_ecat;
1537 // (void) boost::system::native_ecat;
1538 // }
1539 //}
1540 
std::string last_string
Last double-quoted string that we saw.
Definition: XdlScanner.hpp:74
torc::physical::ENetType mNetType
Current net type.
void failure(void)
Signals a parsing failure by deasserting the success flag.
static const signed char yypact_ninf_
Definition: XdlParser.hpp:276
string mDesignPackage
Package specified for the design.
static const int yyfinal_
Definition: XdlParser.hpp:353
static const signed char yypact_[]
For a state, the index in yytable_ of its portion.
Definition: XdlParser.hpp:275
int debug_level_type
Type for debugging levels.
Definition: XdlParser.hpp:220
void clearConfig(void)
Clears the configuration map.
Definition: ConfigMap.hpp:67
std::ostream * yycdebug_
Definition: XdlParser.hpp:362
void setConfig(const string &inSetting, const Config &inConfig)
Sets the configuration for the given setting.
Definition: ConfigMap.hpp:119
#define YY_REDUCE_PRINT(Rule)
Definition: XdlParser.cpp:94
SiteName mInstanceSite
Current instance site name.
string mReferenceModule
Name of the referenced module.
#define YYUSE(e)
Definition: XdlParser.cpp:59
InstanceSharedPtr mReferenceInstancePtr
Shared pointer to the referenced instance.
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition: XdlParser.cpp:93
static const unsigned char yystos_[]
For a state, its accessing symbol.
Definition: XdlParser.hpp:297
Encapsulation of a device designator and its constituent elements.
string mDesignXdlVersion
XDL version read in by the design.
boost::uint32_t mInstanceCount
Number of instances read for the design.
ModuleSharedPtr mReferenceModulePtr
Shared pointer to the referenced module.
void yydestruct_(const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
Reclaim the memory associated to a symbol.
Definition: XdlParser.cpp:190
static const int yyterror_
Definition: XdlParser.hpp:354
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: XdlParser.hpp:306
position begin
Beginning of the located region.
#define yylex
Definition: XdlParser.cpp:36
string mDesignDevice
Device specified for the design.
string mPortName
Name of the port.
torc::physical::EInstanceBonding mInstanceBonding
Current instance bonding.
stack< location_type > location_stack_type
location stack type.
Definition: XdlParser.hpp:262
static const short int yycheck_[]
Definition: XdlParser.hpp:294
string mRoutethroughConfigSetting
Current routethrough config setting.
const_iterator end() const
Bison undocumented.
string mDesignSpeedGrade
Speed grade specified for the design.
string mInstanceName
Current instance name.
boost::shared_ptr< Port > PortSharedPtr
Shared pointer encapsulation of a Port.
Present a slice of the top of a stack.
string mPortPin
Current port pin name.
static const int yyntokens_
Definition: XdlParser.hpp:356
static const int yyempty_
Definition: XdlParser.hpp:352
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers.
Definition: Circuit.hpp:72
virtual std::string yysyntax_error_(int yystate, int tok)
Definition: XdlParser.cpp:1097
PinName mPinName
Current pin name.
stack< semantic_type > semantic_stack_type
Semantic value stack type.
Definition: XdlParser.hpp:260
#define YY_STACK_PRINT()
Definition: XdlParser.cpp:95
static const unsigned int yyuser_token_number_max_
Definition: XdlParser.hpp:357
stack< state_type > state_stack_type
State stack type.
Definition: XdlParser.hpp:258
TileName mPipTile
Current pip tile name.
unsigned char token_number_type
Internal symbol numbers.
Definition: XdlParser.hpp:272
ModuleSharedPtr mModulePtr
Shared pointer to the current module.
const_iterator begin() const
Bison undocumented.
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: XdlParser.cpp:208
ConfigMap mConfigMap
Current config map.
TileName mInstanceTile
Current instance tile name.
virtual void error(const location_type &loc, const std::string &msg)
Definition: XdlParser.cpp:1525
WireName mRoutethroughSource
Current routethrough source wire name.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
boost::uint32_t mConfigCount
Number of configurations read for the design.
#define YYABORT
Definition: XdlParser.cpp:100
std::string string
string mReferenceInstance
Name of the referenced instance.
void error(const location &l, const string &m)
Error handling with associated line number.
InstanceReferenceSharedPtr mInstanceReferencePtr
Shared pointer to instance reference.
YYSTYPE semantic_type
Symbol semantic values.
Definition: XdlParser.hpp:156
static const unsigned char yydefact_[]
Definition: XdlParser.hpp:281
class torc::XdlScanner * lexer
Pointer to the current lexer instance.
static const int yyeof_
Definition: XdlParser.hpp:348
#define YYCDEBUG
Definition: XdlParser.cpp:62
string mConfigName
Current config name.
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: LutParser.hpp:126
void push(const T &t)
Bison undocumented.
boost::uint32_t mModuleCount
Number of modules read for the design.
state_stack_type yystate_stack_
The state stack.
Definition: XdlParser.hpp:265
std::string * filename
File name to which this position refers.
CircuitWeakPtr mCircuitPtr
Weak pointer to the circuit.
virtual std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
TileTypeName mInstanceType
Current instance type.
boost::shared_ptr< Circuit > CircuitSharedPtr
Shared pointer encapsulation of a Circuit.
Definition: Circuit.hpp:219
Header forwarding XdlScanner includes to the XdlParser.
string mRoutethroughInstance
Current routethrough Instance name.
string mStreamName
Name of file or input stream for error messages.
static const unsigned char yyr1_[]
For a rule, its LHS.
Definition: XdlParser.hpp:300
static const short int yydefgoto_[]
Definition: XdlParser.hpp:284
DesignSharedPtr mDesignPtr
Shared pointer to the design.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
debug_level_type debug_level() const
The current debugging level.
Definition: XdlParser.cpp:229
virtual void bind(torc::physical::InstancePinSharedPtr &)
Bind the given instance pin to its database Tilewire if applicable.
static const unsigned char yyr2_[]
For a rule, its RHS length.
Definition: XdlParser.hpp:302
virtual int parse()
Definition: XdlParser.cpp:242
PortTempVector mPortTempVector
Vector of ports not yet mapped to instances.
location_stack_type yylocation_stack_
The location stack.
Definition: XdlParser.hpp:269
NetSharedPtr mNetPtr
Shared pointer to the current net.
static const short int yytable_[]
Definition: XdlParser.hpp:291
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: XdlParser.cpp:222
XdlParser(class XdlImporter &xdl_yyarg)
Build a parser object.
Definition: XdlParser.cpp:147
Physical design programmable interconnect point.
Definition: Pip.hpp:34
string mNetName
Current net name.
#define YY_(msgid)
Definition: XdlParser.cpp:54
boost::shared_ptr< Routethrough > RoutethroughSharedPtr
Shared pointer encapsulation of a Routethrough.
position end
End of the located region.
WireName mPipSink
Current pip sink wire name.
std::deque< state_type >::const_reverse_iterator const_iterator
static const token_number_type yyundef_token_
Definition: XdlParser.hpp:358
string mReferenceInstantiation
Name under which the module was instantiated.
const string & getDevicePackage(void) const
Returns the device package.
void pop(unsigned int n=1)
Bison undocumented.
WireName mPipSource
Current pip source wire name.
const string & getDeviceName(void) const
Returns the device name.
virtual void initializeDatabase(void)
Initialize the database if applicable.
token_number_type yytranslate_(int t)
Convert a scanner token number t to a symbol number.
Definition: XdlParser.cpp:1459
Importer from XDL format into a physical design.
boost::uint32_t mNetCount
Number of nets read for the design.
torc::physical::EPipDirection mPipDirection
Current pip directionality.
ModuleSharedPtrVector::iterator ModuleSharedPtrIterator
Non-constant iterator for Module shared pointers.
Temporary module port.
string mModuleAnchor
Module anchor instance name.
virtual ~XdlParser()
Definition: XdlParser.cpp:154
static const int yylast_
Definition: XdlParser.hpp:350
static const signed char yypgoto_[]
Definition: XdlParser.hpp:283
string mModuleName
Name of the module.
class XdlImporter & xdl
Definition: XdlParser.hpp:366
string mDesignName
Name of the design.
static const int yynnts_
Definition: XdlParser.hpp:351
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: XdlParser.cpp:235
boost::weak_ptr< Instance > InstanceWeakPtr
Weak pointer encapsulation of an Instance.
string mRoutethroughConfigName
Current routethrough config name.
string mConfigValue
Current config value.
std::ostream & debug_stream() const
The current debugging stream.
Definition: XdlParser.cpp:216
boost::shared_ptr< InstanceReference > InstanceReferenceSharedPtr
Shared pointer encapsulation of an InstanceReference.
semantic_stack_type yysemantic_stack_
The semantic value stack.
Definition: XdlParser.hpp:267
static const signed char yytable_ninf_
Definition: XdlParser.hpp:292
torc::physical::EPinDirection mPinDirection
Current pin direction.
static const int yyerrcode_
Definition: XdlParser.hpp:355
InstanceSharedPtr mInstancePtr
Shared pointer to the current instance.
string mConfigSetting
Current config setting.
string mRoutethroughConfigValue
Current routethrough config value.
string mPortInstance
Current port instance name.
InstanceSharedPtrVector::iterator InstanceSharedPtrIterator
Non-constant iterator to Instance shared pointers.
Definition: Circuit.hpp:74
#define YYERROR
Definition: XdlParser.cpp:101
WireName mRoutethroughSink
Current routethrough sink wire name.