@@ -168,7 +168,9 @@ struct NetlistReader {
168
168
// TODO: export this to a library function to have generic parameter decoding
169
169
if (entry.which () == LogicalNetlist::Netlist::PropertyMap::Entry::TEXT_VALUE) {
170
170
const std::regex vhex_regex (" [0-9]+'h([0-9A-Z]+)" );
171
- const std::regex vbit_regex (" [0-9]+'b([0-9A-Z]+)" );
171
+ const std::regex vbit_regex (" [0-9]+'b([0-9]+)" );
172
+ const std::regex chex_regex (" 0x([0-9A-Za-z]+)" );
173
+ const std::regex cbit_regex (" 0b([0-9]+)" );
172
174
const std::regex bit_regex (" [0-1]+" );
173
175
std::string init_str = str_list[entry.getTextValue ()];
174
176
std::smatch regex_matches;
@@ -180,9 +182,18 @@ struct NetlistReader {
180
182
for (int bit = 3 ; bit >= 0 ; bit--)
181
183
init.push_back ((value >> bit) & 1 );
182
184
}
185
+ else if (std::regex_match (init_str, regex_matches, chex_regex))
186
+ for (const char & c : regex_matches[1 ].str ()) {
187
+ int value = std::stoi (std::string (1 , c), 0 , 16 );
188
+ for (int bit = 3 ; bit >= 0 ; bit--)
189
+ init.push_back ((value >> bit) & 1 );
190
+ }
183
191
else if (std::regex_match (init_str, regex_matches, vbit_regex))
184
192
for (const char & c : regex_matches[1 ].str ())
185
193
init.push_back ((bool )std::stoi (std::string (1 , c), 0 , 2 ));
194
+ else if (std::regex_match (init_str, regex_matches, cbit_regex))
195
+ for (const char & c : regex_matches[1 ].str ())
196
+ init.push_back ((bool )std::stoi (std::string (1 , c), 0 , 2 ));
186
197
else if (std::regex_match (init_str, regex_matches, bit_regex))
187
198
for (const char & c : init_str)
188
199
init.push_back ((bool )std::stoi (std::string (1 , c), 0 , 2 ));
@@ -260,6 +271,9 @@ struct NetlistReader {
260
271
261
272
int inum = 0 ;
262
273
for (auto port : cell_lib.getPorts ()) {
274
+ if (port_net_map.find (port) == port_net_map.end ())
275
+ continue ;
276
+
263
277
auto net_name = port_net_map.at (port);
264
278
AtomNetId net_id = main_netlist_.create_net (net_name);
265
279
0 commit comments