diff --git a/deps/abc/CMakeLists.txt b/deps/abc/CMakeLists.txt index 08b195ecb4f..d8fa04b9791 100644 --- a/deps/abc/CMakeLists.txt +++ b/deps/abc/CMakeLists.txt @@ -42,7 +42,7 @@ execute_process( make ${ABC_READLINE_FLAGS} ${ABC_USE_NAMESPACE_FLAGS} - ARCHFLAGS_EXE=${CMAKE_CURRENT_BINARY_DIR}/abc_arch_flags_program.exe + ABC_USE_STDINT_H=1 ABC_MAKE_NO_DEPS=1 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} diff --git a/plugins/boolean_influence/src/plugin_boolean_influence.cpp b/plugins/boolean_influence/src/plugin_boolean_influence.cpp index eb1c80d91c5..0c419d35823 100644 --- a/plugins/boolean_influence/src/plugin_boolean_influence.cpp +++ b/plugins/boolean_influence/src/plugin_boolean_influence.cpp @@ -245,7 +245,7 @@ int main(int argc, char *argv[]) { replaced_e = replaced_e.substitute(from_vec, to_vec); // translate expression into a c program - auto directory_res = utils::get_unique_temp_directory("boolean_influence/"); + auto directory_res = utils::get_unique_temp_directory("boolean_influence_"); if (directory_res.is_error()) { return ERR_APPEND(directory_res.get_error(), "unable to generate Boolean influence: could not create temporary directory"); diff --git a/plugins/edif_parser/src/edif_parser.cpp b/plugins/edif_parser/src/edif_parser.cpp index f1ae42a0b97..fd05f117e70 100644 --- a/plugins/edif_parser/src/edif_parser.cpp +++ b/plugins/edif_parser/src/edif_parser.cpp @@ -1081,6 +1081,84 @@ namespace hal } } + // process instances i.e. gates or other cells + for (const auto& instance : cell->m_instances) + { + // will later hold either module or gate, so attributes can be assigned properly + DataContainer* container = nullptr; + + // assign actual signal names to ports + std::unordered_map instance_assignments; + + // if the instance is another cell (i.e., not a gate type) of the same library, recursively instantiate it + if (const auto gate_type_it = m_gate_types.find(instance->m_cell->m_name); gate_type_it == m_gate_types.end()) + { + // expand port assignments + for (const auto& port_assignment : instance->m_cell->m_internal_port_assignments) + { + const auto& assignment = port_assignment.m_expanded_net_name; + auto port_name = port_assignment.m_port->m_name; + if (port_assignment.m_index != -1) + { + port_name += "(" + std::to_string(port_assignment.m_index) + ")"; + } + + if (const auto alias_it = signal_alias.find(assignment); alias_it != signal_alias.end()) + { + instance_assignments[port_name] = alias_it->second; + } + else + { + return ERR("could not create instance '" + instance_name + "' of type '" + instance_type + "': port assignment '" + port_name + " = " + assignment + "' is invalid"); + } + } + + if (auto res = instantiate_module(instance->m_name, instance->m_cell, module, instance_assignments); res.is_error()) + { + return ERR_APPEND(res.get_error(), + "could not create instance '" + instance_name + "' of type '" + instance_type + "': unable to create instance '" + instance->m_name + "' of type '" + + instance->m_cell->m_name + "'"); + } + else + { + container = res.get(); + } + } + // otherwise it has to be an element from the gate library + else + { + // create the new gate + instance_alias[instance->m_name] = get_unique_alias(module->get_name(), instance->m_name, m_instance_name_occurences); + + Gate* new_gate = m_netlist->create_gate(gate_type_it->second, instance_alias.at(instance->m_name)); + if (new_gate == nullptr) + { + return ERR("could not create instance '" + instance_name + "' of type '" + instance_type + "': failed to create gate '" + instance->m_name + "'"); + } + + if (!module->is_top_module()) + { + module->assign_gate(new_gate); + } + + container = new_gate; + + // if gate is of a GND or VCC gate type, mark it as such + if (m_vcc_gate_types.find(instance->m_type) != m_vcc_gate_types.end() && !new_gate->mark_vcc_gate()) + { + return ERR("could not create instance '" + instance_name + "' of type '" + instance_type + "': failed to mark '" + instance->m_name + "' of type '" + instance->m_type + + "' as GND gate"); + } + if (m_gnd_gate_types.find(instance->m_type) != m_gnd_gate_types.end() && !new_gate->mark_gnd_gate()) + { + return ERR("could not create instance '" + instance_name + "' of type '" + instance_type + "': failed to mark '" + instance->m_name + "' of type '" + instance->m_type + + "' as VCC gate"); + } + + // TODO implement rest + } + } + // TODO create instances and assign nets return ERR("not implemented"); @@ -1100,10 +1178,10 @@ namespace hal { return ERR("could not parse instance in line " + std::to_string(old_name.number) + ": renaming not yet supported"); } - else - { - log_warning("edif_parser", "renaming not yet supported, ignoring old name in line {}", old_name.number); - } + // else + // { + // log_warning("edif_parser", "renaming not yet supported, ignoring old name in line {}", old_name.number); + // } } return OK(new_name); diff --git a/plugins/hgl_parser/test/CMakeLists.txt b/plugins/hgl_parser/test/CMakeLists.txt index bfb117c79f0..557cfb9bdcb 100644 --- a/plugins/hgl_parser/test/CMakeLists.txt +++ b/plugins/hgl_parser/test/CMakeLists.txt @@ -3,7 +3,7 @@ if(BUILD_TESTS) add_executable(runTest-hgl_parser hgl_parser.cpp) - target_link_libraries(runTest-hgl_parser hgl_parser pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-hgl_parser hgl_parser gtest hal::core hal::netlist test_utils) add_test(runTest-hgl_parser ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-hgl_parser --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/hgl_writer/test/CMakeLists.txt b/plugins/hgl_writer/test/CMakeLists.txt index 92480f12b39..1a29d5f6044 100644 --- a/plugins/hgl_writer/test/CMakeLists.txt +++ b/plugins/hgl_writer/test/CMakeLists.txt @@ -5,7 +5,7 @@ if(BUILD_TESTS) add_executable(runTest-hgl_writer hgl_writer.cpp) - target_link_libraries(runTest-hgl_writer hgl_writer hgl_parser pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-hgl_writer hgl_writer hgl_parser gtest hal::core hal::netlist test_utils) add_test(runTest-hgl_writer ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-hgl_writer --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/liberty_parser/test/CMakeLists.txt b/plugins/liberty_parser/test/CMakeLists.txt index 3610b7fc187..97101fefc6e 100644 --- a/plugins/liberty_parser/test/CMakeLists.txt +++ b/plugins/liberty_parser/test/CMakeLists.txt @@ -21,7 +21,7 @@ if(BUILD_TESTS) add_executable(runTest-liberty_parser liberty_parser.cpp) - target_link_libraries(runTest-liberty_parser liberty_parser pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-liberty_parser liberty_parser gtest hal::core hal::netlist test_utils) add_test(runTest-liberty_parser ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-liberty_parser --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/netlist_preprocessing/test/CMakeLists.txt b/plugins/netlist_preprocessing/test/CMakeLists.txt index 8ce228c5bb4..bdd35c775b3 100644 --- a/plugins/netlist_preprocessing/test/CMakeLists.txt +++ b/plugins/netlist_preprocessing/test/CMakeLists.txt @@ -3,7 +3,7 @@ if(BUILD_TESTS) add_executable(runTest-netlist_preprocessing netlist_preprocessing.cpp) - target_link_libraries(runTest-netlist_preprocessing netlist_preprocessing pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-netlist_preprocessing netlist_preprocessing gtest hal::core hal::netlist test_utils) add_test(runTest-netlist_preprocessing ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-netlist_preprocessing --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/verilog_parser/test/CMakeLists.txt b/plugins/verilog_parser/test/CMakeLists.txt index ddd52c58b4a..56e6212abbb 100644 --- a/plugins/verilog_parser/test/CMakeLists.txt +++ b/plugins/verilog_parser/test/CMakeLists.txt @@ -3,7 +3,7 @@ if(BUILD_TESTS) add_executable(runTest-verilog_parser verilog_parser.cpp) - target_link_libraries(runTest-verilog_parser verilog_parser pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-verilog_parser verilog_parser gtest hal::core hal::netlist test_utils) add_test(runTest-verilog_parser ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-verilog_parser --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/verilog_writer/test/CMakeLists.txt b/plugins/verilog_writer/test/CMakeLists.txt index baf344513da..0606a7b2152 100644 --- a/plugins/verilog_writer/test/CMakeLists.txt +++ b/plugins/verilog_writer/test/CMakeLists.txt @@ -9,7 +9,7 @@ if(BUILD_TESTS AND ((PL_VERILOG_PARSER) OR BUILD_ALL_PLUGINS)) add_executable(runTest-verilog_writer verilog_writer.cpp) - target_link_libraries(runTest-verilog_writer verilog_writer verilog_parser pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-verilog_writer verilog_writer verilog_parser gtest hal::core hal::netlist test_utils) add_test(runTest-verilog_writer ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-verilog_writer --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/vhdl_parser/test/CMakeLists.txt b/plugins/vhdl_parser/test/CMakeLists.txt index c1373ada5f6..67aebfcbe20 100644 --- a/plugins/vhdl_parser/test/CMakeLists.txt +++ b/plugins/vhdl_parser/test/CMakeLists.txt @@ -3,7 +3,7 @@ if(BUILD_TESTS) add_executable(runTest-vhdl_parser vhdl_parser.cpp) - target_link_libraries(runTest-vhdl_parser vhdl_parser pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-vhdl_parser vhdl_parser gtest hal::core hal::netlist test_utils) add_test(runTest-vhdl_parser ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-vhdl_parser --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/plugins/z3_utils/test/CMakeLists.txt b/plugins/z3_utils/test/CMakeLists.txt index 4ac6382511d..22373695e89 100644 --- a/plugins/z3_utils/test/CMakeLists.txt +++ b/plugins/z3_utils/test/CMakeLists.txt @@ -3,7 +3,7 @@ if(BUILD_TESTS) add_executable(runTest-z3_utils z3_utils.cpp) - target_link_libraries(runTest-z3_utils z3_utils pthread gtest hal::core hal::netlist test_utils) + target_link_libraries(runTest-z3_utils z3_utils gtest hal::core hal::netlist test_utils) add_test(runTest-z3_utils ${CMAKE_BINARY_DIR}/bin/hal_plugins/runTest-z3_utils --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index 8d032145f17..21822f4e78a 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -21,13 +21,13 @@ add_executable(runTest-plugin_manager add_executable(runTest-result result.cpp) -target_link_libraries(runTest-callback_hook pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-log pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-program_arguments pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-program_options pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-utils pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-plugin_manager pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-result pthread gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-callback_hook gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-log gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-program_arguments gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-program_options gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-utils gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-plugin_manager gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-result gtest hal::core hal::netlist test_utils) add_test(runTest-callback_hook_test ${CMAKE_BINARY_DIR}/bin/runTest-callback_hook --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/tests/netlist/CMakeLists.txt b/tests/netlist/CMakeLists.txt index d997aea6bba..04878ba9cb1 100644 --- a/tests/netlist/CMakeLists.txt +++ b/tests/netlist/CMakeLists.txt @@ -21,21 +21,21 @@ add_executable(runTest-gate_library gate_library.cpp) add_executable(runTest-netlist_utils netlist_utils.cpp) add_executable(runTest-decorators decorators.cpp) -target_link_libraries(runTest-netlist pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-gate_type pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-gate pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-net pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-data_container pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-endpoint pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-module pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-grouping pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-netlist_factory pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-gate_library_manager pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-netlist_serializer pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-boolean_function pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-gate_library pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-netlist_utils pthread gtest hal::core hal::netlist test_utils) -target_link_libraries(runTest-decorators pthread gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-netlist gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-gate_type gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-gate gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-net gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-data_container gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-endpoint gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-module gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-grouping gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-netlist_factory gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-gate_library_manager gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-netlist_serializer gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-boolean_function gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-gate_library gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-netlist_utils gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-decorators gtest hal::core hal::netlist test_utils) add_test(runTest-netlist ${CMAKE_BINARY_DIR}/bin/runTest-netlist --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) add_test(runTest-gate_type ${CMAKE_BINARY_DIR}/bin/runTest-gate_type --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) diff --git a/tests/netlist_parser/CMakeLists.txt b/tests/netlist_parser/CMakeLists.txt index 57d5e9bfc16..46ca1cd4d7b 100644 --- a/tests/netlist_parser/CMakeLists.txt +++ b/tests/netlist_parser/CMakeLists.txt @@ -1,7 +1,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/tests) add_executable(runTest-netlist_parser_manager netlist_parser_manager.cpp) -target_link_libraries(runTest-netlist_parser_manager pthread gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-netlist_parser_manager gtest hal::core hal::netlist test_utils) add_test(runTest-netlist_parser_manager ${CMAKE_BINARY_DIR}/bin/runTest-netlist_parser_manager --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") diff --git a/tests/netlist_writer/CMakeLists.txt b/tests/netlist_writer/CMakeLists.txt index 9f03c243673..f88f9e5fe08 100644 --- a/tests/netlist_writer/CMakeLists.txt +++ b/tests/netlist_writer/CMakeLists.txt @@ -1,7 +1,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/tests) add_executable(runTest-netlist_writer_manager netlist_writer_manager.cpp) -target_link_libraries(runTest-netlist_writer_manager pthread gtest hal::core hal::netlist test_utils) +target_link_libraries(runTest-netlist_writer_manager gtest hal::core hal::netlist test_utils) add_test(runTest-netlist_writer_manager ${CMAKE_BINARY_DIR}/bin/runTest-netlist_writer_manager --gtest_output=xml:${CMAKE_BINARY_DIR}/gtestresults-runBasicTests.xml) if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") diff --git a/tests/test_utils/CMakeLists.txt b/tests/test_utils/CMakeLists.txt index 7658a98e238..366c7aa2b7e 100644 --- a/tests/test_utils/CMakeLists.txt +++ b/tests/test_utils/CMakeLists.txt @@ -15,7 +15,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gate_libraries/test.hgl ${CMAKE_BINAR target_include_directories(test_utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(test_utils pthread gtest hal::core hal::netlist) +target_link_libraries(test_utils gtest hal::core hal::netlist) if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") add_sanitizers(test_utils)