Skip to content
Snippets Groups Projects
Commit d702a5e3 authored by tlai10's avatar tlai10
Browse files

init

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #155374 failed
Showing
with 2557 additions and 0 deletions
File added
Cadence Design Systems
555 River Oaks Pkwy, San Jose, CA 95134
(408) 943-1234
THE ACCOMPANYING SOFTWARE PROGRAM IS PROVIDED UNDER THE TERMS AND
CONDITIONS OF THIS LICENSE AGREEMENT ("AGREEMENT"). PLEASE REVIEW
THIS AGREEMENT CAREFULLY. ANY USE, REPRODUCTION, MODIFICATION OR
DISTRIBUTION OF THE PROGRAM CONSTITUTES ACCEPTANCE OF THIS
AGREEMENT. IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF A
COMPANY, YOU REPRESENT THAT YOU ARE AUTHORIZED TO BIND THE
COMPANY TO THIS AGREEMENT.
Cadence Design Systems, Inc. ("Cadence") is licensing the
software program ("Program") provided hereunder under an open
source arrangement. The licensee hereunder may use, copy and
modify the Program only pursuant to this Agreement. While
Cadence encourages any and all improvements or other
modifications made to the Program to be contributed to the
community source and thereby made available to others under the
same terms and conditions as included in this Agreement, this is
not required. However, any error corrections made to the Program
must be contributed to the community source.
1. DEFINITIONS
1.1 "Contribution" means the submission of the Original
Program by Cadence and the submission of any modifications,
improvements, additions, corrections or other changes to the
Program, including source code, object code, application program
interface definitions and formats, and documentation, made by any
Contributor where such changes and/or additions to the Program
originate from and are distributed by that particular
Contributor. Each Contributor acknowledges and agrees that no
guarantee is provided that a Contribution shall be included
within the Program as distributed by any Recipient. A
Contribution must be made by a Contributor if; (1) such
Contribution is an error correction to the Program, or (2) the
Contributor commercially distributes the Program with such
Contribution, in which case the Contribution must be made within
thirty (30) days of the commercial distribution of the Program.
"Commercially distributes" as used herein shall mean distribution
of the Program by a Contributor in consideration for revenue
received. A Contribution 'originates' from a Contributor if it
was added to the Program by such Contributor itself or anyone
acting on such Contributor's behalf. Contributions do not include
additions to the Program which: (i) are separate modules of
software or data distributed in conjunction with the Program
under their own license agreement, and (ii) are not derivative
works of the Program.
1.2 "Contributor" means Cadence and any other entity that
distributes the Program.
1.3 "Licensed Patents" mean patent claims licensable by any
Contributor which are necessarily infringed by the use or sale of
its Contribution alone or when combined with the Program.
1.4 "Original Program" means the original version of the
software accompanying this Agreement as released by Cadence,
including source code, object code, application program interface
definitions and formats, and documentation, if any.
1.5 "Program" means the Original Program and Contributions.
1.6 "Recipient" means anyone who receives the Program under
this Agreement, including all Contributors.
2. GRANT OF RIGHTS
2.1 Subject to the terms and conditions of this Agreement,
each Contributor hereby grants each Recipient a non-exclusive,
worldwide, royalty-free copyright license to reproduce, prepare
derivative works of, publicly display, publicly perform,
distribute and sublicense the Contribution of such Contributor,
in source code and object code format.
2.2 Subject to the terms and conditions of this Agreement,
each Contributor hereby grants each Recipient a non-exclusive,
worldwide, royalty-free patent license under Licensed Patents to
make, use, sell, offer to sell, import and otherwise transfer the
Contribution of such Contributor, if any, in source code and
object code format along with any documentation. This patent
license shall apply to the combination of the Contribution and
the Program if, at the time the Contribution is added by the
Contributor, such addition of the Contribution causes such
combination to be covered by the Licensed Patents. The patent
license shall not apply to any other combinations which include
the Contribution.
2.3 Subject to the terms and conditions of this Agreement,
Cadence hereby grants each Recipient a non-exclusive, worldwide,
royalty-free trademark license, to use the Cadence trademarks
"LEF", or "DEF", in accordance with Cadence’s marking policies,
in connection with the license grants hereunder.
2.4 Recipient understands that although each Contributor
grants the licenses to its Contributions set forth herein, no
assurances are provided by any Contributor that the Program does
not infringe the patent or other intellectual property rights of
any other entity. Each Contributor disclaims any liability to
Recipient for claims brought by any other entity based on
infringement of intellectual property rights or otherwise. As a
condition to exercising the rights and licenses granted
hereunder, each Recipient hereby assumes sole responsibility to
secure any other intellectual property rights needed, if any. For
example, if a third party patent license is required to allow
Recipient to distribute the Program, it is Recipient's
responsibility to acquire that license before distributing the
Program.
2.5 Each Contributor represents that to its knowledge it has
sufficient copyright rights in its Contribution, if any, to grant
the copyright license set forth in this Agreement. Except as
expressly stated in Sections 2.1, 2.2 and 2.3 above, Recipient
receives no rights or licenses to the intellectual property of
any Contributor under this Agreement, whether expressly, by
implication, estoppel or otherwise. All rights in the Program not
expressly granted under this Agreement are reserved.
3. DISTRIBUTION REQUIREMENTS
3.1 A Contributor may choose to distribute the Program in
object code form under its own license agreement, provided that:
(a) it complies with the terms and conditions of this Agreement;
and (b) the terms and conditions of its license agreement: (i)
effectively disclaims on behalf of all Contributors all
warranties and conditions, express and implied, including
warranties or conditions of title and non-infringement, and
implied warranties or conditions of merchantability and fitness
for a particular purpose;
(ii) effectively excludes on behalf of all Contributors all
liability for damages, including, but not limited to, direct,
indirect, special, incidental and consequential damages;
(iii) states that any provisions which differ from this Agreement
are offered by that Contributor alone and not by any other party;
and
(iv) states that source code for the Program is available from
such Contributor, and informs licensees how to obtain it in a
reasonable manner on or through a medium customarily used for
software exchange.
3.2 When the Program is made available in source code form it
must be made available under the terms and conditions of this
Agreement. A copy of this Agreement must be included with each
copy of such Program. A Contributor may not charge a fee for
the distribution of the source code of the Program.
3.3 Each Contributor must preserve all copyright and other
notices that appear in the Program. In addition, each
Contributor must identify itself as the originator of its
Contribution, if any, in a manner that reasonably allows
subsequent Recipients to identify the originator of the
Contribution.
3.4 While this license is intended to facilitate the
commercial use of the Program, the Contributor who includes the
Program in a commercial product offering should do so in a manner
which does not create potential liability for other Contributors.
Therefore, if a Contributor includes the Program in a commercial
product offering, such Contributor ("Commercial Contributor")
hereby agrees to defend and indemnify every other Contributor
("Indemnified Contributor") against any losses, damages and costs
(collectively "Losses") arising from claims, lawsuits and other
legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the
Program in a commercial product offering. The obligations in this
section do not apply to any claims or Losses relating to any
actual or alleged intellectual property infringement. In order to
qualify, an Indemnified Contributor must: a) promptly notify the
Commercial Contributor in writing of such claim, and b) allow the
Commercial Contributor to control, and cooperate with the
Commercial Contributor in, the defense and any related settlement
negotiations. The Indemnified Contributor may participate in any
such claim at its own expense.
4. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-
INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes
all risks associated with its exercise of rights under this
Agreement, including but not limited to the risks and costs of
program errors, compliance with applicable laws, damage to or
loss of data, programs or equipment, and unavailability or
interruption of operations.
5. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER
RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
6. GENERAL
6.1 If any provision of this Agreement is invalid or
unenforceable under applicable law, it shall not affect the
validity or enforceability of the remainder of the terms of this
Agreement, and without further action by the parties hereto, such
provision shall be reformed to the minimum extent necessary to
make such provision valid and enforceable.
6.2 If Recipient institutes patent litigation against a
Contributor with respect to a patent applicable to software
(including a cross-claim or counterclaim in a lawsuit), then any
patent licenses granted by that Contributor to such Recipient
under this Agreement shall terminate as of the date such
litigation is filed. If Recipient institutes patent litigation
against any entity (including a cross-claim or counterclaim in a
lawsuit) alleging that the Program (excluding combinations of the
Program with other software or hardware) infringes such
Recipient's patent(s), then such Recipient's rights granted under
Section 2.2 shall terminate as of the date such litigation is
filed.
6.3 If a Commercial Contributor distributes any Program,
which includes such Contributors modifications, improvements,
additions, corrections or other changes, and has not made a
Contribution of such Program, any licenses granted to such
Commercial Contributor under this Agreement shall terminate as of
the date of such Program is distributed.
6.4 All Recipient's rights under this Agreement shall
terminate if it fails to comply with any of the material terms or
conditions of this Agreement and does not cure such failure in a
reasonable period of time after becoming aware of such
noncompliance. If all Recipient's rights under this Agreement
terminate, Recipient agrees to cease use and distribution of the
Program as soon as reasonably practicable. However, Recipient's
obligations under this Agreement and any licenses granted by
Recipient relating to the Program shall continue and survive.
6.5 Cadence may publish new versions (including revisions) of
this Agreement from time to time. Each new version of the
Agreement will be given a distinguishing version number. The
Program (including Contributions) may always be distributed
subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is
published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. No one other
than Cadence has the right to modify this Agreement.
6.6 This Agreement is governed by the laws of the State of
California and the intellectual property laws of the United
States of America. No party to this Agreement will bring a legal
action under this Agreement more than one year after the cause of
action arose. Each party waives its rights to a jury trial in any
resulting litigation.
END OF TERMS AND CONDITIONS
Cadence Open Source ver3.0 May 31, 2000
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
QSTRING = 258,
T_STRING = 259,
SITE_PATTERN = 260,
NUMBER = 261,
K_HISTORY = 262,
K_NAMESCASESENSITIVE = 263,
K_DESIGN = 264,
K_VIAS = 265,
K_TECH = 266,
K_UNITS = 267,
K_ARRAY = 268,
K_FLOORPLAN = 269,
K_SITE = 270,
K_CANPLACE = 271,
K_CANNOTOCCUPY = 272,
K_DIEAREA = 273,
K_PINS = 274,
K_DEFAULTCAP = 275,
K_MINPINS = 276,
K_WIRECAP = 277,
K_TRACKS = 278,
K_GCELLGRID = 279,
K_DO = 280,
K_BY = 281,
K_STEP = 282,
K_LAYER = 283,
K_ROW = 284,
K_RECT = 285,
K_COMPS = 286,
K_COMP_GEN = 287,
K_SOURCE = 288,
K_WEIGHT = 289,
K_EEQMASTER = 290,
K_FIXED = 291,
K_COVER = 292,
K_UNPLACED = 293,
K_PLACED = 294,
K_FOREIGN = 295,
K_REGION = 296,
K_REGIONS = 297,
K_NETS = 298,
K_START_NET = 299,
K_MUSTJOIN = 300,
K_ORIGINAL = 301,
K_USE = 302,
K_STYLE = 303,
K_PATTERN = 304,
K_PATTERNNAME = 305,
K_ESTCAP = 306,
K_ROUTED = 307,
K_NEW = 308,
K_SNETS = 309,
K_SHAPE = 310,
K_WIDTH = 311,
K_VOLTAGE = 312,
K_SPACING = 313,
K_NONDEFAULTRULE = 314,
K_NONDEFAULTRULES = 315,
K_N = 316,
K_S = 317,
K_E = 318,
K_W = 319,
K_FN = 320,
K_FE = 321,
K_FS = 322,
K_FW = 323,
K_GROUPS = 324,
K_GROUP = 325,
K_SOFT = 326,
K_MAXX = 327,
K_MAXY = 328,
K_MAXHALFPERIMETER = 329,
K_CONSTRAINTS = 330,
K_NET = 331,
K_PATH = 332,
K_SUM = 333,
K_DIFF = 334,
K_SCANCHAINS = 335,
K_START = 336,
K_FLOATING = 337,
K_ORDERED = 338,
K_STOP = 339,
K_IN = 340,
K_OUT = 341,
K_RISEMIN = 342,
K_RISEMAX = 343,
K_FALLMIN = 344,
K_FALLMAX = 345,
K_WIREDLOGIC = 346,
K_MAXDIST = 347,
K_ASSERTIONS = 348,
K_DISTANCE = 349,
K_MICRONS = 350,
K_END = 351,
K_IOTIMINGS = 352,
K_RISE = 353,
K_FALL = 354,
K_VARIABLE = 355,
K_SLEWRATE = 356,
K_CAPACITANCE = 357,
K_DRIVECELL = 358,
K_FROMPIN = 359,
K_TOPIN = 360,
K_PARALLEL = 361,
K_TIMINGDISABLES = 362,
K_THRUPIN = 363,
K_MACRO = 364,
K_PARTITIONS = 365,
K_TURNOFF = 366,
K_FROMCLOCKPIN = 367,
K_FROMCOMPPIN = 368,
K_FROMIOPIN = 369,
K_TOCLOCKPIN = 370,
K_TOCOMPPIN = 371,
K_TOIOPIN = 372,
K_SETUPRISE = 373,
K_SETUPFALL = 374,
K_HOLDRISE = 375,
K_HOLDFALL = 376,
K_VPIN = 377,
K_SUBNET = 378,
K_XTALK = 379,
K_PIN = 380,
K_SYNTHESIZED = 381,
K_DEFINE = 382,
K_DEFINES = 383,
K_DEFINEB = 384,
K_IF = 385,
K_THEN = 386,
K_ELSE = 387,
K_FALSE = 388,
K_TRUE = 389,
K_EQ = 390,
K_NE = 391,
K_LE = 392,
K_LT = 393,
K_GE = 394,
K_GT = 395,
K_OR = 396,
K_AND = 397,
K_NOT = 398,
K_SPECIAL = 399,
K_DIRECTION = 400,
K_RANGE = 401,
K_FPC = 402,
K_HORIZONTAL = 403,
K_VERTICAL = 404,
K_ALIGN = 405,
K_MIN = 406,
K_MAX = 407,
K_EQUAL = 408,
K_BOTTOMLEFT = 409,
K_TOPRIGHT = 410,
K_ROWS = 411,
K_TAPER = 412,
K_TAPERRULE = 413,
K_VERSION = 414,
K_DIVIDERCHAR = 415,
K_BUSBITCHARS = 416,
K_PROPERTYDEFINITIONS = 417,
K_STRING = 418,
K_REAL = 419,
K_INTEGER = 420,
K_PROPERTY = 421,
K_BEGINEXT = 422,
K_ENDEXT = 423,
K_NAMEMAPSTRING = 424,
K_ON = 425,
K_OFF = 426,
K_X = 427,
K_Y = 428,
K_COMPONENT = 429,
K_MASK = 430,
K_MASKSHIFT = 431,
K_COMPSMASKSHIFT = 432,
K_SAMEMASK = 433,
K_PINPROPERTIES = 434,
K_TEST = 435,
K_COMMONSCANPINS = 436,
K_SNET = 437,
K_COMPONENTPIN = 438,
K_REENTRANTPATHS = 439,
K_SHIELD = 440,
K_SHIELDNET = 441,
K_NOSHIELD = 442,
K_VIRTUAL = 443,
K_ANTENNAPINPARTIALMETALAREA = 444,
K_ANTENNAPINPARTIALMETALSIDEAREA = 445,
K_ANTENNAPINGATEAREA = 446,
K_ANTENNAPINDIFFAREA = 447,
K_ANTENNAPINMAXAREACAR = 448,
K_ANTENNAPINMAXSIDEAREACAR = 449,
K_ANTENNAPINPARTIALCUTAREA = 450,
K_ANTENNAPINMAXCUTCAR = 451,
K_SIGNAL = 452,
K_POWER = 453,
K_GROUND = 454,
K_CLOCK = 455,
K_TIEOFF = 456,
K_ANALOG = 457,
K_SCAN = 458,
K_RESET = 459,
K_RING = 460,
K_STRIPE = 461,
K_FOLLOWPIN = 462,
K_IOWIRE = 463,
K_COREWIRE = 464,
K_BLOCKWIRE = 465,
K_FILLWIRE = 466,
K_BLOCKAGEWIRE = 467,
K_PADRING = 468,
K_BLOCKRING = 469,
K_BLOCKAGES = 470,
K_PLACEMENT = 471,
K_SLOTS = 472,
K_FILLS = 473,
K_PUSHDOWN = 474,
K_NETLIST = 475,
K_DIST = 476,
K_USER = 477,
K_TIMING = 478,
K_BALANCED = 479,
K_STEINER = 480,
K_TRUNK = 481,
K_FIXEDBUMP = 482,
K_FENCE = 483,
K_FREQUENCY = 484,
K_GUIDE = 485,
K_MAXBITS = 486,
K_PARTITION = 487,
K_TYPE = 488,
K_ANTENNAMODEL = 489,
K_DRCFILL = 490,
K_OXIDE1 = 491,
K_OXIDE2 = 492,
K_OXIDE3 = 493,
K_OXIDE4 = 494,
K_CUTSIZE = 495,
K_CUTSPACING = 496,
K_DESIGNRULEWIDTH = 497,
K_DIAGWIDTH = 498,
K_ENCLOSURE = 499,
K_HALO = 500,
K_GROUNDSENSITIVITY = 501,
K_HARDSPACING = 502,
K_LAYERS = 503,
K_MINCUTS = 504,
K_NETEXPR = 505,
K_OFFSET = 506,
K_ORIGIN = 507,
K_ROWCOL = 508,
K_STYLES = 509,
K_POLYGON = 510,
K_PORT = 511,
K_SUPPLYSENSITIVITY = 512,
K_VIA = 513,
K_VIARULE = 514,
K_WIREEXT = 515,
K_EXCEPTPGNET = 516,
K_FILLWIREOPC = 517,
K_OPC = 518,
K_PARTIAL = 519,
K_ROUTEHALO = 520
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 228 "def.y"
double dval ;
int integer ;
char * string ;
int keyword ; // really just a nop
struct LefDefParser::defpoint pt;
LefDefParser::defTOKEN *tk;
/* Line 1676 of yacc.c */
#line 328 "def.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE defyylval;
This diff is collapsed.
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#include <string.h>
#include <stdlib.h>
#include "lex.h"
#include "defiAssertion.hpp"
#include "defiDebug.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
struct defiAssertPath {
char* fromPin_;
char* toPin_;
char* fromInst_;
char* toInst_;
};
defiAssertion::defiAssertion() {
Init();
}
defiAssertion::~defiAssertion() {
Destroy();
}
void defiAssertion::Init() {
netName_ = (char*)defMalloc(32);
netNameLength_ = 32;
numItems_ = 0;
clear();
numItemsAllocated_ = 16;
items_ = (int**)defMalloc(sizeof(char*)*16);
itemTypes_ = (char*)defMalloc(16);
}
void defiAssertion::Destroy() {
defFree(netName_);
defFree((char*)(itemTypes_));
defFree((char*)(items_));
}
void defiAssertion::clear() {
int i;
struct defiAssertPath* s;
if (netName_)
*(netName_) = '\0';
isSum_ = 0;
isDiff_ = 0;
isAssertion_ = 0;
hasRiseMin_ = 0;
hasRiseMax_ = 0;
hasFallMin_ = 0;
hasFallMax_ = 0;
isDelay_ = 0;
isWiredlogic_ = 0;
for (i = 0; i < numItems_; i++) {
if (itemTypes_[i] == 'p') {
s = (struct defiAssertPath*)(items_[i]);
defFree(s->fromPin_);
defFree(s->toPin_);
defFree(s->fromInst_);
defFree(s->toInst_);
defFree((char*)s);
} else if (itemTypes_[i] == 'n') {
defFree((char*)(items_[i]));
} else {
defiError(0, 6009, "ERROR (DEFPARSE-6009): An invalid attribute type has encounter while cleanning the memory.");
}
itemTypes_[i] = 'B'; // bogus
items_[i] = 0;
}
numItems_ = 0;
}
void defiAssertion::setConstraintMode() {
isAssertion_ = 0;
}
void defiAssertion::setAssertionMode() {
isAssertion_ = 1;
}
void defiAssertion::setWiredlogicMode() {
isWiredlogic_ = 1;
}
void defiAssertion::setWiredlogic(const char* name, double dist) {
int len = strlen(name) + 1;
if (isDelay_)
defiError(0, 6201, "ERROR (DEFPARS-6201): Unable to process the DEF file. Both WIREDLOGIC and DELAY statements are defined in constraint/assertion.\nUpdate the DEF file to define either a WIREDLOGIC or DELAY statement only.");
isWiredlogic_ = 1;
if (netNameLength_ < len) {
defFree(netName_);
netName_ = (char*)defMalloc(len);
netNameLength_ = len;
}
strcpy(netName_, DEFCASE(name));
fallMax_ = dist;
}
void defiAssertion::setDelay() {
if (isWiredlogic_)
defiError(0, 6201, "ERROR (DEFPARS-6201): Unable to process the DEF file. Both WIREDLOGIC and DELAY statements are defined in constraint/assertion.\nUpdate the DEF file to define either a WIREDLOGIC or DELAY statement only.");
isDelay_ = 1;
}
void defiAssertion::setSum() {
if (isDiff_)
defiError(0, 6202, "ERROR (DEPPARS-6202): Unable to process the DEF file. Both SUM and DIFF statements are defined in constraint/assertion.\nUpdate the DEF file to define either a SUM or DIFF statement only.");
isSum_ = 1;
}
void defiAssertion::unsetSum() {
isSum_ = 0;
}
void defiAssertion::setDiff() {
if (isSum_)
defiError(0, 6202, "ERROR (DEPPARS-6202): Unable to process the DEF file. Both SUM and DIFF statements are defined in constraint/assertion.\nUpdate the DEF file to define either a SUM or DIFF statement only.");
isDiff_ = 1;
}
const char* defiAssertion::netName() const {
return netName_;
}
void defiAssertion::setNetName(const char* name) {
int len = strlen(name) + 1;
clear();
if (len > netNameLength_) {
defFree(netName_);
netName_ = (char*)defMalloc(len);
netNameLength_ = len;
}
strcpy(netName_, DEFCASE(name));
}
int defiAssertion::isDelay() const {
return isDelay_ ? 1 : 0;
}
int defiAssertion::isAssertion() const {
return isAssertion_ ? 1 : 0;
}
int defiAssertion::isConstraint() const {
return isAssertion_ ? 0 : 1;
}
int defiAssertion::isSum() const {
return isSum_;
}
int defiAssertion::isDiff() const {
return isDiff_;
}
int defiAssertion::isWiredlogic() const {
return isWiredlogic_;
}
int defiAssertion::hasRiseMin() const {
return hasRiseMin_;
}
int defiAssertion::hasRiseMax() const {
return hasRiseMax_;
}
int defiAssertion::hasFallMin() const {
return hasFallMin_;
}
int defiAssertion::hasFallMax() const {
return hasFallMax_;
}
double defiAssertion::distance() const {
return fallMax_; // distance is stored here
}
double defiAssertion::riseMin() const {
return riseMin_;
}
double defiAssertion::riseMax() const {
return riseMax_;
}
double defiAssertion::fallMin() const {
return fallMin_;
}
double defiAssertion::fallMax() const {
return fallMax_;
}
void defiAssertion::setRiseMin(double d) {
riseMin_ = d;
hasRiseMin_ = 1;
}
void defiAssertion::setRiseMax(double d) {
riseMax_ = d;
hasRiseMax_ = 1;
}
void defiAssertion::setFallMin(double d) {
fallMin_ = d;
hasFallMin_ = 1;
}
void defiAssertion::setFallMax(double d) {
fallMax_ = d;
hasFallMax_ = 1;
}
int defiAssertion::numItems() const {
return numItems_;
}
int defiAssertion::isPath(int index) const {
if (index >= 0 && index < numItems_) {
return (itemTypes_[index] == 'p') ? 1 : 0;
}
return 0;
}
int defiAssertion::isNet(int index) const {
if (index >= 0 && index < numItems_) {
return (itemTypes_[index] == 'n') ? 1 : 0;
}
return 0;
}
void defiAssertion::path(int index, char** fromInst, char** fromPin,
char** toInst, char** toPin) const {
struct defiAssertPath* ap;
if (index >= 0 && index < numItems_ &&
itemTypes_[index] == 'p') {
ap = (struct defiAssertPath*)(items_[index]);
if (fromInst) *fromInst = ap->fromInst_;
if (fromPin) *fromPin = ap->fromPin_;
if (toInst) *toInst = ap->toInst_;
if (toPin) *toPin = ap->toPin_;
}
}
void defiAssertion::net(int index, char** netName) const {
if (index >= 0 && index < numItems_ &&
itemTypes_[index] == 'n') {
if (netName) *netName = (char*)(items_[index]);
}
}
void defiAssertion::bumpItems() {
int i;
char* newTypes;
int** newItems;
(numItemsAllocated_) *= 2;
newTypes = (char*)defMalloc(numItemsAllocated_ * sizeof(char));
newItems = (int**)defMalloc(numItemsAllocated_ * sizeof(int*));
for (i = 0; i < numItems_; i++) {
newItems[i] = items_[i];
newTypes[i] = itemTypes_[i];
}
defFree((char*)items_);
defFree((char*)itemTypes_);
items_ = newItems;
itemTypes_ = newTypes;
}
void defiAssertion::addNet(const char* name) {
int i;
char* s, *s1;
// set wiredlogic to false
isWiredlogic_ = 0;
// make our own copy
i = strlen(name) + 1;
if (name[i-2] == ',') {
s = (char*)defMalloc(i-1);
s1 = (char*)defMalloc(i-1);
strncpy(s1, name, i-2);
s1[i-2] = '\0';
strcpy(s, DEFCASE(s1));
defFree(s1);
} else {
s = (char*)defMalloc(i);
strcpy(s, DEFCASE(name));
}
// make sure there is space in the array
if (numItems_ >= numItemsAllocated_)
bumpItems();
// place it
i = numItems_;
items_[i] = (int*)s;
itemTypes_[i] = 'n';
numItems_ = i + 1;
//strcpy(itemTypes_, "n");
}
void defiAssertion::addPath(const char* fromInst, const char* fromPin,
const char* toInst, const char* toPin) {
int i;
struct defiAssertPath* s;
// set wiredlogic to false
isWiredlogic_ = 0;
// make our own copy
s = (struct defiAssertPath*)defMalloc(sizeof(struct defiAssertPath));
i = strlen(fromInst) + 1;
s->fromInst_ = (char*)defMalloc(i);
strcpy(s->fromInst_, DEFCASE(fromInst));
i = strlen(toInst) + 1;
s->toInst_ = (char*)defMalloc(i);
strcpy(s->toInst_, DEFCASE(toInst));
i = strlen(fromPin) + 1;
s->fromPin_ = (char*)defMalloc(i);
strcpy(s->fromPin_, DEFCASE(fromPin));
i = strlen(toPin) + 1;
s->toPin_ = (char*)defMalloc(i);
strcpy(s->toPin_, DEFCASE(toPin));
// make sure there is space in the array
if (numItems_ >= numItemsAllocated_)
bumpItems();
// place it
i = numItems_;
items_[i] = (int*)s;
itemTypes_[i] = 'p';
numItems_ = i + 1;
//strcpy(itemTypes_, "p");
}
void defiAssertion::print(FILE* f) const {
fprintf(f, "Assertion %s\n", netName());
}
END_LEFDEF_PARSER_NAMESPACE
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#ifndef defiAssertion_h
#define defiAssertion_h
#include "defiKRDefs.hpp"
#include <stdio.h>
BEGIN_LEFDEF_PARSER_NAMESPACE
// Struct holds the data for one assertion/constraint.
// An assertion or constraint is either a net/path rule or a
// wired logic rule.
//
// A net/path rule is an item or list of items plus specifications.
// The specifications are: rise/fall min/max.
// The items are a list of (one or more) net names or paths or a
// combination of both.
//
// A wired logic rule is a netname and a distance.
//
// We will NOT allow the mixing of wired logic rules and net/path delays
// in the same assertion/constraint.
//
// We will allow the rule to be a sum of sums (which will be interpreted
// as just one list).
//
class defiAssertion {
public:
defiAssertion();
void Init();
void Destroy();
~defiAssertion();
void setConstraintMode();
void setAssertionMode();
void setSum();
void setDiff();
void setNetName(const char* name);
void setRiseMin(double num);
void setRiseMax(double num);
void setFallMin(double num);
void setFallMax(double num);
void setDelay();
void setWiredlogicMode();
void setWiredlogic(const char* net, double dist);
void addNet(const char* name);
void addPath(const char* fromInst, const char* fromPin,
const char* toInst, const char* toPin);
void bumpItems();
void unsetSum();
int isAssertion() const; // Either isAssertion or isConstraint is true
int isConstraint() const;
int isWiredlogic() const; // Either isWiredlogic or isDelay is true
int isDelay() const;
int isSum() const;
int isDiff() const;
int hasRiseMin() const;
int hasRiseMax() const;
int hasFallMin() const;
int hasFallMax() const;
double riseMin() const;
double riseMax() const;
double fallMin() const;
double fallMax() const;
const char* netName() const; // Wired logic net name
double distance() const; // Wired logic distance
int numItems() const; // number of paths or nets
int isPath(int index) const; // is item #index a path?
int isNet(int index) const; // is item #index a net?
void path(int index, char** fromInst, char** fromPin,
char** toInst, char** toPin) const; // Get path data for item #index
void net(int index, char** netName) const; // Get net data for item #index
void clear();
void print(FILE* f) const;
protected:
char isAssertion_;
char isSum_;
char isDiff_;
char hasRiseMin_;
char hasRiseMax_;
char hasFallMin_;
char hasFallMax_;
char isWiredlogic_;
char isDelay_;
char* netName_; // wired logic net name
int netNameLength_;
double riseMin_;
double riseMax_;
double fallMin_;
double fallMax_; // also used to store the wired logic dist
int numItems_;
int numItemsAllocated_;
char* itemTypes_;
int** items_; // not really integers.
};
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "lex.h"
#include "defiBlockage.hpp"
#include "defiDebug.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
////////////////////////////////////////////////////
////////////////////////////////////////////////////
//
// defiBlockages
//
////////////////////////////////////////////////////
////////////////////////////////////////////////////
defiBlockage::defiBlockage() {
Init();
}
void defiBlockage::Init() {
numPolys_ = 0;
clear();
layerName_ = 0;
componentName_ = 0;
layerNameLength_ = 0;
componentNameLength_ = 0;
xl_ = 0;
yl_ = 0;
xh_ = 0;
yh_ = 0;
rectsAllocated_ = 0;
polysAllocated_ = 0;
polygons_ = 0;
}
defiBlockage::~defiBlockage() {
Destroy();
}
void defiBlockage::clear() {
hasLayer_ = 0;
hasPlacement_ = 0;
hasComponent_ = 0;
hasSlots_ = 0;
hasFills_ = 0;
hasPushdown_ = 0;
hasExceptpgnet_ = 0;
hasSoft_ = 0;
maxDensity_ = -1;
minSpacing_ = -1;
width_ = -1;
numRectangles_ = 0;
mask_ = 0;
}
void defiBlockage::clearPoly() {
struct defiPoints* p;
int i;
for (i = 0; i < numPolys_; i++) {
p = polygons_[i];
defFree((char*)(p->x));
defFree((char*)(p->y));
defFree((char*)(polygons_[i]));
}
numPolys_ = 0;
}
void defiBlockage::Destroy() {
if (layerName_) defFree(layerName_);
if (componentName_) defFree(componentName_);
layerName_ = 0;
componentName_ = 0;
if (rectsAllocated_) {
defFree((char*)(xl_));
defFree((char*)(yl_));
defFree((char*)(xh_));
defFree((char*)(yh_));
rectsAllocated_ = 0;
xl_ = 0;
yl_ = 0;
xh_ = 0;
yh_ = 0;
}
clearPoly();
defFree((char*)(polygons_));
polygons_ = 0;
clear();
}
void defiBlockage::setLayer(const char* name) {
int len = strlen(name) + 1;
if (layerNameLength_ < len) {
if (layerName_) defFree(layerName_);
layerName_ = (char*)defMalloc(len);
layerNameLength_ = len;
}
strcpy(layerName_, DEFCASE(name));
hasLayer_ = 1;
}
void defiBlockage::setPlacement() {
/* 10/29/2001 - Wanda da Rosa, new enhancement */
hasPlacement_ = 1;
return;
}
void defiBlockage::setComponent(const char* name) {
int len;
/* 10/29/2001 - Wanda da Rosa, component name is required */
len = strlen(name) + 1;
if (componentNameLength_ < len) {
if (componentName_) defFree(componentName_);
componentName_ = (char*)defMalloc(len);
componentNameLength_ = len;
}
strcpy(componentName_, DEFCASE(name));
hasComponent_ = 1;
}
void defiBlockage::setSlots() {
hasSlots_ = 1;
}
void defiBlockage::setFills() {
hasFills_ = 1;
}
void defiBlockage::setPushdown() {
hasPushdown_ = 1;
}
// 5.7
void defiBlockage::setExceptpgnet() {
hasExceptpgnet_ = 1;
}
// 5.7
void defiBlockage::setSoft() {
hasSoft_ = 1;
}
// 5.7
void defiBlockage::setPartial(double maxDensity) {
maxDensity_ = maxDensity;
}
void defiBlockage::setSpacing(int minSpacing) {
minSpacing_ = minSpacing;
}
void defiBlockage::setDesignRuleWidth(int width) {
width_ = width;
}
void defiBlockage::setMask(int colorMask) {
mask_ = colorMask;
}
void defiBlockage::addRect(int xl, int yl, int xh, int yh) {
if (numRectangles_ == rectsAllocated_) {
int i;
int max = rectsAllocated_ = (rectsAllocated_ == 0) ?
2 : rectsAllocated_ * 2;
int* newxl = (int*)defMalloc(sizeof(int)*max);
int* newyl = (int*)defMalloc(sizeof(int)*max);
int* newxh = (int*)defMalloc(sizeof(int)*max);
int* newyh = (int*)defMalloc(sizeof(int)*max);
for (i = 0; i < numRectangles_; i++) {
newxl[i] = xl_[i];
newyl[i] = yl_[i];
newxh[i] = xh_[i];
newyh[i] = yh_[i];
}
defFree((char*)(xl_));
defFree((char*)(yl_));
defFree((char*)(xh_));
defFree((char*)(yh_));
xl_ = newxl;
yl_ = newyl;
xh_ = newxh;
yh_ = newyh;
}
xl_[numRectangles_] = xl;
yl_[numRectangles_] = yl;
xh_[numRectangles_] = xh;
yh_[numRectangles_] = yh;
numRectangles_ += 1;
}
// 5.6
void defiBlockage::addPolygon(defiGeometries* geom) {
struct defiPoints* p;
int x, y;
int i;
if (numPolys_ == polysAllocated_) {
struct defiPoints** poly;
polysAllocated_ = (polysAllocated_ == 0) ?
2 : polysAllocated_ * 2;
poly = (struct defiPoints**)defMalloc(sizeof(struct defiPoints*) *
polysAllocated_);
for (i = 0; i < numPolys_; i++)
poly[i] = polygons_[i];
if (polygons_)
defFree((char*)(polygons_));
polygons_ = poly;
}
p = (struct defiPoints*)defMalloc(sizeof(struct defiPoints));
p->numPoints = geom->numPoints();
p->x = (int*)defMalloc(sizeof(int)*p->numPoints);
p->y = (int*)defMalloc(sizeof(int)*p->numPoints);
for (i = 0; i < p->numPoints; i++) {
geom->points(i, &x, &y);
p->x[i] = x;
p->y[i] = y;
}
polygons_[numPolys_] = p;
numPolys_ += 1;
}
int defiBlockage::hasLayer() const {
return hasLayer_;
}
int defiBlockage::hasPlacement() const {
return hasPlacement_;
}
int defiBlockage::hasComponent() const {
return hasComponent_;
}
int defiBlockage::hasSlots() const {
return hasSlots_;
}
int defiBlockage::hasFills() const {
return hasFills_;
}
int defiBlockage::hasPushdown() const {
return hasPushdown_;
}
// 5.7
int defiBlockage::hasExceptpgnet() const {
return hasExceptpgnet_;
}
// 5.7
int defiBlockage::hasSoft() const {
return hasSoft_;
}
// 5.7
int defiBlockage::hasPartial() const {
if (maxDensity_ == -1)
return 0;
return 1;
}
// 5.7
double defiBlockage::placementMaxDensity() const {
return maxDensity_;
}
int defiBlockage::hasSpacing() const {
if (minSpacing_ == -1)
return 0;
return 1;
}
int defiBlockage::hasDesignRuleWidth() const {
if (width_ == -1)
return 0;
return 1;
}
int defiBlockage::hasMask() const {
return mask_;
}
int defiBlockage::minSpacing() const {
return minSpacing_;
}
int defiBlockage::designRuleWidth() const {
return width_;
}
int defiBlockage::mask() const {
return mask_;
}
const char* defiBlockage::layerName() const {
return layerName_;
}
const char* defiBlockage::layerComponentName() const {
return componentName_;
}
const char* defiBlockage::placementComponentName() const {
return componentName_;
}
int defiBlockage::numRectangles() const {
return numRectangles_;
}
int defiBlockage::xl(int index) const {
if (index < 0 || index >= numRectangles_) {
defiError(1, 0, "bad index for blockage xl");
return 0;
}
return xl_[index];
}
int defiBlockage::yl(int index) const {
if (index < 0 || index >= numRectangles_) {
defiError(1, 0, "bad index for blockage yl");
return 0;
}
return yl_[index];
}
int defiBlockage::xh(int index) const {
if (index < 0 || index >= numRectangles_) {
defiError(1, 0, "bad index for blockage xh");
return 0;
}
return xh_[index];
}
int defiBlockage::yh(int index) const {
if (index < 0 || index >= numRectangles_) {
defiError(1, 0, "bad index for blockage yh");
return 0;
}
return yh_[index];
}
// 5.6
int defiBlockage::numPolygons() const {
return numPolys_;
}
// 5.6
struct defiPoints defiBlockage::getPolygon(int index) const {
return *(polygons_[index]);
}
void defiBlockage::print(FILE* f) const {
int i, j;
struct defiPoints points;
if (hasLayer()) {
fprintf(f, "- LAYER %s", layerName());
if (hasComponent())
fprintf(f, " + COMPONENT %s", layerComponentName());
if (hasSlots())
fprintf(f, " + SLOTS");
if (hasFills())
fprintf(f, " + FILLS");
if (hasPushdown())
fprintf(f, " + PUSHDOWN");
if (hasExceptpgnet())
fprintf(f, " + EXCEPTPGNET");
fprintf(f, "\n");
}
if (hasPlacement()) {
fprintf(f, "- PLACEMENT");
if (hasComponent())
fprintf(f, " + COMPONENT %s", layerComponentName());
if (hasPushdown())
fprintf(f, " + PUSHDOWN");
if (hasSoft())
fprintf(f, " + SOFT");
if (hasPartial())
fprintf(f, " + PARTIAL", placementMaxDensity());
fprintf(f, "\n");
}
for (i = 0; i < numRectangles(); i++) {
fprintf(f, " RECT %d %d %d %d\n", xl(i),
yl(i), xh(i),
yh(i));
}
for (i = 0; i < numPolygons(); i++) {
fprintf(f, " POLYGON ");
points = getPolygon(i);
for (j = 0; j < points.numPoints; j++)
fprintf(f, "%d %d ", points.x[j], points.y[j]);
fprintf(f,"\n");
}
fprintf(f,"\n");
}
END_LEFDEF_PARSER_NAMESPACE
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#ifndef defiBLOCKAGES_h
#define defiBLOCKAGES_h
#include <stdio.h>
#include "defiKRDefs.hpp"
#include "defiMisc.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
class defiBlockage {
public:
defiBlockage();
void Init();
void Destroy();
~defiBlockage();
void clear();
void clearPoly();
void setLayer(const char* name);
void setPlacement();
void setComponent(const char* name);
void setSlots();
void setFills();
void setPushdown();
void setExceptpgnet(); // 5.7
void setSoft(); // 5.7
void setPartial(double maxDensity); // 5.7
void setSpacing(int minSpacing);
void setDesignRuleWidth(int width);
void setMask(int maskColor); // 5.8
void addRect(int xl, int yl, int xh, int yh);
void addPolygon(defiGeometries* geom);
int hasLayer() const;
int hasPlacement() const;
int hasComponent() const;
int hasSlots() const;
int hasFills() const;
int hasPushdown() const;
int hasExceptpgnet() const; // 5.7
int hasSoft() const; // 5.7
int hasPartial() const; // 5.7
int hasSpacing() const; // 5.6
int hasDesignRuleWidth() const; // 5.6
int hasMask() const; // 5.8
int mask() const; // 5.8
int minSpacing() const; // 5.6
int designRuleWidth() const; // 5.6
double placementMaxDensity() const; // 5.7
const char* layerName() const;
const char* layerComponentName() const;
const char* placementComponentName() const;
int numRectangles() const;
int xl(int index) const;
int yl(int index) const;
int xh(int index) const;
int yh(int index) const;
int numPolygons() const; // 5.6
struct defiPoints getPolygon(int index) const; // 5.6
void print(FILE* f) const;
protected:
int hasLayer_;
char* layerName_;
int layerNameLength_;
int hasPlacement_;
int hasComponent_;
char* componentName_;
int componentNameLength_;
int hasSlots_;
int hasFills_;
int hasPushdown_; // 5.7
int hasExceptpgnet_ ; // 5.7
int hasSoft_; // 5.7
double maxDensity_; // 5.7
int minSpacing_;
int width_;
int numRectangles_;
int rectsAllocated_;
int mask_; // 5.8
int* xl_;
int* yl_;
int* xh_;
int* yh_;
int numPolys_; // 5.6
int polysAllocated_; // 5.6
struct defiPoints** polygons_; // 5.6
};
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
This diff is collapsed.
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#ifndef defiComponent_h
#define defiComponent_h
#include <stdio.h>
#include "defiKRDefs.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
// Placement status for the component.
// Default is 0
#define DEFI_COMPONENT_UNPLACED 1
#define DEFI_COMPONENT_PLACED 2
#define DEFI_COMPONENT_FIXED 3
#define DEFI_COMPONENT_COVER 4
// Struct holds the data for componentMaskShiftLayers.
class defiComponentMaskShiftLayer {
public:
defiComponentMaskShiftLayer();
~defiComponentMaskShiftLayer();
void Init();
void Destroy();
void addMaskShiftLayer(const char* layer);
int numMaskShiftLayers() const;
void bumpLayers(int size);
void clear();
const char* maskShiftLayer(int index) const;
protected:
int layersAllocated_; // allocated size of layers_
int numLayers_; // number of places used in layers_
char** layers_;
};
// Struct holds the data for one component.
class defiComponent {
public:
defiComponent();
void Init();
void Destroy();
~defiComponent();
void IdAndName(const char* id, const char* name);
void setGenerate(const char* genName, const char* macroName);
void setPlacementStatus(int n);
void setPlacementLocation(int x, int y, int orient);
void setRegionName(const char* name);
void setRegionBounds(int xl, int yl, int xh, int yh);
void setEEQ(const char* name);
void addNet(const char* netName);
void addProperty(const char* name, const char* value, const char type);
void addNumProperty(const char* name, const double d,
const char* value, const char type);
void reverseNetOrder();
void setWeight(int w);
void setMaskShift(int color);
void setSource(const char* name);
void setForeignName(const char* name);
void setFori(const char* name);
void setForeignLocation(int x, int y, int orient);
void setHalo(int left, int bottom, int right, int top); // 5.6
void setHaloSoft(); // 5.7
void setRouteHalo(int haloDist, const char* minLayer, const char* maxLayer);
// 5.7
void clear();
// For OA to modify the Id & Name
void changeIdAndName(const char* id, const char* name);
const char* id() const;
const char* name() const;
int placementStatus() const;
int isUnplaced() const;
int isPlaced() const;
int isFixed() const;
int isCover() const;
int placementX() const;
int placementY() const;
int placementOrient() const;
const char* placementOrientStr() const;
int hasRegionName() const;
int hasRegionBounds() const;
int hasEEQ() const;
int hasGenerate() const;
int hasSource() const;
int hasWeight() const;
int weight() const;
int maskShiftSize() const;
int maskShift(int index) const;
int hasNets() const;
int numNets() const;
const char* net(int index) const;
const char* regionName() const;
const char* source() const;
const char* EEQ() const;
const char* generateName() const;
const char* macroName() const;
int hasHalo() const; // 5.6
int hasHaloSoft() const; // 5.7
void haloEdges(int* left, int* bottom, int* right, int* top); // 5.6
int hasRouteHalo() const; // 5.7
int haloDist() const; // 5.7
const char* minLayer() const; // 5.7
const char* maxLayer() const; // 5.7
// Returns arrays for the ll and ur of the rectangles in the region.
// The number of items in the arrays is given in size.
void regionBounds(int*size, int** xl, int** yl, int** xh, int** yh) const;
int hasForeignName() const;
const char* foreignName() const;
int foreignX() const;
int foreignY() const;
const char* foreignOri() const; // return the string value of the orient
int foreignOrient() const; // return the enum value of the orient
int hasFori() const;
int numProps() const;
char* propName(int index) const;
char* propValue(int index) const;
double propNumber(int index) const;
char propType(int index) const;
int propIsNumber(int index) const;
int propIsString(int index) const;
// Debug printing
void print(FILE* fout) const;
void bumpId(int size);
void bumpName(int size);
void bumpRegionName(int size);
void bumpEEQ(int size);
void bumpNets(int size);
void bumpForeignName(int size);
void bumpMinLayer(int size);
void bumpMaxLayer(int size);
void bumpFori(int size);
protected:
char* id_; // instance id
char* name_; // name.
int nameSize_; // allocated size of name.
int idSize_; // allocated size of id.
int ForiSize_; // allocate size of foreign ori
int status_; // placement status
char hasRegionName_; // the file supplied a region name for this comp
char hasEEQ_; // the file supplied an eeq
char hasGenerate_; // the file supplied an generate name and macro name
char hasWeight_; // the file supplied a weight
char hasFori_; // the file supplied a foreign orig name
int orient_; // orientation
int x_, y_; // placement loc
int numRects_;
int rectsAllocated_;
int* rectXl_; // region points
int* rectYl_;
int* rectXh_;
int* rectYh_;
char* regionName_; // name.
int regionNameSize_; // allocated size of region name
char* EEQ_;
int EEQSize_; // allocated size of eeq
int numNets_; // number of net connections
int netsAllocated_; // allocated size of nets array
char** nets_; // net connections
int weight_;
int* maskShift_;
int maskShiftSize_;
char* source_;
char hasForeignName_; // the file supplied a foreign name
char* foreignName_; // name
int foreignNameSize_; // allocate size of foreign name
int Fx_, Fy_; // foreign loc
int Fori_; // foreign ori
int generateNameSize_;
char* generateName_;
int macroNameSize_;
char* macroName_;
int hasHalo_;
int hasHaloSoft_; // 5.7
int leftHalo_;
int bottomHalo_;
int rightHalo_;
int topHalo_;
int haloDist_; // 5.7
int minLayerSize_; // 5.7
char* minLayer_; // 5.7
int maxLayerSize_; // 5.7
char* maxLayer_; // 5.7
int numProps_;
int propsAllocated_;
char** names_;
char** values_;
double* dvalues_;
char* types_;
};
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lex.h"
#include "defiDebug.hpp"
#include "defrData.hpp"
#include "defrSettings.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
/*******************
* Debug flags:
* 0 -
* 1 - malloc debug
* 2 - print each history size bump up.
* 3 - print each call to CatchAll
* 4 -
* 5 -
* 6 -
* 7 -
* 8 -
* 9 -
* 10 -
* 11 - lexer debug
*
******************************/
/* Set flag */
void defiSetDebug(int num, int value) {
defSettings->Debug[num] = value;
}
/* Read flag */
int defiDebug(int num) {
return defSettings->Debug[num];
}
void defiError(int check, int msgNum, const char* mess) {
/* check is 1 if the caller function has checked totalMsgLimit, etc. */
if (!check) {
if ((defSettings->totalDefMsgLimit > 0) && (defData->defMsgPrinted >= defSettings->totalDefMsgLimit))
return;
if (defSettings->MsgLimit[msgNum-5000] > 0) {
if (defData->msgLimit[msgNum-5000] >= defSettings->MsgLimit[msgNum-5000])
return; /*over the limit*/
defData->msgLimit[msgNum-5000] = defData->msgLimit[msgNum-5000] + 1;
}
defData->defMsgPrinted++;
}
if (defSettings->ErrorLogFunction) {
(*defSettings->ErrorLogFunction)(mess);
} else {
fprintf(stderr, mess);
}
}
static char defiShift [] = {
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
' ', '!', '"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'l', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '{', '|', '}', '~', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
};
const char* upperCase(const char* str) {
char* place = (char*)str;
char* to;
int len = strlen(str) + 1;
if (len > defData->shiftBufLength) {
if (defData->shiftBuf == 0) {
len = len < 64 ? 64 : len;
defData->shiftBuf = (char*)defMalloc(len);
defData->shiftBufLength = len;
} else {
defFree(defData->shiftBuf);
defData->shiftBuf = (char*)defMalloc(len);
defData->shiftBufLength = len;
}
}
to = defData->shiftBuf;
while (*place) {
int i = (int)*place;
place++;
*to++ = defiShift[i];
}
*to = '\0';
return defData->shiftBuf;
}
END_LEFDEF_PARSER_NAMESPACE
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#ifndef defiDebug_h
#define defiDebug_h
#include "defiKRDefs.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
/* Set flag */
extern void defiSetDebug (int num, int value) ;
/* Read flag */
extern int defiDebug (int num) ;
/* Error loggin function */
extern void defiError(int check, int msgNum, const char* message);
/* for auto upshifting names in case insensitive files */
extern const char* upperCase(const char* c);
extern const char* DEFCASE(const char* ch);
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
/* Definitions header file for the DEF Interface */
#ifndef DEFI_DEFS_H
#define DEFI_DEFS_H
#include <stdio.h>
#include <limits.h>
#include "defiKRDefs.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
/*=================== General Types and Definitions =================*/
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef NULL
#define NULL (0)
#endif
typedef struct defpoint defPOINT;
struct defpoint {
int x;
int y;
};
typedef struct defrect defRECT;
struct defrect {
defPOINT ll,ur;
};
typedef struct deftoken defTOKEN;
struct deftoken {
defTOKEN *next;
int what;
int data;
defPOINT pt;
};
#define START_LIST 10001
#define POINT_SPEC 10002
#define VIA_SPEC 10003
#define WIDTH_SPEC 10004
#define LAYER_SPEC 10005
#define SHAPE_SPEC 10006
#ifndef MIN
#define MIN(x,y) ((x) < (y)? (x) : (y))
#endif
#ifndef MIN
#define MAX(x,y) ((x) > (y)? (x) : (y))
#endif
#define ROUND(x) ((x) >= 0 ? (int)((x)+0.5) : (int)((x)-0.5))
//defTOKEN *TokenFromRect();
/*=================== Enumerated Types ============================*/
typedef int defiBoolean;
/* Every type of object has a unique identifier, and each object
* which is created knows its type, by storing the defiObjectType_e
* as the first member in the structure.
*
*/
typedef enum
{
/* decrease likelihood of accidentally correct values by starting
at an unusual number */
defiInvalidObject = 41713,
defiUnknownObject /* void * */
} defiObjectType_e;
/* The memory policy controls how an object which refers to or is composed of
* other objects manages those sub-objects, particularly when the parent
* object is copied or deleted. The policy is specified as an argument to the
* constructor or initializer, and it is stored with the parent object.
*
* The memory policy is a generalization of the common distinction between
* deep and shallow copies. When a shallow copy of a parent object is made,
* the copy maintains pointers to the original sub-objects, and the original
* parent remains responsible for deleting those sub-objects. When a deep
* copy of a parent object is made, the copy maintains pointers to new copies
* of each of the sub-objects, and the copy is responsible for deleting the
* new sub-objects.
*
* The defiPrivateSubObjects policy corresponds to a deep copy, while the the
* defiReferencedSubObjects policy corresponds to a shallow copy. Usually an
* initial parent object will be created using defiPrivateSubObjects. When a
* copy is made of that parent object, the copy may either maintain its own
* private versions of each sub-object, or it may refer to the original
* sub-objects.
*
* In certain cases, it is useful to create a deep copy of a parent object,
* even though the new parent object shouldn't be responsible for the new
* sub-objects. In this case, the defiOrphanSubObjects and
* defiAdoptedSubObjects policies may be used. defiOrphanSubObjects is
* specified while creating the deep copy, and then defiAdoptedSubObjects is
* specified while creating another parent which will take on the
* responsibility for the orphans.
*
* An object's memory policy affects only the sub-objects which it directly
* controls. Those sub-objects themselves may have the same memory policy as
* their parents, or they may have a different memory policy. When a copy is
* made of a child sub-object, the memory policy of the child controls
* whether deep or shallow copies are made of the grandchildren.
*/
typedef enum
{
/* decrease likelihood of accidentally correct values by starting
at an unusual number */
defiInvalidMemoryPolicy = 23950,
defiPrivateSubObjects, // deep copy + delete
defiReferencedSubObjects, // shallow copy, no delete
defiOrphanSubObjects, // deep copy, no delete
defiAdoptedSubObjects // shallow copy + delete
} defiMemoryPolicy_e;
/* An opaque pointer for passing user data through from one API
* function to another.
* A handle which a user can set to point to their own data
* on a per-callback basis. (See the comment in defwWriter.h)
*/
#define defiUserData void *
#define defiUserDataHandle void **
/* On SunOs 4.1.3 with acc, this is in libansi.a, but isn't properly
* declared anywhere in the header files supplied with the compiler.
*/
#ifdef __SunOS_4_1_3
extern int strcasecmp(const char*, const char*);
#endif
#ifdef WIN32
#define strdup _strdup
#endif
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
This diff is collapsed.
// *****************************************************************************
// *****************************************************************************
// Copyright 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: icftcm $
// $Revision: #1 $
// $Date: 2014/02/10 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#ifndef defiFPC_h
#define defiFPC_h
#include <stdio.h>
#include "defiKRDefs.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
class defiFPC {
public:
defiFPC();
void Init();
void Destroy();
~defiFPC();
void clear();
void setName(const char* name, const char* direction);
void setAlign();
void setMax(double num);
void setMin(double num);
void setEqual(double num);
void setDoingBottomLeft();
void setDoingTopRight();
void addRow(const char* name);
void addComps(const char* name);
void addItem(char typ, const char* name);
const char* name() const;
int isVertical() const;
int isHorizontal() const;
int hasAlign() const;
int hasMax() const;
int hasMin() const;
int hasEqual() const;
double alignMax() const;
double alignMin() const;
double equal() const;
int numParts() const;
// Return the constraint number "index" where index is
// from 0 to numParts()
// The returned corner is 'B' for bottom left 'T' for topright
// The returned typ is 'R' for rows 'C' for comps
// The returned char* points to name of the item.
void getPart(int index, int* corner, int* typ, char** name) const;
// debug print
void print(FILE* f) const;
protected:
char* name_;
int nameLength_;
char direction_; // H or V
char hasAlign_;
char hasMin_;
char hasMax_;
char hasEqual_;
char corner_; // Bottomleft or Topright
double minMaxEqual_;
int namesAllocated_; // allocated size of names_ and rowOrComp_
int namesUsed_; // number of entries used in the arrays
char* rowOrComp_;
char** names_;
};
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment