12 using namespace bil::xdlrcparser_detail;
15 void XDLRCParserImp::parse2ndTiles()
20 if (!m_tok->uintToken(rows))
throw Exception();
25 if (!m_tok->uintToken(cols))
throw Exception();
33 if (
')' == m_tok->separatorToken())
return;
34 if (
'(' != m_tok->separatorToken())
throw Exception();
46 void XDLRCParserImp::parse2ndTile()
49 m_tile = &(m_tiles->at(m_tileIndex));
50 m_sites = &(m_tile->primitiveSites());
52 m_tileType = &(m_tileTypes->at(m_tile->typeIndex()));
53 m_tileTypeEx = &(m_tileTypesEx.at(m_tile->typeIndex()));
55 m_siteTypes = &(m_tileType->siteTypes());
56 m_wires = &(m_tileType->wires());
57 m_wireMap = &(m_tileTypeEx->wireMap);
62 if (!m_tok->uintToken(pos))
throw Exception();
63 if (m_tile->row() != pos)
throw Exception();
67 if (!m_tok->uintToken(pos))
throw Exception();
68 if (m_tile->column() != pos)
throw Exception();
72 if ((m_tile->name()).compare(m_tok->wordToken()) != 0)
throw Exception();
76 if ((m_tileType->name()).compare(m_tok->wordToken()) != 0)
throw Exception();
81 if (!m_tok->uintToken(count))
throw Exception();
84 m_primitiveSiteIndex = 0;
89 if (
')' == m_tok->separatorToken())
return;
90 if (
'(' != m_tok->separatorToken())
throw Exception();
96 if (m_tileTypeEx->writeSiteTypes) parse2ndPrimitiveSite();
97 else parse2ndPrimitiveSiteSkip();
99 ++m_primitiveSiteIndex;
102 m_tileTypeEx->writeSiteTypes =
false;
113 if (
')' == m_tok->separatorToken())
return;
114 if (
'(' != m_tok->separatorToken())
throw Exception();
129 if (
')' == m_tok->separatorToken())
return;
130 if (
'(' != m_tok->separatorToken())
throw Exception();
143 if (
')' != m_tok->separatorToken())
throw Exception();
147 void XDLRCParserImp::parse2ndPrimitiveSite()
154 if ((site.
name()).compare(m_tok->wordToken()) != 0)
throw Exception();
158 size_t primitiveTypeIndex = findPrimitiveType(m_tok->wordToken());
160 m_primitiveType = &(m_primitiveTypes->at(primitiveTypeIndex));
161 m_pins = &(m_primitiveType->pins());
162 m_pinMap = &(m_pinMaps.at(m_primitiveType->tag()));
166 const char* s = m_tok->wordToken();
175 size_t siteTypeCount = m_siteTypes->size();
177 m_siteType = &((*m_siteTypes)[siteTypeCount]);
179 m_siteType->primitiveTypeIndex(static_cast<unsigned short>(primitiveTypeIndex));
181 m_pinWires = &(m_siteType->pinWires());
186 if (!m_tok->uintToken(count))
throw Exception();
187 m_pinWires->reserve(count);
195 if (
')' == m_tok->separatorToken())
return;
196 if (
'(' != m_tok->separatorToken())
throw Exception();
204 size_t pinIndex = findPin(m_tok->wordToken());
205 m_pin = &(m_pins->at(pinIndex));
209 s = m_tok->wordToken();
214 if (m_pin->isInput() != inputFlag)
throw Exception();
218 size_t wireIndex = findWire(m_tok->wordToken(), *m_wireMap);
221 pinWire.
pinIndex(static_cast<unsigned short>(pinIndex));
222 pinWire.
wireIndex(static_cast<unsigned short>(wireIndex));
223 m_pinWires->push_back(pinWire);
227 if (
')' != m_tok->separatorToken())
throw Exception();
232 void XDLRCParserImp::parse2ndPrimitiveSiteSkip()
242 const char* s = m_tok->wordToken();
251 if (!m_tok->uintToken(count))
throw Exception();
258 if (
')' == m_tok->separatorToken())
return;
259 if (
'(' != m_tok->separatorToken())
throw Exception();
270 s = m_tok->wordToken();
280 if (
')' != m_tok->separatorToken())
throw Exception();
285 void XDLRCParserImp::parse2ndWire()
289 size_t wireIndex = findWire(m_tok->wordToken(), *m_wireMap);
290 Wire& wire = m_wires->at(wireIndex);
291 m_connections = &(wire.connections());
296 if (!m_tok->uintToken(count))
throw Exception();
297 m_connections->reserve(count);
305 if (
')' == m_tok->separatorToken())
return;
306 if (
'(' != m_tok->separatorToken())
throw Exception();
314 size_t tileIndex = findTile(m_tok->wordToken());
315 Tile& tile = m_tiles->at(tileIndex);
318 connection.
xOffset(tile.siteX() - (m_tile->siteX()));
319 connection.
yOffset(tile.siteY() - (m_tile->siteY()));
320 connection.
tileTypeIndex(static_cast<unsigned short>(tileTypeIndex));
323 TileTypeEx& tileTypeEx = m_tileTypesEx.at(tileTypeIndex);
326 wireIndex = findWire(m_tok->wordToken(), tileTypeEx.
wireMap);
328 connection.
wireIndex(static_cast<unsigned short>(wireIndex));
331 addConnection(connection);
335 if (
')' != m_tok->separatorToken())
throw Exception();
340 void XDLRCParserImp::parse2ndPIP()
349 m_tok->wordChar(
'=');
350 m_tok->wordChar(
'>');
353 m_tok->separatorChar(
'=');
354 m_tok->separatorChar(
'>');
361 if (
')' == m_tok->separatorToken())
return;
362 if (
'(' != m_tok->separatorToken())
throw Exception();
370 if (
')' != m_tok->separatorToken())
throw Exception();
373 if (
')' != m_tok->separatorToken())
throw Exception();