From b35aed04b4e75c20c9fe8db400e5b85555ae143d Mon Sep 17 00:00:00 2001 From: yu-lin-chen Date: Tue, 7 Jul 2026 15:15:30 +0800 Subject: [PATCH] fix: the bug of genlib_reader parser --- include/mockturtle/io/genlib_reader.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/mockturtle/io/genlib_reader.hpp b/include/mockturtle/io/genlib_reader.hpp index 1a3faaea1..6a3d08b63 100644 --- a/include/mockturtle/io/genlib_reader.hpp +++ b/include/mockturtle/io/genlib_reader.hpp @@ -148,6 +148,14 @@ class genlib_reader : public lorina::genlib_reader formula.erase( found, found + 5 ); } + /* detect constant gates (e.g., Z=1, Z=0, O=CONST0, O=CONST1) and + discard spurious pin names produced by tokenization of "0"/"1" */ + if ( formula == "0" || formula == "1" ) + { + pp.clear(); + pin_names.clear(); + } + uint32_t num_vars = pin_names.size(); kitty::dynamic_truth_table tt{ num_vars };