00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_PACKER_XDLUNPACK_HPP
00017 #define TORC_PACKER_XDLUNPACK_HPP
00018
00019 #include "torc/physical/Design.hpp"
00020 #include "torc/physical/Factory.hpp"
00021 #include "ParsePrimitive.hpp"
00022 #include "WritePrimitive.hpp"
00023
00024 #include <boost/smart_ptr.hpp>
00025 #include <iostream>
00026 #include <string>
00027
00028 namespace torc {
00029 namespace physical {
00030
00031
00032 const string elementNames = "SRUSED REVUSED PRECYINIT DUSED CUSED COUTUSED CEUSED BUSED AUSED DCY0 CCY0 BCY0 ACY0 END";
00033
00034
00035 const string extraMuxNames = "CY0G CY0F GYMUX DYMUX FXMUX DXMUX CYINIT DIG_MUX DIF_MUX XBMUX DOUTMUX COUTMUX BOUTMUX AOUTMUX DFFMUX CFFMUX BFFMUX AFFMUX ACY0 BCY0 CCY0 DCY0 PRECYINIT CDI1MUX BDI1MUX ADI1MUX WEMUX TMUX OMUX IDELMUX D2OBYP_SEL IFFDELMUX IFFMUX END";
00036
00037
00038 const string extraInvNames = "CLKINV T1INV T2INV D1INV D2INV END";
00039
00040 class XdlUnpack {
00041
00042 public:
00043
00044 DesignSharedPtr operator() (const DesignSharedPtr& inDesignPtr);
00045 void unpack(const Circuit& circuit, CircuitSharedPtr newCircuit);
00046 DesignSharedPtr unpack(const Design& design);
00047 ModuleSharedPtr unpack(const Module& module);
00048 PortSharedPtr unpack(const Port& port);
00049 void unpack(Instance& instance, CircuitSharedPtr newCircuit);
00050 NetSharedPtr unpack(const Net& net);
00051 InstancePinSharedPtr unpack(const InstancePinSharedPtr instancePin, EPinDirection pinDirection, bool comma);
00052 Pip unpack(const Pip& pip, bool comma);
00053 RoutethroughSharedPtr unpack(const Routethrough& routethrough);
00054
00055
00056 void removeExtraElements(PrimitiveSharedPtr primPtr);
00057
00058
00059 void readPrimitives(const char *fileName) {
00060 ParsePrimitive parser;
00061 primitives = parser.ParsePrimitiveFile(fileName);
00062 return;
00063 }
00064
00065
00066 bool isExtraMux(string elem){
00067 char names[1024] ;
00068 strcpy(names,extraMuxNames.c_str());
00069 string pch;
00070 pch = strtok (names," ");
00071 while (pch!="END")
00072 {
00073 if(pch == elem){
00074 return true;
00075 }
00076 pch = strtok (NULL," ");
00077 }
00078 return false;
00079 }
00080
00081 protected:
00082 typedef boost::shared_ptr<torc::physical::Named> NamedSharedPtr;
00083 typedef boost::shared_ptr<torc::physical::ConfigMap> ConfigMapSharedPtr;
00084
00085 PrimitiveSetSharedPtr primitives;
00086
00087 };
00088
00089 }
00090 }
00091
00092 #endif // TORC_PACKER_XDLUNPACK_HPP