From 1f25f2067a1fca9d7da0440ea80525ceffe1b297 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 29 Feb 2024 09:15:55 +0100 Subject: [PATCH] Make example more like other arch --- himbaechel/uarch/example/CMakeLists.txt | 29 ++++++++++++++++++++ himbaechel/uarch/example/example.cc | 2 +- himbaechel/uarch/example/example_arch_gen.py | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/himbaechel/uarch/example/CMakeLists.txt b/himbaechel/uarch/example/CMakeLists.txt index bc1c3b59..046f0130 100644 --- a/himbaechel/uarch/example/CMakeLists.txt +++ b/himbaechel/uarch/example/CMakeLists.txt @@ -1,2 +1,31 @@ message(STATUS "Configuring Himbaechel-Example uarch") +cmake_minimum_required(VERSION 3.5) +project(himbaechel-example-chipdb NONE) +set(ALL_HIMBAECHEL_EXAMPLE_DEVICES example) +set(HIMBAECHEL_EXAMPLE_DEVICES "" CACHE STRING + "Include support for these Example devices (available: ${ALL_HIMBAECHEL_EXAMPLE_DEVICES})") +message(STATUS "Enabled Himbaechel-Example devices: ${HIMBAECHEL_EXAMPLE_DEVICES}") + +set(chipdb_binaries) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/example) +foreach(device ${HIMBAECHEL_EXAMPLE_DEVICES}) + set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/example/chipdb-${device}.bba) + set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/example/chipdb-${device}.bin) + add_custom_command( + OUTPUT ${device_bin} + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_arch_gen.py ${device_bba} + COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new + # atomically update + COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin} + DEPENDS + bbasm + ${CMAKE_CURRENT_SOURCE_DIR}/example_arch_gen.py + ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc + VERBATIM) + list(APPEND chipdb_binaries ${device_bin}) +endforeach() + +add_custom_target(chipdb-himbaechel-example ALL DEPENDS ${chipdb_binaries}) +install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/example/ DESTINATION share/nextpnr/himbaechel/example + PATTERN "*.bba" EXCLUDE) diff --git a/himbaechel/uarch/example/example.cc b/himbaechel/uarch/example/example.cc index 4e8dff4a..5172d5cf 100644 --- a/himbaechel/uarch/example/example.cc +++ b/himbaechel/uarch/example/example.cc @@ -40,7 +40,7 @@ struct ExampleImpl : HimbaechelAPI void init_database(Arch *arch) override { init_uarch_constids(arch); - arch->load_chipdb("example/example.bin"); + arch->load_chipdb("example/chipdb-example.bin"); arch->set_speed_grade("DEFAULT"); } diff --git a/himbaechel/uarch/example/example_arch_gen.py b/himbaechel/uarch/example/example_arch_gen.py index d4d0496b..cbfefd61 100644 --- a/himbaechel/uarch/example/example_arch_gen.py +++ b/himbaechel/uarch/example/example_arch_gen.py @@ -170,7 +170,7 @@ def is_corner(x, y): def create_nodes(ch): for y in range(Y): - print(f"generating nodes for row {y}") + #print(f"generating nodes for row {y}") for x in range(X): if not is_corner(x, y): # connect up actual neighbours