mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-18 20:03:39 +00:00
Merge branch 'read_aiger' of https://github.com/eddiehung/yosys into read_aiger
This commit is contained in:
commit
d3ba1f9719
2 changed files with 12 additions and 13 deletions
1
Makefile
1
Makefile
|
@ -580,6 +580,7 @@ test: $(TARGETS) $(EXTRA_TARGETS)
|
||||||
+cd tests/sat && bash run-test.sh
|
+cd tests/sat && bash run-test.sh
|
||||||
+cd tests/svinterfaces && bash run-test.sh $(SEEDOPT)
|
+cd tests/svinterfaces && bash run-test.sh $(SEEDOPT)
|
||||||
+cd tests/opt && bash run-test.sh
|
+cd tests/opt && bash run-test.sh
|
||||||
|
+cd tests/aiger && bash run-test.sh
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " Passed \"make test\"."
|
@echo " Passed \"make test\"."
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
// Armin Biere. The AIGER And-Inverter Graph (AIG) Format Version 20071012. Technical Report 07/1, October 2011, FMV Reports Series, Institute for Formal Models and Verification, Johannes Kepler University, Altenbergerstr. 69, 4040 Linz, Austria.
|
// Armin Biere. The AIGER And-Inverter Graph (AIG) Format Version 20071012. Technical Report 07/1, October 2011, FMV Reports Series, Institute for Formal Models and Verification, Johannes Kepler University, Altenbergerstr. 69, 4040 Linz, Austria.
|
||||||
// http://fmv.jku.at/papers/Biere-FMV-TR-07-1.pdf
|
// http://fmv.jku.at/papers/Biere-FMV-TR-07-1.pdf
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <libgen.h>
|
||||||
|
#endif
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "kernel/yosys.h"
|
#include "kernel/yosys.h"
|
||||||
#include "kernel/sigtools.h"
|
#include "kernel/sigtools.h"
|
||||||
#include "aigerparse.h"
|
#include "aigerparse.h"
|
||||||
|
@ -102,7 +107,6 @@ void AigerReader::parse_aiger()
|
||||||
if (f.peek() == '\n')
|
if (f.peek() == '\n')
|
||||||
break;
|
break;
|
||||||
// Else constraint (TODO)
|
// Else constraint (TODO)
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_error("Line %u: cannot interpret first character '%c'!\n", line_count, c);
|
log_error("Line %u: cannot interpret first character '%c'!\n", line_count, c);
|
||||||
|
@ -134,9 +138,7 @@ static RTLIL::Wire* createWireIfNotExists(RTLIL::Module *module, unsigned litera
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("Creating %s = ~%s\n", wire_name.c_str(), wire_inv_name.c_str());
|
log_debug("Creating %s = ~%s\n", wire_name.c_str(), wire_inv_name.c_str());
|
||||||
RTLIL::Cell *inv = module->addCell(stringf("\\n%d_not", variable), "$_NOT_"); // FIXME: is "_not" the right suffix?
|
module->addNotGate(stringf("\\n%d_not", variable), wire_inv, wire); // FIXME: is "_not" the right suffix?
|
||||||
inv->setPort("\\A", wire_inv);
|
|
||||||
inv->setPort("\\Y", wire);
|
|
||||||
|
|
||||||
return wire;
|
return wire;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,7 @@ void AigerReader::parse_aiger_ascii()
|
||||||
std::getline(f, line); // Ignore up to start of next line
|
std::getline(f, line); // Ignore up to start of next line
|
||||||
|
|
||||||
// Parse AND
|
// Parse AND
|
||||||
for (unsigned i = 0; i < A; ++i, ++line_count) {
|
for (unsigned i = 0; i < A; ++i) {
|
||||||
if (!(f >> l1 >> l2 >> l3))
|
if (!(f >> l1 >> l2 >> l3))
|
||||||
log_error("Line %u cannot be interpreted as an AND!\n", line_count);
|
log_error("Line %u cannot be interpreted as an AND!\n", line_count);
|
||||||
|
|
||||||
|
@ -236,11 +238,7 @@ void AigerReader::parse_aiger_ascii()
|
||||||
RTLIL::Wire *o_wire = createWireIfNotExists(module, l1);
|
RTLIL::Wire *o_wire = createWireIfNotExists(module, l1);
|
||||||
RTLIL::Wire *i1_wire = createWireIfNotExists(module, l2);
|
RTLIL::Wire *i1_wire = createWireIfNotExists(module, l2);
|
||||||
RTLIL::Wire *i2_wire = createWireIfNotExists(module, l3);
|
RTLIL::Wire *i2_wire = createWireIfNotExists(module, l3);
|
||||||
|
module->addAndGate(NEW_ID, i1_wire, i2_wire, o_wire);
|
||||||
RTLIL::Cell *and_cell = module->addCell(NEW_ID, "$_AND_");
|
|
||||||
and_cell->setPort("\\A", i1_wire);
|
|
||||||
and_cell->setPort("\\B", i2_wire);
|
|
||||||
and_cell->setPort("\\Y", o_wire);
|
|
||||||
}
|
}
|
||||||
std::getline(f, line); // Ignore up to start of next line
|
std::getline(f, line); // Ignore up to start of next line
|
||||||
}
|
}
|
||||||
|
@ -350,8 +348,6 @@ void AigerReader::parse_aiger_binary()
|
||||||
and_cell->setPort("\\B", i2_wire);
|
and_cell->setPort("\\B", i2_wire);
|
||||||
and_cell->setPort("\\Y", o_wire);
|
and_cell->setPort("\\Y", o_wire);
|
||||||
}
|
}
|
||||||
std::getline(f, line); // Ignore up to start of next line
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AigerFrontend : public Frontend {
|
struct AigerFrontend : public Frontend {
|
||||||
|
@ -404,7 +400,9 @@ struct AigerFrontend : public Frontend {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
module_name = "top"; // FIXME: basename equivalent on Win32?
|
module_name = "top"; // FIXME: basename equivalent on Win32?
|
||||||
#else
|
#else
|
||||||
module_name = RTLIL::escape_id(basename(filename.c_str()));
|
char* bn = strdup(filename.c_str());
|
||||||
|
module_name = RTLIL::escape_id(bn);
|
||||||
|
free(bn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue