Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
This commit is contained in:
commit
b5efe3ecbc
160
CMakeLists.txt
160
CMakeLists.txt
@ -1,6 +1,11 @@
|
|||||||
# TODO: sensible minimum CMake version
|
# TODO: sensible minimum CMake version
|
||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.3)
|
||||||
project(nextpnr)
|
project(nextpnr)
|
||||||
|
|
||||||
|
option(BUILD_GUI "Build GUI" ON)
|
||||||
|
option(BUILD_PYTHON "Build Python Integration" ON)
|
||||||
|
option(BUILD_TESTS "Build GUI" OFF)
|
||||||
|
|
||||||
# List of families to build
|
# List of families to build
|
||||||
set(FAMILIES dummy ice40)
|
set(FAMILIES dummy ice40)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
@ -9,15 +14,24 @@ set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g")
|
|||||||
set(CMAKE_DEFIN)
|
set(CMAKE_DEFIN)
|
||||||
# List of Boost libraries to include
|
# List of Boost libraries to include
|
||||||
set(boost_libs filesystem thread program_options)
|
set(boost_libs filesystem thread program_options)
|
||||||
# TODO: sensible minimum Python version
|
|
||||||
find_package(PythonInterp 3.5 REQUIRED)
|
if (BUILD_PYTHON)
|
||||||
find_package(PythonLibs 3.5 REQUIRED)
|
# TODO: sensible minimum Python version
|
||||||
|
find_package(PythonInterp 3.5 REQUIRED)
|
||||||
|
find_package(PythonLibs 3.5 REQUIRED)
|
||||||
|
else()
|
||||||
|
add_definitions("-DNO_PYTHON")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS ${boost_libs})
|
find_package(Boost REQUIRED COMPONENTS ${boost_libs})
|
||||||
|
|
||||||
# Find the Qt5 libraries
|
if (BUILD_GUI)
|
||||||
find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED)
|
# Find the Qt5 libraries
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
else()
|
||||||
|
add_definitions("-DNO_GUI")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Get the latest abbreviated commit hash of the working branch
|
# Get the latest abbreviated commit hash of the working branch
|
||||||
execute_process(
|
execute_process(
|
||||||
@ -27,57 +41,64 @@ execute_process(
|
|||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(3rdparty/googletest/googletest generated/3rdparty/googletest EXCLUDE_FROM_ALL)
|
if (BUILD_TESTS)
|
||||||
enable_testing()
|
add_subdirectory(3rdparty/googletest/googletest generated/3rdparty/googletest EXCLUDE_FROM_ALL)
|
||||||
|
enable_testing()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(3rdparty/QtPropertyBrowser generated/3rdparty/QtPropertyBrowser)
|
if (BUILD_GUI)
|
||||||
|
add_subdirectory(3rdparty/QtPropertyBrowser generated/3rdparty/QtPropertyBrowser)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
|
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/common/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/generated/version.h
|
${CMAKE_CURRENT_SOURCE_DIR}/common/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/generated/version.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# Find Boost::Python of a suitable version in a cross-platform way
|
if (BUILD_PYTHON)
|
||||||
# Some distributions (Arch) call it libboost_python3, others such as Ubuntu
|
# Find Boost::Python of a suitable version in a cross-platform way
|
||||||
# call it libboost_python35. In the latter case we must consider all minor versions
|
# Some distributions (Arch) call it libboost_python3, others such as Ubuntu
|
||||||
# Original source: https://github.com/BVLC/caffe/blob/master/cmake/Dependencies.cmake#L148
|
# call it libboost_python35. In the latter case we must consider all minor versions
|
||||||
set(version ${PYTHONLIBS_VERSION_STRING})
|
# Original source: https://github.com/BVLC/caffe/blob/master/cmake/Dependencies.cmake#L148
|
||||||
|
set(version ${PYTHONLIBS_VERSION_STRING})
|
||||||
STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
|
|
||||||
find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
|
|
||||||
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
|
|
||||||
|
|
||||||
while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
|
|
||||||
STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version})
|
|
||||||
|
|
||||||
STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
|
STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
|
||||||
find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
|
find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
|
||||||
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
|
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
|
||||||
|
|
||||||
STRING(REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version})
|
while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
|
||||||
if ("${has_more_version}" STREQUAL "")
|
STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version})
|
||||||
break()
|
|
||||||
endif ()
|
|
||||||
endwhile ()
|
|
||||||
|
|
||||||
if (NOT Boost_PYTHON_FOUND)
|
STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
|
||||||
find_package(Boost COMPONENTS python3 ${boost_libs})
|
find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
|
||||||
if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" )
|
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
|
||||||
set(Boost_PYTHON_FOUND TRUE)
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (NOT Boost_PYTHON_FOUND)
|
STRING(REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version})
|
||||||
STRING(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" gentoo_version ${PYTHONLIBS_VERSION_STRING})
|
if ("${has_more_version}" STREQUAL "")
|
||||||
find_package(Boost COMPONENTS python-${gentoo_version} ${boost_libs})
|
break()
|
||||||
if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" )
|
endif ()
|
||||||
set(Boost_PYTHON_FOUND TRUE)
|
endwhile ()
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (NOT Boost_PYTHON_FOUND )
|
if (NOT Boost_PYTHON_FOUND)
|
||||||
message( FATAL_ERROR "No version of Boost::Python 3.x could be found.")
|
find_package(Boost COMPONENTS python3 ${boost_libs})
|
||||||
endif ()
|
if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" )
|
||||||
|
set(Boost_PYTHON_FOUND TRUE)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT Boost_PYTHON_FOUND)
|
||||||
|
STRING(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" gentoo_version ${PYTHONLIBS_VERSION_STRING})
|
||||||
|
find_package(Boost COMPONENTS python-${gentoo_version} ${boost_libs})
|
||||||
|
if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" )
|
||||||
|
set(Boost_PYTHON_FOUND TRUE)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT Boost_PYTHON_FOUND )
|
||||||
|
message( FATAL_ERROR "No version of Boost::Python 3.x could be found.")
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(common/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
|
include_directories(common/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
|
||||||
aux_source_directory(common/ COMMON_SRC_FILES)
|
aux_source_directory(common/ COMMON_SRC_FILES)
|
||||||
@ -91,33 +112,58 @@ endif(MINGW)
|
|||||||
|
|
||||||
foreach (family ${FAMILIES})
|
foreach (family ${FAMILIES})
|
||||||
string(TOUPPER ${family} ufamily)
|
string(TOUPPER ${family} ufamily)
|
||||||
aux_source_directory(${family}/ ${ufamily}_FILES)
|
aux_source_directory(${family}/ ${ufamily}_FILES)
|
||||||
aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES)
|
|
||||||
|
|
||||||
add_subdirectory(gui generated/gui/${family})
|
if (BUILD_GUI)
|
||||||
|
add_subdirectory(gui generated/gui/${family})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add the CLI binary target
|
# Add the CLI binary target
|
||||||
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} )
|
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} )
|
||||||
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
|
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
|
||||||
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
|
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
|
||||||
|
|
||||||
# Add the importable Python module target
|
if (BUILD_PYTHON)
|
||||||
PYTHON_ADD_MODULE(nextpnrpy_${family} EXCLUDE_FROM_ALL ${COMMON_FILES} ${${ufamily}_FILES})
|
# Add the importable Python module target
|
||||||
# Add any new per-architecture targets here
|
PYTHON_ADD_MODULE(nextpnrpy_${family} EXCLUDE_FROM_ALL ${COMMON_FILES} ${${ufamily}_FILES})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(nextpnr-${family}-test EXCLUDE_FROM_ALL ${${ufamily}_TEST_FILES} ${COMMON_FILES} ${${ufamily}_FILES})
|
# Add any new per-architecture targets here
|
||||||
target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
|
if (BUILD_TESTS)
|
||||||
add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
|
aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES)
|
||||||
|
|
||||||
|
add_executable(nextpnr-${family}-test ${${ufamily}_TEST_FILES} ${COMMON_FILES} ${${ufamily}_FILES})
|
||||||
|
target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
|
||||||
|
|
||||||
|
add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set ${family_targets} to the list of targets being build for this family
|
# Set ${family_targets} to the list of targets being build for this family
|
||||||
set(family_targets nextpnr-${family} nextpnrpy_${family} nextpnr-${family}-test)
|
set(family_targets nextpnr-${family})
|
||||||
|
|
||||||
|
if (BUILD_TESTS)
|
||||||
|
set(family_targets ${family_targets} nextpnr-${family}-test)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_PYTHON)
|
||||||
|
set(family_targets ${family_targets} nextpnrpy_${family})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Include the family-specific CMakeFile
|
# Include the family-specific CMakeFile
|
||||||
include(${family}/family.cmake)
|
include(${family}/family.cmake)
|
||||||
foreach (target ${family_targets})
|
foreach (target ${family_targets})
|
||||||
# Include family-specific source files to all family targets and set defines appropriately
|
# Include family-specific source files to all family targets and set defines appropriately
|
||||||
target_include_directories(${target} PRIVATE ${family}/ generated/ gui/${family}/ gui/)
|
target_include_directories(${target} PRIVATE ${family}/ generated/)
|
||||||
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS)
|
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family})
|
||||||
target_link_libraries(${target} LINK_PUBLIC gui_${family} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES_${ufamily}})
|
target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES})
|
||||||
|
if (BUILD_PYTHON)
|
||||||
|
target_link_libraries(${target} LINK_PUBLIC ${PYTHON_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
if (BUILD_GUI)
|
||||||
|
target_include_directories(${target} PRIVATE gui/${family}/ gui/)
|
||||||
|
target_compile_definitions(${target} PRIVATE QT_NO_KEYWORDS)
|
||||||
|
target_link_libraries(${target} LINK_PUBLIC gui_${family} ${GUI_LIBRARY_FILES_${ufamily}})
|
||||||
|
endif()
|
||||||
endforeach (target)
|
endforeach (target)
|
||||||
endforeach (family)
|
endforeach (family)
|
||||||
|
|
||||||
@ -133,3 +179,7 @@ add_custom_target(
|
|||||||
-i
|
-i
|
||||||
${CLANGFORMAT_FILES}
|
${CLANGFORMAT_FILES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
unset(BUILD_GUI CACHE)
|
||||||
|
unset(BUILD_PYTHON CACHE)
|
||||||
|
unset(BUILD_TESTS CACHE)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// Blog article: http://mateusz.loskot.net/?p=2819
|
// Blog article: http://mateusz.loskot.net/?p=2819
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "emb.h"
|
#include "emb.h"
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
@ -136,3 +137,5 @@ void reset_stdout()
|
|||||||
void append_inittab() { PyImport_AppendInittab("emb", emb::PyInit_emb); }
|
void append_inittab() { PyImport_AppendInittab("emb", emb::PyInit_emb); }
|
||||||
|
|
||||||
} // namespace emb
|
} // namespace emb
|
||||||
|
|
||||||
|
#endif // NO_PYTHON
|
@ -1,3 +1,5 @@
|
|||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
@ -61,3 +63,5 @@ std::string parse_python_exception()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif // NO_PYTHON
|
@ -81,77 +81,11 @@ struct IdString
|
|||||||
|
|
||||||
// --- deprecated old API ---
|
// --- deprecated old API ---
|
||||||
|
|
||||||
IdString(const std::string &s) __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
set(global_ctx, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
IdString(const char *s) __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
set(global_ctx, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string &global_str() const __attribute__((deprecated))
|
const std::string &global_str() const __attribute__((deprecated))
|
||||||
{
|
{
|
||||||
assert(global_ctx != nullptr);
|
assert(global_ctx != nullptr);
|
||||||
return str(global_ctx);
|
return str(global_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &str() const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *c_str() const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return c_str(global_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
operator const char *() const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return c_str(global_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
operator const std::string &() const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const std::string &s) const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx) == s;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const char *s) const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx) == s;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const std::string &s) const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx) != s;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const char *s) const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx) != s;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t size() const __attribute__((deprecated))
|
|
||||||
{
|
|
||||||
assert(global_ctx != nullptr);
|
|
||||||
return str(global_ctx).size();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
#include "emb.h"
|
#include "emb.h"
|
||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
@ -186,3 +188,5 @@ void execute_python_file(const char *python_file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif // NO_PYTHON
|
@ -19,15 +19,20 @@
|
|||||||
|
|
||||||
#ifdef MAIN_EXECUTABLE
|
#ifdef MAIN_EXECUTABLE
|
||||||
|
|
||||||
|
#ifndef NO_GUI
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include "application.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#endif
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
#include "pybindings.h"
|
||||||
|
#endif
|
||||||
#include <boost/filesystem/convenience.hpp>
|
#include <boost/filesystem/convenience.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include "application.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
#include "pybindings.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
USING_NEXTPNR_NAMESPACE
|
USING_NEXTPNR_NAMESPACE
|
||||||
|
|
||||||
@ -44,12 +49,17 @@ int main(int argc, char *argv[])
|
|||||||
options.add_options()("help,h", "show help");
|
options.add_options()("help,h", "show help");
|
||||||
options.add_options()("verbose,v", "verbose output");
|
options.add_options()("verbose,v", "verbose output");
|
||||||
options.add_options()("force,f", "keep running after errors");
|
options.add_options()("force,f", "keep running after errors");
|
||||||
|
#ifndef NO_GUI
|
||||||
options.add_options()("gui", "start gui");
|
options.add_options()("gui", "start gui");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
po::positional_options_description pos;
|
||||||
|
#ifndef NO_PYTHON
|
||||||
options.add_options()("run", po::value<std::vector<std::string>>(),
|
options.add_options()("run", po::value<std::vector<std::string>>(),
|
||||||
"python file to execute");
|
"python file to execute");
|
||||||
options.add_options()("version,V", "show version");
|
|
||||||
po::positional_options_description pos;
|
|
||||||
pos.add("run", -1);
|
pos.add("run", -1);
|
||||||
|
#endif
|
||||||
|
options.add_options()("version,V", "show version");
|
||||||
|
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
try {
|
try {
|
||||||
@ -85,8 +95,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
Context ctx(ArchArgs{});
|
Context ctx(ArchArgs{});
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
init_python(argv[0]);
|
init_python(argv[0]);
|
||||||
python_export_global("ctx", ctx);
|
python_export_global("ctx", ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (vm.count("verbose")) {
|
if (vm.count("verbose")) {
|
||||||
ctx.verbose = true;
|
ctx.verbose = true;
|
||||||
@ -100,13 +113,16 @@ int main(int argc, char *argv[])
|
|||||||
ctx.rngseed(vm["seed"].as<int>());
|
ctx.rngseed(vm["seed"].as<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
if (vm.count("run")) {
|
if (vm.count("run")) {
|
||||||
std::vector<std::string> files =
|
std::vector<std::string> files =
|
||||||
vm["run"].as<std::vector<std::string>>();
|
vm["run"].as<std::vector<std::string>>();
|
||||||
for (auto filename : files)
|
for (auto filename : files)
|
||||||
execute_python_file(filename.c_str());
|
execute_python_file(filename.c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_GUI
|
||||||
if (vm.count("gui")) {
|
if (vm.count("gui")) {
|
||||||
Application a(argc, argv);
|
Application a(argc, argv);
|
||||||
MainWindow w(&ctx);
|
MainWindow w(&ctx);
|
||||||
@ -114,7 +130,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
rc = a.exec();
|
rc = a.exec();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifndef NO_PYTHON
|
||||||
deinit_python();
|
deinit_python();
|
||||||
|
#endif
|
||||||
return rc;
|
return rc;
|
||||||
} catch (log_execution_error_exception) {
|
} catch (log_execution_error_exception) {
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
@ -26,3 +28,5 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
void arch_wrap_python() { class_<ArchArgs>("ArchArgs"); }
|
void arch_wrap_python() { class_<ArchArgs>("ArchArgs"); }
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif
|
@ -27,7 +27,10 @@
|
|||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
||||||
|
|
||||||
@ -70,7 +73,9 @@ BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
|||||||
SLOT(writeInfo(std::string)));
|
SLOT(writeInfo(std::string)));
|
||||||
|
|
||||||
tabWidget = new QTabWidget();
|
tabWidget = new QTabWidget();
|
||||||
|
#ifndef NO_PYTHON
|
||||||
tabWidget->addTab(new PythonTab(), "Python");
|
tabWidget->addTab(new PythonTab(), "Python");
|
||||||
|
#endif
|
||||||
info = new InfoTab();
|
info = new InfoTab();
|
||||||
tabWidget->addTab(info, "Info");
|
tabWidget->addTab(info, "Info");
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include "fpgaviewwidget.h"
|
#include "fpgaviewwidget.h"
|
||||||
#include "pybindings.h"
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -116,8 +115,8 @@ DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
|||||||
QList<QTreeWidgetItem *> bel_items;
|
QList<QTreeWidgetItem *> bel_items;
|
||||||
for (auto bel : ctx->getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = ctx->getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
bel_items.append(
|
bel_items.append(new BelTreeItem(name, ElementType::BEL,
|
||||||
new BelTreeItem(name, ElementType::BEL, QString(name.c_str(ctx))));
|
QString(name.c_str(ctx))));
|
||||||
}
|
}
|
||||||
bel_root->addChildren(bel_items);
|
bel_root->addChildren(bel_items);
|
||||||
|
|
||||||
@ -140,8 +139,8 @@ DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
|||||||
treeWidget->insertTopLevelItem(0, pip_root);
|
treeWidget->insertTopLevelItem(0, pip_root);
|
||||||
for (auto pip : ctx->getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = ctx->getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
pip_items.append(
|
pip_items.append(new PipTreeItem(name, ElementType::PIP,
|
||||||
new PipTreeItem(name, ElementType::PIP, QString(name.c_str(ctx))));
|
QString(name.c_str(ctx))));
|
||||||
}
|
}
|
||||||
pip_root->addChildren(pip_items);
|
pip_root->addChildren(pip_items);
|
||||||
|
|
||||||
|
@ -173,6 +173,20 @@ bool LineShader::compile(void)
|
|||||||
program_->log().toStdString().c_str());
|
program_->log().toStdString().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!vao_.create())
|
||||||
|
log_abort();
|
||||||
|
vao_.bind();
|
||||||
|
|
||||||
|
if (!buffers_.position.create())
|
||||||
|
log_abort();
|
||||||
|
if (!buffers_.normal.create())
|
||||||
|
log_abort();
|
||||||
|
if (!buffers_.miter.create())
|
||||||
|
log_abort();
|
||||||
|
if (!buffers_.index.create())
|
||||||
|
log_abort();
|
||||||
|
|
||||||
attributes_.position = program_->attributeLocation("position");
|
attributes_.position = program_->attributeLocation("position");
|
||||||
attributes_.normal = program_->attributeLocation("normal");
|
attributes_.normal = program_->attributeLocation("normal");
|
||||||
attributes_.miter = program_->attributeLocation("miter");
|
attributes_.miter = program_->attributeLocation("miter");
|
||||||
@ -180,44 +194,84 @@ bool LineShader::compile(void)
|
|||||||
uniforms_.projection = program_->uniformLocation("projection");
|
uniforms_.projection = program_->uniformLocation("projection");
|
||||||
uniforms_.color = program_->uniformLocation("color");
|
uniforms_.color = program_->uniformLocation("color");
|
||||||
|
|
||||||
|
vao_.release();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
||||||
{
|
{
|
||||||
auto gl = QOpenGLContext::currentContext()->functions();
|
auto gl = QOpenGLContext::currentContext()->functions();
|
||||||
|
vao_.bind();
|
||||||
program_->bind();
|
program_->bind();
|
||||||
|
|
||||||
|
buffers_.position.bind();
|
||||||
|
buffers_.position.allocate(&line.vertices[0],
|
||||||
|
sizeof(Vertex2DPOD) * line.vertices.size());
|
||||||
|
|
||||||
|
buffers_.normal.bind();
|
||||||
|
buffers_.normal.allocate(&line.normals[0],
|
||||||
|
sizeof(Vertex2DPOD) * line.normals.size());
|
||||||
|
|
||||||
|
buffers_.miter.bind();
|
||||||
|
buffers_.miter.allocate(&line.miters[0],
|
||||||
|
sizeof(GLfloat) * line.miters.size());
|
||||||
|
|
||||||
|
buffers_.index.bind();
|
||||||
|
buffers_.index.allocate(&line.indices[0],
|
||||||
|
sizeof(GLuint) * line.indices.size());
|
||||||
|
|
||||||
program_->setUniformValue(uniforms_.projection, projection);
|
program_->setUniformValue(uniforms_.projection, projection);
|
||||||
program_->setUniformValue(uniforms_.thickness, line.thickness);
|
program_->setUniformValue(uniforms_.thickness, line.thickness);
|
||||||
program_->setUniformValue(uniforms_.color, line.color.r, line.color.g,
|
program_->setUniformValue(uniforms_.color, line.color.r, line.color.g,
|
||||||
line.color.b, line.color.a);
|
line.color.b, line.color.a);
|
||||||
|
|
||||||
|
buffers_.position.bind();
|
||||||
|
program_->enableAttributeArray("position");
|
||||||
gl->glVertexAttribPointer(attributes_.position, 2, GL_FLOAT, GL_FALSE, 0,
|
gl->glVertexAttribPointer(attributes_.position, 2, GL_FLOAT, GL_FALSE, 0,
|
||||||
&line.vertices[0]);
|
(void *)0);
|
||||||
|
|
||||||
|
buffers_.normal.bind();
|
||||||
|
program_->enableAttributeArray("normal");
|
||||||
gl->glVertexAttribPointer(attributes_.normal, 2, GL_FLOAT, GL_FALSE, 0,
|
gl->glVertexAttribPointer(attributes_.normal, 2, GL_FLOAT, GL_FALSE, 0,
|
||||||
&line.normals[0]);
|
(void *)0);
|
||||||
|
|
||||||
|
buffers_.miter.bind();
|
||||||
|
program_->enableAttributeArray("miter");
|
||||||
gl->glVertexAttribPointer(attributes_.miter, 1, GL_FLOAT, GL_FALSE, 0,
|
gl->glVertexAttribPointer(attributes_.miter, 1, GL_FLOAT, GL_FALSE, 0,
|
||||||
&line.miters[0]);
|
(void *)0);
|
||||||
|
|
||||||
gl->glEnableVertexAttribArray(0);
|
|
||||||
gl->glEnableVertexAttribArray(1);
|
|
||||||
gl->glEnableVertexAttribArray(2);
|
|
||||||
|
|
||||||
|
buffers_.index.bind();
|
||||||
gl->glDrawElements(GL_TRIANGLES, line.indices.size(), GL_UNSIGNED_INT,
|
gl->glDrawElements(GL_TRIANGLES, line.indices.size(), GL_UNSIGNED_INT,
|
||||||
&line.indices[0]);
|
(void *)0);
|
||||||
|
|
||||||
|
program_->disableAttributeArray("miter");
|
||||||
|
program_->disableAttributeArray("normal");
|
||||||
|
program_->disableAttributeArray("position");
|
||||||
|
|
||||||
gl->glDisableVertexAttribArray(2);
|
|
||||||
gl->glDisableVertexAttribArray(1);
|
|
||||||
gl->glDisableVertexAttribArray(0);
|
|
||||||
program_->release();
|
program_->release();
|
||||||
|
vao_.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
||||||
: QOpenGLWidget(parent), moveX_(0), moveY_(0), zoom_(10.0f),
|
: QOpenGLWidget(parent), moveX_(0), moveY_(0), zoom_(10.0f),
|
||||||
lineShader_(this)
|
lineShader_(this)
|
||||||
{
|
{
|
||||||
ctx = qobject_cast<BaseMainWindow *>(getMainWindow())->getContext();
|
ctx_ = qobject_cast<BaseMainWindow *>(getMainWindow())->getContext();
|
||||||
|
auto fmt = format();
|
||||||
|
fmt.setMajorVersion(3);
|
||||||
|
fmt.setMinorVersion(1);
|
||||||
|
setFormat(fmt);
|
||||||
|
|
||||||
|
fmt = format();
|
||||||
|
printf("FPGAViewWidget running on OpenGL %d.%d\n", fmt.majorVersion(),
|
||||||
|
fmt.minorVersion());
|
||||||
|
if (fmt.majorVersion() < 3) {
|
||||||
|
printf("Could not get OpenGL 3.0 context. Aborting.\n");
|
||||||
|
log_abort();
|
||||||
|
}
|
||||||
|
if (fmt.minorVersion() < 1) {
|
||||||
|
printf("Could not get OpenGL 3.1 context - trying anyway...\n ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMainWindow *FPGAViewWidget::getMainWindow()
|
QMainWindow *FPGAViewWidget::getMainWindow()
|
||||||
@ -320,15 +374,15 @@ void FPGAViewWidget::paintGL()
|
|||||||
|
|
||||||
// Draw Bels.
|
// Draw Bels.
|
||||||
auto bels = LineShaderData(0.02f, QColor("#b000ba"));
|
auto bels = LineShaderData(0.02f, QColor("#b000ba"));
|
||||||
for (auto bel : ctx->getBels()) {
|
for (auto bel : ctx_->getBels()) {
|
||||||
for (auto &el : ctx->getBelGraphics(bel))
|
for (auto &el : ctx_->getBelGraphics(bel))
|
||||||
drawElement(bels, el);
|
drawElement(bels, el);
|
||||||
}
|
}
|
||||||
lineShader_.draw(bels, matrix);
|
lineShader_.draw(bels, matrix);
|
||||||
|
|
||||||
// Draw Frame Graphics.
|
// Draw Frame Graphics.
|
||||||
auto frames = LineShaderData(0.02f, QColor("#0066ba"));
|
auto frames = LineShaderData(0.02f, QColor("#0066ba"));
|
||||||
for (auto &el : ctx->getFrameGraphics()) {
|
for (auto &el : ctx_->getFrameGraphics()) {
|
||||||
drawElement(frames, el);
|
drawElement(frames, el);
|
||||||
}
|
}
|
||||||
lineShader_.draw(frames, matrix);
|
lineShader_.draw(frames, matrix);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <QOpenGLBuffer>
|
#include <QOpenGLBuffer>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
|
#include <QOpenGLVertexArrayObject>
|
||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
@ -162,6 +163,15 @@ class LineShader
|
|||||||
GLuint miter;
|
GLuint miter;
|
||||||
} attributes_;
|
} attributes_;
|
||||||
|
|
||||||
|
// GL buffers
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
QOpenGLBuffer position;
|
||||||
|
QOpenGLBuffer normal;
|
||||||
|
QOpenGLBuffer miter;
|
||||||
|
QOpenGLBuffer index;
|
||||||
|
} buffers_;
|
||||||
|
|
||||||
// GL uniform locations.
|
// GL uniform locations.
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -173,8 +183,23 @@ class LineShader
|
|||||||
GLuint color;
|
GLuint color;
|
||||||
} uniforms_;
|
} uniforms_;
|
||||||
|
|
||||||
|
QOpenGLVertexArrayObject vao_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LineShader(QObject *parent) : parent_(parent), program_(nullptr) {}
|
LineShader(QObject *parent) : parent_(parent), program_(nullptr)
|
||||||
|
{
|
||||||
|
buffers_.position = QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
|
||||||
|
buffers_.position.setUsagePattern(QOpenGLBuffer::StaticDraw);
|
||||||
|
|
||||||
|
buffers_.normal = QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
|
||||||
|
buffers_.normal.setUsagePattern(QOpenGLBuffer::StaticDraw);
|
||||||
|
|
||||||
|
buffers_.miter = QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
|
||||||
|
buffers_.miter.setUsagePattern(QOpenGLBuffer::StaticDraw);
|
||||||
|
|
||||||
|
buffers_.index = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
|
||||||
|
buffers_.index.setUsagePattern(QOpenGLBuffer::StaticDraw);
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr const char *vertexShaderSource_ =
|
static constexpr const char *vertexShaderSource_ =
|
||||||
"attribute highp vec2 position;\n"
|
"attribute highp vec2 position;\n"
|
||||||
@ -238,7 +263,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
|
|
||||||
float startDragX_;
|
float startDragX_;
|
||||||
float startDragY_;
|
float startDragY_;
|
||||||
Context *ctx;
|
Context *ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@ -138,3 +139,5 @@ void PythonTab::showContextMenu(const QPoint &pt)
|
|||||||
void PythonTab::clearBuffer() { plainTextEdit->clear(); }
|
void PythonTab::clearBuffer() { plainTextEdit->clear(); }
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef PYTHONTAB_H
|
#ifndef PYTHONTAB_H
|
||||||
#define PYTHONTAB_H
|
#define PYTHONTAB_H
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
@ -52,5 +54,6 @@ class PythonTab : public QWidget
|
|||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
#endif // NO_PYTHON
|
||||||
|
|
||||||
#endif // PYTHONTAB_H
|
#endif // PYTHONTAB_H
|
||||||
|
@ -19,23 +19,27 @@
|
|||||||
|
|
||||||
#ifdef MAIN_EXECUTABLE
|
#ifdef MAIN_EXECUTABLE
|
||||||
|
|
||||||
|
#ifndef NO_GUI
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSurfaceFormat>
|
#include "application.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#endif
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
#include "pybindings.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/filesystem/convenience.hpp>
|
#include <boost/filesystem/convenience.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "application.h"
|
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
#include "pcf.h"
|
#include "pcf.h"
|
||||||
#include "place_sa.h"
|
#include "place_sa.h"
|
||||||
#include "pybindings.h"
|
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@ -76,13 +80,19 @@ int main(int argc, char *argv[])
|
|||||||
options.add_options()("verbose,v", "verbose output");
|
options.add_options()("verbose,v", "verbose output");
|
||||||
options.add_options()("debug", "debug output");
|
options.add_options()("debug", "debug output");
|
||||||
options.add_options()("force,f", "keep running after errors");
|
options.add_options()("force,f", "keep running after errors");
|
||||||
|
#ifndef NO_GUI
|
||||||
options.add_options()("gui", "start gui");
|
options.add_options()("gui", "start gui");
|
||||||
|
#endif
|
||||||
options.add_options()("svg", "dump SVG file");
|
options.add_options()("svg", "dump SVG file");
|
||||||
options.add_options()("pack-only",
|
options.add_options()("pack-only",
|
||||||
"pack design only without placement or routing");
|
"pack design only without placement or routing");
|
||||||
|
|
||||||
|
po::positional_options_description pos;
|
||||||
|
#ifndef NO_PYTHON
|
||||||
options.add_options()("run", po::value<std::vector<std::string>>(),
|
options.add_options()("run", po::value<std::vector<std::string>>(),
|
||||||
"python file to execute");
|
"python file to execute");
|
||||||
|
pos.add("run", -1);
|
||||||
|
#endif
|
||||||
options.add_options()("json", po::value<std::string>(),
|
options.add_options()("json", po::value<std::string>(),
|
||||||
"JSON design file to ingest");
|
"JSON design file to ingest");
|
||||||
options.add_options()("pcf", po::value<std::string>(),
|
options.add_options()("pcf", po::value<std::string>(),
|
||||||
@ -104,8 +114,6 @@ int main(int argc, char *argv[])
|
|||||||
options.add_options()("no-tmdriv", "disable timing-driven placement");
|
options.add_options()("no-tmdriv", "disable timing-driven placement");
|
||||||
options.add_options()("package", po::value<std::string>(),
|
options.add_options()("package", po::value<std::string>(),
|
||||||
"set device package");
|
"set device package");
|
||||||
po::positional_options_description pos;
|
|
||||||
pos.add("run", -1);
|
|
||||||
|
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
try {
|
try {
|
||||||
@ -202,8 +210,11 @@ int main(int argc, char *argv[])
|
|||||||
chipArgs.package = vm["package"].as<std::string>();
|
chipArgs.package = vm["package"].as<std::string>();
|
||||||
|
|
||||||
Context ctx(chipArgs);
|
Context ctx(chipArgs);
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
init_python(argv[0]);
|
init_python(argv[0]);
|
||||||
python_export_global("ctx", ctx);
|
python_export_global("ctx", ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (vm.count("verbose")) {
|
if (vm.count("verbose")) {
|
||||||
ctx.verbose = true;
|
ctx.verbose = true;
|
||||||
@ -326,13 +337,16 @@ int main(int argc, char *argv[])
|
|||||||
write_asc(&ctx, f);
|
write_asc(&ctx, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
if (vm.count("run")) {
|
if (vm.count("run")) {
|
||||||
std::vector<std::string> files =
|
std::vector<std::string> files =
|
||||||
vm["run"].as<std::vector<std::string>>();
|
vm["run"].as<std::vector<std::string>>();
|
||||||
for (auto filename : files)
|
for (auto filename : files)
|
||||||
execute_python_file(filename.c_str());
|
execute_python_file(filename.c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_GUI
|
||||||
if (vm.count("gui")) {
|
if (vm.count("gui")) {
|
||||||
Application a(argc, argv);
|
Application a(argc, argv);
|
||||||
MainWindow w(&ctx);
|
MainWindow w(&ctx);
|
||||||
@ -340,7 +354,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
rc = a.exec();
|
rc = a.exec();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
deinit_python();
|
deinit_python();
|
||||||
|
#endif
|
||||||
return rc;
|
return rc;
|
||||||
} catch (log_execution_error_exception) {
|
} catch (log_execution_error_exception) {
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
@ -84,3 +86,5 @@ void arch_wrap_python()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif // NO_PYTHON
|
@ -9,34 +9,35 @@ class HX1KTest : public ::testing::Test
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
chipArgs.type = ChipArgs::HX1K;
|
IdString::global_ctx = nullptr;
|
||||||
|
chipArgs.type = ArchArgs::HX1K;
|
||||||
chipArgs.package = "tq144";
|
chipArgs.package = "tq144";
|
||||||
design = new Design(chipArgs);
|
ctx = new Context(chipArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { delete design; }
|
virtual void TearDown() { delete ctx; }
|
||||||
|
|
||||||
ChipArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
Design *design;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(HX1KTest, bel_names)
|
TEST_F(HX1KTest, bel_names)
|
||||||
{
|
{
|
||||||
int bel_count = 0;
|
int bel_count = 0;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
ASSERT_EQ(bel, design->chip.getBelByName(name));
|
ASSERT_EQ(bel, ctx->getBelByName(name));
|
||||||
bel_count++;
|
bel_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(bel_count, 1416);
|
ASSERT_EQ(bel_count, 1418);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HX1KTest, wire_names)
|
TEST_F(HX1KTest, wire_names)
|
||||||
{
|
{
|
||||||
int wire_count = 0;
|
int wire_count = 0;
|
||||||
for (auto wire : design->chip.getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto name = design->chip.getWireName(wire);
|
auto name = ctx->getWireName(wire);
|
||||||
assert(wire == design->chip.getWireByName(name));
|
assert(wire == ctx->getWireByName(name));
|
||||||
wire_count++;
|
wire_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(wire_count, 27682);
|
ASSERT_EQ(wire_count, 27682);
|
||||||
@ -45,9 +46,9 @@ TEST_F(HX1KTest, wire_names)
|
|||||||
TEST_F(HX1KTest, pip_names)
|
TEST_F(HX1KTest, pip_names)
|
||||||
{
|
{
|
||||||
int pip_count = 0;
|
int pip_count = 0;
|
||||||
for (auto pip : design->chip.getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = design->chip.getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
assert(pip == design->chip.getPipByName(name));
|
assert(pip == ctx->getPipByName(name));
|
||||||
pip_count++;
|
pip_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(pip_count, 319904);
|
ASSERT_EQ(pip_count, 319904);
|
||||||
@ -55,11 +56,11 @@ TEST_F(HX1KTest, pip_names)
|
|||||||
|
|
||||||
TEST_F(HX1KTest, uphill_to_downhill)
|
TEST_F(HX1KTest, uphill_to_downhill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(dst)) {
|
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||||
bool found_downhill = false;
|
bool found_downhill = false;
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(
|
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||||
design->chip.getPipSrcWire(uphill_pip))) {
|
ctx->getPipSrcWire(uphill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_downhill);
|
ASSERT_FALSE(found_downhill);
|
||||||
found_downhill = true;
|
found_downhill = true;
|
||||||
@ -72,11 +73,11 @@ TEST_F(HX1KTest, uphill_to_downhill)
|
|||||||
|
|
||||||
TEST_F(HX1KTest, downhill_to_uphill)
|
TEST_F(HX1KTest, downhill_to_uphill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) {
|
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||||
bool found_uphill = false;
|
bool found_uphill = false;
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(
|
for (auto uphill_pip : ctx->getPipsUphill(
|
||||||
design->chip.getPipDstWire(downhill_pip))) {
|
ctx->getPipDstWire(downhill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_uphill);
|
ASSERT_FALSE(found_uphill);
|
||||||
found_uphill = true;
|
found_uphill = true;
|
||||||
|
@ -9,34 +9,35 @@ class HX8KTest : public ::testing::Test
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
chipArgs.type = ChipArgs::HX8K;
|
IdString::global_ctx = nullptr;
|
||||||
|
chipArgs.type = ArchArgs::HX8K;
|
||||||
chipArgs.package = "ct256";
|
chipArgs.package = "ct256";
|
||||||
design = new Design(chipArgs);
|
ctx = new Context(chipArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { delete design; }
|
virtual void TearDown() { delete ctx; }
|
||||||
|
|
||||||
ChipArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
Design *design;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(HX8KTest, bel_names)
|
TEST_F(HX8KTest, bel_names)
|
||||||
{
|
{
|
||||||
int bel_count = 0;
|
int bel_count = 0;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
ASSERT_EQ(bel, design->chip.getBelByName(name));
|
ASSERT_EQ(bel, ctx->getBelByName(name));
|
||||||
bel_count++;
|
bel_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(bel_count, 7968);
|
ASSERT_EQ(bel_count, 7979);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HX8KTest, wire_names)
|
TEST_F(HX8KTest, wire_names)
|
||||||
{
|
{
|
||||||
int wire_count = 0;
|
int wire_count = 0;
|
||||||
for (auto wire : design->chip.getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto name = design->chip.getWireName(wire);
|
auto name = ctx->getWireName(wire);
|
||||||
assert(wire == design->chip.getWireByName(name));
|
assert(wire == ctx->getWireByName(name));
|
||||||
wire_count++;
|
wire_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(wire_count, 135174);
|
ASSERT_EQ(wire_count, 135174);
|
||||||
@ -45,9 +46,9 @@ TEST_F(HX8KTest, wire_names)
|
|||||||
TEST_F(HX8KTest, pip_names)
|
TEST_F(HX8KTest, pip_names)
|
||||||
{
|
{
|
||||||
int pip_count = 0;
|
int pip_count = 0;
|
||||||
for (auto pip : design->chip.getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = design->chip.getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
assert(pip == design->chip.getPipByName(name));
|
assert(pip == ctx->getPipByName(name));
|
||||||
pip_count++;
|
pip_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(pip_count, 1652480);
|
ASSERT_EQ(pip_count, 1652480);
|
||||||
@ -55,11 +56,11 @@ TEST_F(HX8KTest, pip_names)
|
|||||||
|
|
||||||
TEST_F(HX8KTest, uphill_to_downhill)
|
TEST_F(HX8KTest, uphill_to_downhill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(dst)) {
|
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||||
bool found_downhill = false;
|
bool found_downhill = false;
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(
|
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||||
design->chip.getPipSrcWire(uphill_pip))) {
|
ctx->getPipSrcWire(uphill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_downhill);
|
ASSERT_FALSE(found_downhill);
|
||||||
found_downhill = true;
|
found_downhill = true;
|
||||||
@ -72,11 +73,11 @@ TEST_F(HX8KTest, uphill_to_downhill)
|
|||||||
|
|
||||||
TEST_F(HX8KTest, downhill_to_uphill)
|
TEST_F(HX8KTest, downhill_to_uphill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) {
|
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||||
bool found_uphill = false;
|
bool found_uphill = false;
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(
|
for (auto uphill_pip : ctx->getPipsUphill(
|
||||||
design->chip.getPipDstWire(downhill_pip))) {
|
ctx->getPipDstWire(downhill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_uphill);
|
ASSERT_FALSE(found_uphill);
|
||||||
found_uphill = true;
|
found_uphill = true;
|
||||||
|
@ -9,34 +9,35 @@ class LP1KTest : public ::testing::Test
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
chipArgs.type = ChipArgs::LP1K;
|
IdString::global_ctx = nullptr;
|
||||||
|
chipArgs.type = ArchArgs::LP1K;
|
||||||
chipArgs.package = "tq144";
|
chipArgs.package = "tq144";
|
||||||
design = new Design(chipArgs);
|
ctx = new Context(chipArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { delete design; }
|
virtual void TearDown() { delete ctx; }
|
||||||
|
|
||||||
ChipArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
Design *design;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(LP1KTest, bel_names)
|
TEST_F(LP1KTest, bel_names)
|
||||||
{
|
{
|
||||||
int bel_count = 0;
|
int bel_count = 0;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
ASSERT_EQ(bel, design->chip.getBelByName(name));
|
ASSERT_EQ(bel, ctx->getBelByName(name));
|
||||||
bel_count++;
|
bel_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(bel_count, 1416);
|
ASSERT_EQ(bel_count, 1418);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LP1KTest, wire_names)
|
TEST_F(LP1KTest, wire_names)
|
||||||
{
|
{
|
||||||
int wire_count = 0;
|
int wire_count = 0;
|
||||||
for (auto wire : design->chip.getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto name = design->chip.getWireName(wire);
|
auto name = ctx->getWireName(wire);
|
||||||
assert(wire == design->chip.getWireByName(name));
|
assert(wire == ctx->getWireByName(name));
|
||||||
wire_count++;
|
wire_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(wire_count, 27682);
|
ASSERT_EQ(wire_count, 27682);
|
||||||
@ -45,9 +46,9 @@ TEST_F(LP1KTest, wire_names)
|
|||||||
TEST_F(LP1KTest, pip_names)
|
TEST_F(LP1KTest, pip_names)
|
||||||
{
|
{
|
||||||
int pip_count = 0;
|
int pip_count = 0;
|
||||||
for (auto pip : design->chip.getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = design->chip.getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
assert(pip == design->chip.getPipByName(name));
|
assert(pip == ctx->getPipByName(name));
|
||||||
pip_count++;
|
pip_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(pip_count, 319904);
|
ASSERT_EQ(pip_count, 319904);
|
||||||
@ -55,11 +56,11 @@ TEST_F(LP1KTest, pip_names)
|
|||||||
|
|
||||||
TEST_F(LP1KTest, uphill_to_downhill)
|
TEST_F(LP1KTest, uphill_to_downhill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(dst)) {
|
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||||
bool found_downhill = false;
|
bool found_downhill = false;
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(
|
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||||
design->chip.getPipSrcWire(uphill_pip))) {
|
ctx->getPipSrcWire(uphill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_downhill);
|
ASSERT_FALSE(found_downhill);
|
||||||
found_downhill = true;
|
found_downhill = true;
|
||||||
@ -72,11 +73,11 @@ TEST_F(LP1KTest, uphill_to_downhill)
|
|||||||
|
|
||||||
TEST_F(LP1KTest, downhill_to_uphill)
|
TEST_F(LP1KTest, downhill_to_uphill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) {
|
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||||
bool found_uphill = false;
|
bool found_uphill = false;
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(
|
for (auto uphill_pip : ctx->getPipsUphill(
|
||||||
design->chip.getPipDstWire(downhill_pip))) {
|
ctx->getPipDstWire(downhill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_uphill);
|
ASSERT_FALSE(found_uphill);
|
||||||
found_uphill = true;
|
found_uphill = true;
|
||||||
|
@ -9,34 +9,35 @@ class LP384Test : public ::testing::Test
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
chipArgs.type = ChipArgs::LP384;
|
IdString::global_ctx = nullptr;
|
||||||
|
chipArgs.type = ArchArgs::LP384;
|
||||||
chipArgs.package = "qn32";
|
chipArgs.package = "qn32";
|
||||||
design = new Design(chipArgs);
|
ctx = new Context(chipArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { delete design; }
|
virtual void TearDown() { delete ctx; }
|
||||||
|
|
||||||
ChipArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
Design *design;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(LP384Test, bel_names)
|
TEST_F(LP384Test, bel_names)
|
||||||
{
|
{
|
||||||
int bel_count = 0;
|
int bel_count = 0;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
ASSERT_EQ(bel, design->chip.getBelByName(name));
|
ASSERT_EQ(bel, ctx->getBelByName(name));
|
||||||
bel_count++;
|
bel_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(bel_count, 440);
|
ASSERT_EQ(bel_count, 449);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LP384Test, wire_names)
|
TEST_F(LP384Test, wire_names)
|
||||||
{
|
{
|
||||||
int wire_count = 0;
|
int wire_count = 0;
|
||||||
for (auto wire : design->chip.getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto name = design->chip.getWireName(wire);
|
auto name = ctx->getWireName(wire);
|
||||||
assert(wire == design->chip.getWireByName(name));
|
assert(wire == ctx->getWireByName(name));
|
||||||
wire_count++;
|
wire_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(wire_count, 8294);
|
ASSERT_EQ(wire_count, 8294);
|
||||||
@ -45,9 +46,9 @@ TEST_F(LP384Test, wire_names)
|
|||||||
TEST_F(LP384Test, pip_names)
|
TEST_F(LP384Test, pip_names)
|
||||||
{
|
{
|
||||||
int pip_count = 0;
|
int pip_count = 0;
|
||||||
for (auto pip : design->chip.getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = design->chip.getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
assert(pip == design->chip.getPipByName(name));
|
assert(pip == ctx->getPipByName(name));
|
||||||
pip_count++;
|
pip_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(pip_count, 86864);
|
ASSERT_EQ(pip_count, 86864);
|
||||||
@ -55,11 +56,11 @@ TEST_F(LP384Test, pip_names)
|
|||||||
|
|
||||||
TEST_F(LP384Test, uphill_to_downhill)
|
TEST_F(LP384Test, uphill_to_downhill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(dst)) {
|
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||||
bool found_downhill = false;
|
bool found_downhill = false;
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(
|
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||||
design->chip.getPipSrcWire(uphill_pip))) {
|
ctx->getPipSrcWire(uphill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_downhill);
|
ASSERT_FALSE(found_downhill);
|
||||||
found_downhill = true;
|
found_downhill = true;
|
||||||
@ -72,11 +73,11 @@ TEST_F(LP384Test, uphill_to_downhill)
|
|||||||
|
|
||||||
TEST_F(LP384Test, downhill_to_uphill)
|
TEST_F(LP384Test, downhill_to_uphill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) {
|
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||||
bool found_uphill = false;
|
bool found_uphill = false;
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(
|
for (auto uphill_pip : ctx->getPipsUphill(
|
||||||
design->chip.getPipDstWire(downhill_pip))) {
|
ctx->getPipDstWire(downhill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_uphill);
|
ASSERT_FALSE(found_uphill);
|
||||||
found_uphill = true;
|
found_uphill = true;
|
||||||
|
@ -9,34 +9,35 @@ class LP8KTest : public ::testing::Test
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
chipArgs.type = ChipArgs::LP8K;
|
IdString::global_ctx = nullptr;
|
||||||
|
chipArgs.type = ArchArgs::LP8K;
|
||||||
chipArgs.package = "ct256";
|
chipArgs.package = "ct256";
|
||||||
design = new Design(chipArgs);
|
ctx = new Context(chipArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { delete design; }
|
virtual void TearDown() { delete ctx; }
|
||||||
|
|
||||||
ChipArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
Design *design;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(LP8KTest, bel_names)
|
TEST_F(LP8KTest, bel_names)
|
||||||
{
|
{
|
||||||
int bel_count = 0;
|
int bel_count = 0;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
ASSERT_EQ(bel, design->chip.getBelByName(name));
|
ASSERT_EQ(bel, ctx->getBelByName(name));
|
||||||
bel_count++;
|
bel_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(bel_count, 7968);
|
ASSERT_EQ(bel_count, 7979);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LP8KTest, wire_names)
|
TEST_F(LP8KTest, wire_names)
|
||||||
{
|
{
|
||||||
int wire_count = 0;
|
int wire_count = 0;
|
||||||
for (auto wire : design->chip.getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto name = design->chip.getWireName(wire);
|
auto name = ctx->getWireName(wire);
|
||||||
assert(wire == design->chip.getWireByName(name));
|
assert(wire == ctx->getWireByName(name));
|
||||||
wire_count++;
|
wire_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(wire_count, 135174);
|
ASSERT_EQ(wire_count, 135174);
|
||||||
@ -45,9 +46,9 @@ TEST_F(LP8KTest, wire_names)
|
|||||||
TEST_F(LP8KTest, pip_names)
|
TEST_F(LP8KTest, pip_names)
|
||||||
{
|
{
|
||||||
int pip_count = 0;
|
int pip_count = 0;
|
||||||
for (auto pip : design->chip.getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = design->chip.getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
assert(pip == design->chip.getPipByName(name));
|
assert(pip == ctx->getPipByName(name));
|
||||||
pip_count++;
|
pip_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(pip_count, 1652480);
|
ASSERT_EQ(pip_count, 1652480);
|
||||||
@ -55,11 +56,11 @@ TEST_F(LP8KTest, pip_names)
|
|||||||
|
|
||||||
TEST_F(LP8KTest, uphill_to_downhill)
|
TEST_F(LP8KTest, uphill_to_downhill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(dst)) {
|
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||||
bool found_downhill = false;
|
bool found_downhill = false;
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(
|
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||||
design->chip.getPipSrcWire(uphill_pip))) {
|
ctx->getPipSrcWire(uphill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_downhill);
|
ASSERT_FALSE(found_downhill);
|
||||||
found_downhill = true;
|
found_downhill = true;
|
||||||
@ -72,11 +73,11 @@ TEST_F(LP8KTest, uphill_to_downhill)
|
|||||||
|
|
||||||
TEST_F(LP8KTest, downhill_to_uphill)
|
TEST_F(LP8KTest, downhill_to_uphill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) {
|
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||||
bool found_uphill = false;
|
bool found_uphill = false;
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(
|
for (auto uphill_pip : ctx->getPipsUphill(
|
||||||
design->chip.getPipDstWire(downhill_pip))) {
|
ctx->getPipDstWire(downhill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_uphill);
|
ASSERT_FALSE(found_uphill);
|
||||||
found_uphill = true;
|
found_uphill = true;
|
||||||
|
@ -9,34 +9,35 @@ class UP5KTest : public ::testing::Test
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
chipArgs.type = ChipArgs::UP5K;
|
IdString::global_ctx = nullptr;
|
||||||
|
chipArgs.type = ArchArgs::UP5K;
|
||||||
chipArgs.package = "sg48";
|
chipArgs.package = "sg48";
|
||||||
design = new Design(chipArgs);
|
ctx = new Context(chipArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { delete design; }
|
virtual void TearDown() { delete ctx; }
|
||||||
|
|
||||||
ChipArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
Design *design;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(UP5KTest, bel_names)
|
TEST_F(UP5KTest, bel_names)
|
||||||
{
|
{
|
||||||
int bel_count = 0;
|
int bel_count = 0;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = ctx->getBelName(bel);
|
||||||
ASSERT_EQ(bel, design->chip.getBelByName(name));
|
ASSERT_EQ(bel, ctx->getBelByName(name));
|
||||||
bel_count++;
|
bel_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(bel_count, 5414);
|
ASSERT_EQ(bel_count, 5438);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(UP5KTest, wire_names)
|
TEST_F(UP5KTest, wire_names)
|
||||||
{
|
{
|
||||||
int wire_count = 0;
|
int wire_count = 0;
|
||||||
for (auto wire : design->chip.getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto name = design->chip.getWireName(wire);
|
auto name = ctx->getWireName(wire);
|
||||||
assert(wire == design->chip.getWireByName(name));
|
assert(wire == ctx->getWireByName(name));
|
||||||
wire_count++;
|
wire_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(wire_count, 103383);
|
ASSERT_EQ(wire_count, 103383);
|
||||||
@ -45,9 +46,9 @@ TEST_F(UP5KTest, wire_names)
|
|||||||
TEST_F(UP5KTest, pip_names)
|
TEST_F(UP5KTest, pip_names)
|
||||||
{
|
{
|
||||||
int pip_count = 0;
|
int pip_count = 0;
|
||||||
for (auto pip : design->chip.getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto name = design->chip.getPipName(pip);
|
auto name = ctx->getPipName(pip);
|
||||||
assert(pip == design->chip.getPipByName(name));
|
assert(pip == ctx->getPipByName(name));
|
||||||
pip_count++;
|
pip_count++;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(pip_count, 1219104);
|
ASSERT_EQ(pip_count, 1219104);
|
||||||
@ -55,11 +56,11 @@ TEST_F(UP5KTest, pip_names)
|
|||||||
|
|
||||||
TEST_F(UP5KTest, uphill_to_downhill)
|
TEST_F(UP5KTest, uphill_to_downhill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(dst)) {
|
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||||
bool found_downhill = false;
|
bool found_downhill = false;
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(
|
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||||
design->chip.getPipSrcWire(uphill_pip))) {
|
ctx->getPipSrcWire(uphill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_downhill);
|
ASSERT_FALSE(found_downhill);
|
||||||
found_downhill = true;
|
found_downhill = true;
|
||||||
@ -72,11 +73,11 @@ TEST_F(UP5KTest, uphill_to_downhill)
|
|||||||
|
|
||||||
TEST_F(UP5KTest, downhill_to_uphill)
|
TEST_F(UP5KTest, downhill_to_uphill)
|
||||||
{
|
{
|
||||||
for (auto dst : design->chip.getWires()) {
|
for (auto dst : ctx->getWires()) {
|
||||||
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) {
|
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||||
bool found_uphill = false;
|
bool found_uphill = false;
|
||||||
for (auto uphill_pip : design->chip.getPipsUphill(
|
for (auto uphill_pip : ctx->getPipsUphill(
|
||||||
design->chip.getPipDstWire(downhill_pip))) {
|
ctx->getPipDstWire(downhill_pip))) {
|
||||||
if (uphill_pip == downhill_pip) {
|
if (uphill_pip == downhill_pip) {
|
||||||
ASSERT_FALSE(found_uphill);
|
ASSERT_FALSE(found_uphill);
|
||||||
found_uphill = true;
|
found_uphill = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user