forked from RsynTeam/rsyn-x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented rsyn service to manage routing guides from ispd18 contest
- Loading branch information
1 parent
1f82e3f
commit 205c6c1
Showing
4 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* Copyright 2014-2017 Rsyn | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
/* | ||
* File: Guide.h | ||
* Author: jucemar | ||
* | ||
* Created on 21 de Dezembro de 2016, 17:58 | ||
*/ | ||
|
||
#ifndef ISPD18_GUIDE | ||
#define ISPD18_GUIDE | ||
|
||
#include <vector> | ||
#include "rsyn/phy/PhysicalDesign.h" | ||
|
||
namespace Rsyn { | ||
|
||
class LayerGuide { | ||
friend class RoutingGuide; | ||
friend class NetGuide; | ||
protected: | ||
Rsyn::PhysicalLayer clsPhLayer; | ||
Bounds clsBounds; | ||
public: | ||
LayerGuide() = default; | ||
const Bounds & getBounds() const { | ||
return clsBounds; | ||
} // end method | ||
Rsyn::PhysicalLayer getLayer() const { | ||
return clsPhLayer; | ||
} // end method | ||
}; // end class | ||
|
||
class NetGuide { | ||
friend class RoutingGuide; | ||
protected: | ||
std::vector<LayerGuide> clsLayerGuides; | ||
public: | ||
NetGuide() = default; | ||
const std::vector<LayerGuide> & allLayerGuides() const { | ||
return clsLayerGuides; | ||
} // end method | ||
}; // end class | ||
|
||
} // end namespace | ||
|
||
|
||
#endif /* ISPD18_ROUTINGGUIDE */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* Copyright 2014-2017 Rsyn | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* File: RoutingGuide.cpp | ||
* Author: jucemar | ||
* | ||
* Created on 21 de Dezembro de 2016, 17:47 | ||
*/ | ||
|
||
#include "RoutingGuide.h" | ||
#include "rsyn/phy/PhysicalService.h" | ||
|
||
namespace Rsyn { | ||
|
||
void RoutingGuide::start(const Rsyn::Json ¶ms) { | ||
if(clsInitialized) | ||
return; | ||
clsDesign = clsSession.getDesign(); | ||
clsModule = clsDesign.getTopModule(); | ||
clsGuides = clsDesign.createAttribute(); | ||
|
||
Rsyn::PhysicalService* phService = clsSession.getService("rsyn.physical"); | ||
clsPhDesign = phService->getPhysicalDesign(); | ||
clsInitialized = true; | ||
} // end method | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
void RoutingGuide::stop() { | ||
} // end method | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
void RoutingGuide::loadGuides(const GuideDscp & dscp) { | ||
for (const GuideNetDscp & netDscp : dscp.clsNetGuides) { | ||
Rsyn::Net net = clsDesign.findNetByName(netDscp.clsNetName); | ||
NetGuide & netGuide = clsGuides[net]; | ||
std::vector<LayerGuide> & layerGuides= netGuide.clsLayerGuides; | ||
layerGuides.reserve(netDscp.clsLayerDscps.size()); | ||
for(const GuideLayerDscp & layerDscp : netDscp.clsLayerDscps) { | ||
layerGuides.push_back(LayerGuide()); | ||
LayerGuide & layerGuide = layerGuides.back(); | ||
layerGuide.clsBounds = layerDscp.clsLayerGuide; | ||
layerGuide.clsPhLayer = clsPhDesign.getPhysicalLayerByName(layerDscp.clsLayer); | ||
} // end for | ||
} // end for | ||
} // end method | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
} // end namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* Copyright 2014-2017 Rsyn | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
/* | ||
* File: RoutingGuide.h | ||
* Author: jucemar | ||
* | ||
* Created on 21 de Dezembro de 2016, 17:47 | ||
*/ | ||
|
||
#ifndef ISPD18_ROUTINGGUIDE | ||
#define ISPD18_ROUTINGGUIDE | ||
|
||
#include "rsyn/session/Service.h" | ||
#include "rsyn/session/Session.h" | ||
#include "rsyn/ispd18/Guide.h" | ||
#include "rsyn/io/parser/guide-ispd18/GuideDescriptor.h" | ||
|
||
namespace Rsyn { | ||
|
||
class RoutingGuide : public Rsyn::Service { | ||
protected: | ||
Rsyn::Session clsSession; | ||
Rsyn::Design clsDesign; | ||
Rsyn::Module clsModule; | ||
Rsyn::PhysicalDesign clsPhDesign; | ||
Rsyn::Attribute<Rsyn::Net, Rsyn::NetGuide> clsGuides; | ||
bool clsInitialized = false; | ||
public: | ||
RoutingGuide() = default; | ||
void start(const Rsyn::Json ¶ms); | ||
void stop(); | ||
|
||
void loadGuides(const GuideDscp & dscp); | ||
|
||
const NetGuide & getGuide(Rsyn::Net net) const { | ||
return clsGuides[net]; | ||
} | ||
}; // end class | ||
|
||
} // end namespace | ||
|
||
|
||
#endif /* ISPD18_ROUTINGGUIDE */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters