27 const Design& design = *designPtr;
42 newCircuit->addNet(netPtr);
49 unpack(**pi++, newCircuit);
56 designName +=
"_unpacked";
61 deviceName +=
".xdlrc";
67 newDesign->addConfigs(static_cast<const ConfigMap&>(design));
75 newDesign->addModule(modulePtr);
78 unpack(static_cast<Circuit>(design), static_cast<CircuitSharedPtr>(newDesign));
89 {newModule->addConfigs(static_cast<const ConfigMap&>(module)); }
96 newModule->addPort(portPtr);
100 unpack(static_cast<Circuit>(module), static_cast<CircuitSharedPtr>(newModule));
114 if((instance.
getType()==
"SLICEL")||(instance.
getType()==
"SLICEM")){
118 ConfigMap affConfigs, bffConfigs, cffConfigs, dffConfigs,xffConfigs,yffConfigs;
119 ConfigMap alutConfigs, blutConfigs, clutConfigs, dlutConfigs,xlutConfigs,ylutConfigs;
127 if(instanceReferencePtr.get() != 0) {
130 ?
"[expired instance]" : instanceReference.
getInstancePtr().lock()->getName();
140 if(setting ==
"_NO_USER_LOGIC")
143 if(elemIter == primitivePtr->elementsEnd()){
147 string newName = instance.
getName();
149 const Config& config = p->second;
150 newName = newName +
":" + setting +
":" + config.
getName() ;
155 instanceConfigs.
setConfig(setting, config);
160 if(strstr(setting.c_str(),
"INV")!= NULL){
161 if(strstr(config.
getValue().c_str() ,
"_B") == NULL){
162 instanceConfigs.
setConfig(setting, config);
167 instanceConfigs.
setConfig(setting, config);
170 else if((strstr(setting.c_str(),
"LUT")!= NULL)|| (setting ==
"G")|| (setting ==
"F")){
172 instanceConfigs.
setConfig(setting, config);
174 else if((strstr(setting.c_str(),
"AND")!= NULL)){
176 instanceConfigs.
setConfig(setting, config);
178 else if((strstr(setting.c_str(),
"XOR")!= NULL)){
180 instanceConfigs.
setConfig(setting, config);
182 else if((setting ==
"AFF") || (setting ==
"BFF") || (setting ==
"CFF") || (setting ==
"DFF") || (setting ==
"FFX") || (setting ==
"FFY")){
184 instanceConfigs.
setConfig(setting, config);
186 else if( ( setting ==
"AFFSR") ||
187 (setting ==
"AFFINIT") ){
192 else if( ( setting ==
"BFFSR") ||
193 (setting ==
"BFFINIT") ){
198 else if( ( setting ==
"CFFSR") ||
199 (setting ==
"CFFINIT") ){
204 else if( ( setting ==
"DFFSR") ||
205 (setting ==
"DFFINIT") ){
210 else if( ( setting ==
"FFY_INIT_ATTR") ||
211 (setting ==
"FFY_SR_ATTR") ){
216 else if( ( setting ==
"FFX_INIT_ATTR") ||
217 (setting ==
"FFX_SR_ATTR") ){
222 else if(setting ==
"A6RAMMODE"){
227 else if(setting ==
"B6RAMMODE"){
232 else if(setting ==
"C6RAMMODE"){
237 else if(setting ==
"D6RAMMODE"){
242 else if(setting ==
"D6RAMMODE"){
247 else if(setting ==
"F_ATTR"){
252 else if(setting ==
"G_ATTR"){
257 else if((strstr(setting.c_str(),
"MUX")!=NULL)||(strstr(setting.c_str(),
"CY0")!=NULL)||
258 (setting==
"PRECYINIT")){
260 instanceConfigs.
setConfig(setting, config);
266 else if(strstr(setting.c_str(),
"SYNC_ATTR")!= NULL){
277 else if((setting ==
"_INST_PROP") || (setting ==
"_ROUTETHROUGH")){
283 instanceConfigs.
setConfig(setting, config);
288 "", instance.
getBonding(), newInstanceReferencePtr);
289 if(typeName ==
"DFF") {
291 affInstances.push_back(newInst);
292 else if(setting ==
"BFF")
293 bffInstances.push_back(newInst);
294 else if(setting ==
"CFF")
295 cffInstances.push_back(newInst);
296 else if(setting ==
"DFF")
297 dffInstances.push_back(newInst);
298 else if(setting ==
"FFX")
299 xffInstances.push_back(newInst);
300 else if(setting ==
"FFY")
301 yffInstances.push_back(newInst);
302 }
else if(typeName ==
"LUT") {
303 if(setting ==
"A6LUT")
304 alutInstances.push_back(newInst);
305 else if(setting ==
"B6LUT")
306 blutInstances.push_back(newInst);
307 else if(setting ==
"C6LUT")
308 clutInstances.push_back(newInst);
309 else if(setting ==
"D6LUT")
310 dlutInstances.push_back(newInst);
311 else if(setting ==
"F")
312 xlutInstances.push_back(newInst);
313 else if(setting ==
"G")
314 ylutInstances.push_back(newInst);
315 }
else if((typeName !=
"INV") && (typeName !=
"MUX") && (typeName !=
"AND") && (typeName !=
"XOR") && (typeName !=
"WSGEN")) {
316 newInst->setConfig(p->first, config);
318 newCircuit->addInstance(newInst);
324 (*it)->addConfigs(affConfigs);
326 (*it)->addConfigs(bffConfigs);
328 (*it)->addConfigs(cffConfigs);
330 (*it)->addConfigs(dffConfigs);
332 (*it)->addConfigs(xffConfigs);
334 (*it)->addConfigs(yffConfigs);
338 (*it)->addConfigs(alutConfigs);
340 (*it)->addConfigs(blutConfigs);
342 (*it)->addConfigs(clutConfigs);
344 (*it)->addConfigs(dlutConfigs);
346 (*it)->addConfigs(xlutConfigs);
348 (*it)->addConfigs(ylutConfigs);
359 while(sop < netPtr->sourcesEnd()){
361 if((*sop)->getInstancePtr().lock()->getName()==instance.
getName()){
362 string pinName = (*sop)->getPinName();
363 netPtr->removeSource(*sop);
368 string newName = instance.
getName();
379 pinPtr = * (*cb1)->getSource();
393 netPtr->addSource(instPin);
394 sop = netPtr->sourcesBegin();
403 while(sip != netPtr->sinksEnd()){
404 if((*sip)->getInstancePtr().lock()->getName()==instance.
getName()){
405 string pinName = (*sip)->getPinName();
407 netPtr->removeSink(*sip);
433 pinPtr = * (*cb1)->getSink();
446 cb1 = muxElement->connectionsBegin();
447 ce1 = muxElement->connectionsEnd();
450 string newName = instance.
getName();
455 netPtr->addSink(instPin);
462 string newName = instance.
getName();
467 netPtr->addSink(instPin);
471 sip = netPtr->sinksBegin();
485 if(
isExtraMux(setting)|| (strstr(setting.c_str() ,
"INV")!=NULL && strstr(config.
getValue().c_str(),
"_B")==NULL)){
489 string instName = instance.
getName();
490 instName = instName +
":" + setting +
":" +config.
getName();
499 string netName = instName;
515 sinkPtr = * (*cb1)->getSink();
535 sinkPtr = * (*cb1)->getSink();
547 if(netIt == newCircuit->netsEnd()){
551 newNet->addSource(instPin);
552 newCircuit->addNet(newNet);
553 netIt = newCircuit->findNet(netName);
560 (*netIt)->addSink(instPin);
575 if(instanceReferencePtr.get() != 0) {
578 ?
"[expired instance]" : instanceReference.
getInstancePtr().lock()->getName();
588 { newInst->addConfigs(static_cast<const ConfigMap&>(instance)); }
590 newCircuit->addInstance(newInst);
607 newNet->addSource(instPin);
614 newNet->addSink(instPin);
619 newNet->addConfigs(static_cast<const ConfigMap&>(net));
646 return newRoutethrough;
652 for(elemIt=primPtr->elementsBegin(); elemIt != primPtr->elementsEnd(); ++elemIt){
653 if(strstr((*elemIt)->getName().c_str(),
"USED")!=NULL){
654 primPtr->removeElement(*elemIt);
661 pch = strtok (names,
" ");
664 if(pch == (*elemIt)->getName()){
665 primPtr->removeElement(*elemIt);
668 pch = strtok (NULL,
" ");
InstancePinSharedPtrConstIterator sinksBegin(void) const
Returns the begin constant iterator for sink instance pins.
void setConfig(const string &inSetting, const Config &inConfig)
Sets the configuration for the given setting.
const WireName & getSinkWireName(void) const
Returns the instance sink wire name.
size_t getPipCount(void) const
Returns the number of pips on the net.
InstancePinSharedPtrConstIterator sourcesEnd(void) const
Returns the end constant iterator for source instance pins.
std::vector< InstanceSharedPtr > InstanceSharedPtrVector
Vector of Instance shared pointers.
static PortSharedPtr newPortPtr(const string &inName, InstanceSharedPtr inInstancePtr, const string &inPinName)
Create and return a new Port shared pointer.
PortSharedPtrConstIterator portsEnd(void) const
Returns the end constant iterator for ports.
void readPrimitives(const char *fileName)
const string & getSetting(void) const
Returns the _ROUTETHROUGH setting.
InstanceReferenceSharedPtr getInstanceReferencePtr(void) const
Returns the instance reference for this instance, if any.
ENetType getNetType(void) const
Returns the net power type. See ENetPowerType.
InstancePinSharedPtrConstIterator sinksEnd(void) const
Returns the end constant iterator for sink instance pins.
const string & getType(void) const
Returns the logic type for this instance.
PortSharedPtrVector::const_iterator PortSharedPtrConstIterator
Constant iterator to Port shared pointers.
Header for the RcFactory class.
boost::shared_ptr< Primitive > PrimitiveSharedPtr
Shared pointer encapsulation of a Primitive.
bool getConfig(const string &inSetting, Config &outConfig)
Looks up the specified setting in the map.
boost::shared_ptr< Port > PortSharedPtr
Shared pointer encapsulation of a Port.
boost::shared_ptr< Element > ElementSharedPtr
Shared pointer encapsulation of a element.
InstancePinSharedPtrVector::iterator InstancePinSharedPtrIterator
Non-constant iterator to InstancePin shared pointer objects.
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers.
static NetSharedPtr newNetPtr(const string &inName, ENetType inNetType=eNetTypeNormal)
Create and return a new Net share pointer.
Physical design connection-pin pair, suitable for specifying a net endpoint.
const string & getSite(void) const
Returns the placement site for this instance.
PortSharedPtrConstIterator portsBegin(void) const
Returns the begin constant iterator for ports.
const string & getAnchor(void) const
Returns the anchor instance name for this module.
ModuleSharedPtrVector::const_iterator ModuleSharedPtrConstIterator
Constant iterator for Module shared pointers.
const PinName & getPinName(void) const
Returns the pin name.
size_t getSinkCount(void) const
Returns the number of sinks on the net.
const ModuleWeakPtr & getModulePtr(void) const
Returns the weak module pointer.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
ModuleSharedPtrConstIterator modulesEnd(void) const
Returns the end constant iterator for modules.
InstancePinSharedPtrConstIterator sourcesBegin(void) const
Returns the begin constant iterator for source instance pins.
const InstanceWeakPtr & getInstancePtr(void) const
Returns the weak instance pointer.
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
ModuleSharedPtrConstIterator modulesBegin(void) const
Returns the begin constant iterator for modules.
boost::shared_ptr< Module > ModuleSharedPtr
Shared pointer encapsulation of a Module.
DesignSharedPtr operator()(const DesignSharedPtr &inDesignPtr)
const_iterator configBegin(void) const
Returns the begin constant iterator for configurations.
const WireName & getSinkWireName(void) const
Returns the pip sink wire.
ElementSharedPtrVector::iterator ElementSharedPtrIterator
Non-constant iterator for Element shared pointers.
Physical design instance.
Configuration. A {name:value} pair.
const string elementNames
PrimitiveSetSharedPtr primitives
NetSharedPtrConstIterator netsEnd(void) const
Returns the end constant iterator for nets.
void removeExtraElements(PrimitiveSharedPtr primPtr)
removes extra elements that are needed for unpacking
bool hasConfig(const string &inSetting) const
Returns true if the specified setting exists in the map.
RoutethroughSharedPtr getRoutethroughPtr(void) const
Returns the pip's routethrough pointer.
size_t getSourceCount(void) const
Returns the number of sources on the net.
const string & getName(void) const
Returns the object name.
static torc::physical::Pip newPip(const string &inTileName, const string &inSourceWireName, const string &inSinkWireName, EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr=RoutethroughSharedPtr())
Construct a pip and return it.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
boost::shared_ptr< Circuit > CircuitSharedPtr
Shared pointer encapsulation of a Circuit.
const WireName & getSourceWireName(void) const
Returns the instance source wire name.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
const string & getValue(void) const
Return the configuration value.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
void unpack(const Circuit &circuit, CircuitSharedPtr newCircuit)
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
InstancePinSharedPtrVector::const_iterator InstancePinSharedPtrConstIterator
Constant iterator to InstancePin shared pointer objects.
NetSharedPtrVector::iterator NetSharedPtrIterator
Non-constant iterator to Net shared pointers.
const PinName & getPinName(void) const
Returns the pin name.
const TileName & getTileName(void) const
Returns the pip tile.
EPipDirection getDirection(void) const
Returns the pip directionality.
const string & getTile(void) const
Returns the placement tile for this instance.
Physical design programmable interconnect point.
const WireName & getSourceWireName(void) const
Returns the pip source wire.
boost::shared_ptr< Routethrough > RoutethroughSharedPtr
Shared pointer encapsulation of a Routethrough.
static RoutethroughSharedPtr newRoutethroughPtr(const string &inSetting, const string &inName, const string &inValue, const InstanceWeakPtr &inInstancePtr, const string &inSourceWireName, const string &inSinkWireName)
Construct and return a new Routethrough shared pointer.
ConnectionSharedPtrVector::iterator ConnectionSharedPtrIterator
Configuration setting map.
const string & getXdlVersion(void) const
Returns the XDL version for this design.
bool configIsEmpty(void) const
Returns true if the configuration map is empty.
PrimitiveSharedPtrVector::iterator PrimitiveSharedPtrIterator
Non-constant iterator for Primitive shared pointers.
static InstancePinSharedPtr newInstancePinPtr(InstanceSharedPtr inInstancePtr, const string &inPinName)
Construct and return a new InstancePin shared pointer.
const string & getElementName(void) const
Returns the element pointer or NULL.
static ModuleSharedPtr newModulePtr(const string &inName, const string &inAnchor)
Create and return a new Module shared pointer.
Module input or output port.
boost::shared_ptr< PrimitivePin > PrimitivePinSharedPtr
Shared pointer encapsulation of a componenet.
static DesignSharedPtr newDesignPtr(const string &inName, const string &inDevice, const string &inPackage, const string &inSpeedGrade, const string &inXdlVersion)
Create and return a new Design shared pointer.
const InstanceWeakPtr & getInstancePtr(void) const
Returns a weak instance pointer.
const string & getDevice(void) const
Returns the target device for this design.
Instantiation of a module instance.
EInstanceBonding getBonding(void) const
Returns the IO bonding for this instance.
Circuit composed of instances and nets.
const_iterator configEnd(void) const
Returns the end constant iterator for configurations.
InstanceSharedPtrConstIterator instancesBegin(void) const
Returns the begin constant iterator for instances.
boost::shared_ptr< InstanceReference > InstanceReferenceSharedPtr
Shared pointer encapsulation of an InstanceReference.
EPinDirection
Enumeration of instance pin directionality.
bool isExtraMux(string elem)
NetSharedPtrVector::const_iterator NetSharedPtrConstIterator
Constant iterator to Net shared pointers.
bool isRoutethrough(void) const
Indicates whether or not the pip has an associated routethrough.
InstanceSharedPtrVector::iterator InstanceSharedPtrIterator
Non-constant iterator to Instance shared pointers.
static InstanceReferenceSharedPtr newInstanceReferencePtr(const string &inInstantiationName, ModuleSharedPtr inModulePtr, InstanceSharedPtr inInstancePtr)
Create and return a new InstanceReference shared pointer.
NetSharedPtrConstIterator netsBegin(void) const
Returns the begin constant iterator for nets.
const InstanceWeakPtr & getInstancePtr(void) const
Returns the instance weak pointer.
InstanceSharedPtrConstIterator instancesEnd(void) const
Returns the end constant iterator for instances.