Comments (4)
Thank you for your question.
A failing test case or a complete example with expected and actual output would be helpful.
I tried to translate your question in some example code:
struct test_reader : public aiger_reader
{
explicit test_reader() {}
void on_input( uint32_t pos, uint32_t literal ) const override
{
fmt::print( "[i] on_input: pos = {}, index = {}, literal = {}\n",
pos, literal/2, literal );
inputs.emplace_back( std::make_tuple( pos, literal ) );
}
void on_input_name( uint32_t pos, std::string const& name ) const override
{
fmt::print( "[i] on_input_name: pos = {}, name = \"{}\"\n", pos, name );
input_names.emplace( pos, name );
}
mutable std::vector<std::tuple<uint32_t, uint32_t>> inputs;
mutable std::map<uint32_t, std::string> input_names;
}; /* test_reader */
std::string aiger_file{
"aag 38 4 0 0 0\n"
"12\n"
"10\n"
"76\n"
"72\n"
"i0 symbol_of_12\n"
"i1 symbol_of_10\n"
"i2 symbol_of_76\n"
"i3 symbol_of_72\n"};
std::istringstream iss( aiger_file );
test_reader reader;
auto const result = read_ascii_aiger( iss, reader );
assert( result == return_code::success );
for ( const auto& inputs : reader.inputs )
{
fmt::print( "i{} {} with name \"{}\"\n",
std::get<0>( inputs ), std::get<1>( inputs ),
reader.input_names[std::get<0>( inputs )] );
}
The example produces the following output on my system:
[i] on_input: pos = 0, index = 6, literal = 12
[i] on_input: pos = 1, index = 5, literal = 10
[i] on_input: pos = 2, index = 38, literal = 76
[i] on_input: pos = 3, index = 36, literal = 72
[i] on_input_name: pos = 0, name = "symbol_of_12"
[i] on_input_name: pos = 1, name = "symbol_of_10"
[i] on_input_name: pos = 2, name = "symbol_of_76"
[i] on_input_name: pos = 3, name = "symbol_of_72"
i0 12 with name "symbol_of_12"
i1 10 with name "symbol_of_10"
i2 76 with name "symbol_of_76"
i3 72 with name "symbol_of_72"
What output would you expect instead?
from lorina.
Thanks for the explanation. I think I understand the source of my confusion:
-
I had interpreted "index" in
on_input_name
to refer to variable index, but from your example it's actually position. On reinspection it looks like lorina uses "literal" to refer to variable indexes. -
I was reading in my AIG via Mockturtle. I think Mockturtle's
aiger_reader
inheritor incorrectly does not overrideon_input
. It looks to me like it assumes the inputs come linearly in order starting from 1 (the insertion loop inon_header
). Do you agree? If so, I can file an issue over there instead.
from lorina.
- Yes, the name
index
is misleading in lorina's reader visitor. I will change it toposition
. Thank you for pointing this out. - mockturtle's AIGER reader is designed for the binary AIGER format, which is more restricted than the ASCII format. These restrictions allow storing the benchmarks more compactly. One simplifying assumption is that the inputs are always 1, ...,
I
, such that they do not need to be stored in the benchmark at all but can be immediately extracted from theM I L O A
header.
You could try to use the AIGER tools to convert your benchmark from ASCII to binary AIGER. Mockturtle should then be able to read it.
from lorina.
Sorry I had both an AIG and AAG version of this file and neglected to notice that I was passing the AIG to mockturtle, but quoting from the AAG here. I think you're correct that there's no issue here. Sorry for the noise and thanks for clearing up my confusion.
from lorina.
Related Issues (11)
- Add <vector> to files HOT 1
- operator== on truth tables? HOT 3
- Integration with the conan package manager HOT 4
- Compile error in clang 6.0.0 HOT 2
- Wrong include filename HOT 1
- verilog to aig HOT 2
- Bench File Reading Error HOT 4
- [Verilog] Multi-output module instances are instantiated multiple times HOT 1
- Getting parse errors when reading Verilog files using Lorina Verilog reader HOT 2
- CMake stepup for installation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lorina.