114 if((instance.getType()==
"SLICEL")||(instance.getType()==
"SLICEM")){
117 ConfigMap instanceConfigs;
118 ConfigMap affConfigs, bffConfigs, cffConfigs, dffConfigs,xffConfigs,yffConfigs;
119 ConfigMap alutConfigs, blutConfigs, clutConfigs, dlutConfigs,xlutConfigs,ylutConfigs;
127 if(instanceReferencePtr.get() != 0) {
128 const InstanceReference& instanceReference = *instanceReferencePtr;
129 std::string instanceName = instanceReference.getInstancePtr().expired()
130 ?
"[expired instance]" : instanceReference.getInstancePtr().lock()->getName();
132 instanceName, instanceReference.getModulePtr().lock(), instanceReference.getInstancePtr().lock());
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") ){
188 affConfigs.setConfig(setting,config);
192 else if( ( setting ==
"BFFSR") ||
193 (setting ==
"BFFINIT") ){
194 bffConfigs.setConfig(setting,config);
198 else if( ( setting ==
"CFFSR") ||
199 (setting ==
"CFFINIT") ){
200 cffConfigs.setConfig(setting,config);
204 else if( ( setting ==
"DFFSR") ||
205 (setting ==
"DFFINIT") ){
206 dffConfigs.setConfig(setting,config);
210 else if( ( setting ==
"FFY_INIT_ATTR") ||
211 (setting ==
"FFY_SR_ATTR") ){
212 yffConfigs.setConfig(setting,config);
216 else if( ( setting ==
"FFX_INIT_ATTR") ||
217 (setting ==
"FFX_SR_ATTR") ){
218 xffConfigs.setConfig(setting,config);
222 else if(setting ==
"A6RAMMODE"){
223 alutConfigs.setConfig(setting,config);
227 else if(setting ==
"B6RAMMODE"){
228 blutConfigs.setConfig(setting,config);
232 else if(setting ==
"C6RAMMODE"){
233 clutConfigs.setConfig(setting,config);
237 else if(setting ==
"D6RAMMODE"){
238 dlutConfigs.setConfig(setting,config);
242 else if(setting ==
"D6RAMMODE"){
243 dlutConfigs.setConfig(setting,config);
247 else if(setting ==
"F_ATTR"){
248 xlutConfigs.setConfig(setting,config);
252 else if(setting ==
"G_ATTR"){
253 ylutConfigs.setConfig(setting,config);
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){
267 affConfigs.setConfig(setting,config);
268 bffConfigs.setConfig(setting,config);
269 cffConfigs.setConfig(setting,config);
270 dffConfigs.setConfig(setting,config);
271 xffConfigs.setConfig(setting,config);
272 yffConfigs.setConfig(setting,config);
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);
367 ConnectionPin pinPtr = * (*cb)->getSource();
368 string newName = instance.getName();
370 instanceConfigs.getConfig(pinPtr.getElementName(), config);
373 ElementSharedPtr muxElement = *primitivePtr->findElement(pinPtr.getElementName());
377 ConnectionPin pinPtr1 = * (*cb1)->getSink();
378 if(pinPtr1.getPinName()== config.getValue()){
379 pinPtr = * (*cb1)->getSource();
380 instanceConfigs.getConfig(pinPtr.getElementName(),config);
386 if(!instanceConfigs.hasConfig(pinPtr.getElementName())){
390 newName = newName +
":" + pinPtr.getElementName()+
":" +config.getName();
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);
413 ConnectionPin pinPtr = * (*cb)->getSink();
414 if(!instanceConfigs.hasConfig(pinPtr.getElementName())){
420 instanceConfigs.getConfig(pinPtr.getElementName(),config);
421 if(
isExtraMux(pinPtr.getElementName()) || (strstr(pinPtr.getElementName().c_str() ,
"INV")!=NULL && strstr(config.getValue().c_str(),
"_B")==NULL)){
423 if(config.getValue() != pinPtr.getPinName()){
427 ElementSharedPtr muxElement = *primitivePtr->findElement(pinPtr.getElementName());
431 ConnectionPin pinPtr1 = * (*cb1)->getSource();
432 if(pinPtr1.getElementName()== muxElement->getName()){
433 pinPtr = * (*cb1)->getSink();
434 if(!instanceConfigs.getConfig(pinPtr.getElementName(),config)){
439 if(
isExtraMux(pinPtr.getElementName()) || (strstr(pinPtr.getElementName().c_str() ,
"INV")!=NULL && strstr(config.getValue().c_str(),
"_B")==NULL)){
441 if(config.getValue() != pinPtr.getPinName()){
445 muxElement = *primitivePtr->findElement(pinPtr.getElementName());
446 cb1 = muxElement->connectionsBegin();
447 ce1 = muxElement->connectionsEnd();
450 string newName = instance.getName();
451 newName = newName +
":" + pinPtr.getElementName() +
":" + config.getName();
455 netPtr->addSink(instPin);
462 string newName = instance.getName();
463 newName = newName +
":" + pinPtr.getElementName() +
":" + config.getName();
467 netPtr->addSink(instPin);
471 sip = netPtr->sinksBegin();
480 p = instanceConfigs.configBegin();
481 e = instanceConfigs.configEnd();
484 Config config=p->second;
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();
496 ConnectionPin srcPtr = * (*cb)->getSource();
497 ConnectionPin sinkPtr = * (*cb)->getSink();
498 if(srcPtr.getElementName() == elemPtr->getName()){
499 string netName = instName;
500 netName +=
":" + srcPtr.getPinName();
501 if(instanceConfigs.hasConfig(sinkPtr.getElementName())){
504 instanceConfigs.getConfig(sinkPtr.getElementName(),config);
505 if(config.getValue() != sinkPtr.getPinName()){
509 ElementSharedPtr muxElement = *primitivePtr->findElement(sinkPtr.getElementName());
513 ConnectionPin pinPtr1 = * (*cb1)->getSource();
514 if(pinPtr1.getElementName()== muxElement->getName()){
515 sinkPtr = * (*cb1)->getSink();
516 instanceConfigs.getConfig(sinkPtr.getElementName(),config);
524 instanceConfigs.getConfig(sinkPtr.getElementName(),config);
525 if(config.getValue() != sinkPtr.getPinName()){
529 ElementSharedPtr muxElement = *primitivePtr->findElement(sinkPtr.getElementName());
533 ConnectionPin pinPtr1 = * (*cb1)->getSource();
534 if(pinPtr1.getElementName()== muxElement->getName()){
535 sinkPtr = * (*cb1)->getSink();
536 instanceConfigs.getConfig(sinkPtr.getElementName(),config);
542 if(!instanceConfigs.hasConfig(sinkPtr.getElementName())){
547 if(netIt == newCircuit->netsEnd()){
551 newNet->addSource(instPin);
552 newCircuit->addNet(newNet);
553 netIt = newCircuit->findNet(netName);
556 instanceConfigs.getConfig(sinkPtr.getElementName(),config);
557 string sinkInstName = instance.getName()+
":"+sinkPtr.getElementName()+
":"+config.getName();
560 (*netIt)->addSink(instPin);
575 if(instanceReferencePtr.get() != 0) {
576 const InstanceReference& instanceReference = *instanceReferencePtr;
577 std::string instanceName = instanceReference.getInstancePtr().expired()
578 ?
"[expired instance]" : instanceReference.getInstancePtr().lock()->getName();
580 instanceName, instanceReference.getModulePtr().lock(), instanceReference.getInstancePtr().lock());
583 typeName = instance.getType();
586 instance.getSite(), instance.getBonding(), newInstanceReferencePtr);
587 if(!instance.configIsEmpty())
588 { newInst->addConfigs(static_cast<const ConfigMap&>(instance)); }
590 newCircuit->addInstance(newInst);
std::vector< InstanceSharedPtr > InstanceSharedPtrVector
Vector of Instance shared pointers.
boost::shared_ptr< Primitive > PrimitiveSharedPtr
Shared pointer encapsulation of a Primitive.
boost::shared_ptr< Element > ElementSharedPtr
Shared pointer encapsulation of a element.
InstancePinSharedPtrVector::iterator InstancePinSharedPtrIterator
Non-constant iterator to InstancePin shared pointer objects.
static NetSharedPtr newNetPtr(const string &inName, ENetType inNetType=eNetTypeNormal)
Create and return a new Net share pointer.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
ElementSharedPtrVector::iterator ElementSharedPtrIterator
Non-constant iterator for Element shared pointers.
PrimitiveSetSharedPtr primitives
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
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.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
NetSharedPtrVector::iterator NetSharedPtrIterator
Non-constant iterator to Net shared pointers.
ConnectionSharedPtrVector::iterator ConnectionSharedPtrIterator
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.
boost::shared_ptr< PrimitivePin > PrimitivePinSharedPtr
Shared pointer encapsulation of a componenet.
boost::shared_ptr< InstanceReference > InstanceReferenceSharedPtr
Shared pointer encapsulation of an InstanceReference.
bool isExtraMux(string elem)
NetSharedPtrVector::const_iterator NetSharedPtrConstIterator
Constant iterator to Net shared pointers.
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.