1 /* Authors: Lutong Wang and Bangqi Xu */
2 /*
3  * Copyright (c) 2019, The Regents of the University of California
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *     * Redistributions of source code must retain the above copyright
9  *       notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above copyright
11  *       notice, this list of conditions and the following disclaimer in the
12  *       documentation and/or other materials provided with the distribution.
13  *     * Neither the name of the University nor the
14  *       names of its contributors may be used to endorse or promote products
15  *       derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include <iostream>
30 #include <sstream>
31 
32 #include "FlexRP.h"
33 #include "db/infra/frTime.h"
34 #include "frProfileTask.h"
35 #include "gc/FlexGC.h"
36 
37 using namespace std;
38 using namespace fr;
39 
init()40 void FlexRP::init()
41 {
42   ProfileTask profile("RP:init");
43 
44   vector<pair<frCoord, frCoord>> forbiddenRanges;
45   vector<vector<pair<frCoord, frCoord>>> eightForbiddenRanges(8,
46                                                               forbiddenRanges);
47   vector<vector<pair<frCoord, frCoord>>> fourForbiddenRanges(4,
48                                                              forbiddenRanges);
49   vector<bool> fourForbidden(4, false);
50 
51   auto bottomLayerNum = getDesign()->getTech()->getBottomLayerNum();
52   auto topLayerNum = getDesign()->getTech()->getTopLayerNum();
53 
54   for (auto lNum = bottomLayerNum; lNum <= topLayerNum; lNum++) {
55     if (tech_->getLayer(lNum)->getType() != frLayerTypeEnum::ROUTING) {
56       continue;
57     }
58     tech_->via2ViaForbiddenLen.push_back(eightForbiddenRanges);
59     tech_->via2ViaForbiddenOverlapLen.push_back(eightForbiddenRanges);
60     tech_->viaForbiddenTurnLen.push_back(fourForbiddenRanges);
61     tech_->viaForbiddenPlanarLen.push_back(fourForbiddenRanges);
62     tech_->line2LineForbiddenLen.push_back(fourForbiddenRanges);
63     tech_->viaForbiddenThrough.push_back(fourForbidden);
64     for (auto& ndr : tech_->nonDefaultRules) {
65       ndr->via2ViaForbiddenLen.push_back(eightForbiddenRanges);
66       ndr->viaForbiddenTurnLen.push_back(fourForbiddenRanges);
67     }
68   }
69 }
70