13 using namespace bil::xdlrcparser_detail;
16 void XDLRCParserImp::clearAll()
19 m_secondPassEnabled =
false;
23 m_tileTypeMap.clear();
24 m_tileTypesEx.clear();
25 m_primitiveTypeMap.clear();
38 void XDLRCParserImp::resetTempPointers()
61 void XDLRCParserImp::setupSyntax()
64 m_tok->commentChar(
'#');
65 m_tok->whitespaceChar(
' ');
66 m_tok->whitespaceChar(
'\t');
67 m_tok->whitespaceChar(
'\n');
68 m_tok->whitespaceChar(
'\r');
69 m_tok->wordChars(
'a',
'z');
70 m_tok->wordChars(
'A',
'Z');
71 m_tok->wordChars(
'0',
'9');
78 void XDLRCParserImp::addTile(
const char* tileName)
81 tileMap_t::iterator lb = m_tileMap.lower_bound(tileName);
82 if ((m_tileMap.end() != lb) && (tileName == lb->first))
throw Exception();
85 size_t count = m_tiles->size();
86 m_tiles->push_back(
Tile());
87 m_tile = &((*m_tiles)[count]);
88 (m_tile->name()).assign(tileName);
89 m_sites = &(m_tile->primitiveSites());
92 m_tileMap.insert(lb, std::make_pair(tileName, count));
96 void XDLRCParserImp::addTileType(
const char* typeName)
99 tileTypeMap_t::iterator lb = m_tileTypeMap.lower_bound(typeName);
100 if ((m_tileTypeMap.end() == lb) || (typeName != lb->first))
103 size_t count = m_tileTypes->size();
105 m_tileType = &((*m_tileTypes)[count]);
107 (m_tileType->name()).assign(typeName);
108 m_tileType->tag(count);
112 m_tileTypeEx = &(m_tileTypesEx[count]);
113 m_tileTypeEx->writeSiteTypes =
true;
116 tileTypeMap_t::iterator it =
117 m_tileTypeMap.insert(lb, std::make_pair(typeName, count));
122 size_t tileTypeIndex = lb->second;
124 m_tileType = &((*m_tileTypes)[tileTypeIndex]);
125 m_tileTypeEx = &(m_tileTypesEx[tileTypeIndex]);
129 m_wires = &(m_tileType->wires());
130 m_pips = &(m_tileType->pips());
132 m_wireMap = &(m_tileTypeEx->wireMap);
133 m_pipSet = &(m_tileTypeEx->pipSet);
137 void XDLRCParserImp::addWire(
const char* wireName)
140 wireMap_t::iterator lb = m_wireMap->lower_bound(wireName);
141 if ((m_wireMap->end() != lb) && (wireName == lb->first))
return;
144 size_t count = m_wires->size();
145 m_wires->push_back(
Wire());
146 Wire& wire = (*m_wires)[count];
147 (wire.
name()).assign(wireName);
150 m_wireMap->insert(lb, std::make_pair(wireName, count));
157 WireConnections::const_iterator itBegin = m_connections->begin();
158 WireConnections::const_iterator itEnd = m_connections->end();
159 if (std::find(itBegin, itEnd, connection) == itEnd)
160 m_connections->push_back(connection);
164 void XDLRCParserImp::addPIP(
const PIP& pip)
167 pipSet_t::iterator lb = m_pipSet->lower_bound(pip);
168 if ((m_pipSet->end() != lb) && (pip == (*lb)))
return;
171 m_pips->push_back(pip);
172 m_pipSet->insert(lb, pip);
176 void XDLRCParserImp::addPrimitiveType(
const char* typeName)
179 primitiveTypeMap_t::iterator lb = m_primitiveTypeMap.lower_bound(typeName);
180 if ((m_primitiveTypeMap.end() != lb) && (typeName == lb->first))
throw Exception();
183 size_t count = m_primitiveTypes->size();
185 m_primitiveType = &((*m_primitiveTypes)[count]);
188 (m_primitiveType->name()).assign(typeName);
189 m_primitiveType->tag(count);
195 m_primitiveTypeMap.insert(lb, std::make_pair(typeName, count));
198 m_pins = &(m_primitiveType->pins());
199 m_elements = &(m_primitiveType->elements());
201 m_pinMap = &(m_pinMaps[count]);
205 void XDLRCParserImp::addPin(
const char* pinName)
208 pinMap_t::iterator lb = m_pinMap->lower_bound(pinName);
209 if ((m_pinMap->end() != lb) && (pinName == lb->first))
throw Exception();
212 size_t count = m_pins->size();
213 m_pins->push_back(
Pin());
214 m_pin = &((*m_pins)[count]);
215 (m_pin->externalName()).assign(pinName);
218 m_pinMap->insert(lb, std::make_pair(pinName, count));
222 size_t XDLRCParserImp::findTile(
const char* tileName)
225 tileMap_t::const_iterator it = m_tileMap.find(tileName);
226 if (m_tileMap.end() == it)
throw Exception();
232 size_t XDLRCParserImp::findWire(
const char* wireName,
wireMap_t& wireMap)
235 wireMap_t::const_iterator it = wireMap.find(wireName);
236 if (wireMap.end() == it)
throw Exception();
242 size_t XDLRCParserImp::findPrimitiveType(
const char* typeName)
245 primitiveTypeMap_t::const_iterator it = m_primitiveTypeMap.find(typeName);
246 if (m_primitiveTypeMap.end() == it)
throw Exception();
252 size_t XDLRCParserImp::findPin(
const char* pinName)
255 pinMap_t::const_iterator it = m_pinMap->find(pinName);
256 if (m_pinMap->end() == it)
throw Exception();