Compare commits

...

6 Commits

Author SHA1 Message Date
Catherine
2daad1db29 himbaechel: allow subsetting uarches.
E.g. selecting only Gowin instead of the default shrinks the resulting
binary by ~30%.
2025-01-11 22:46:34 +00:00
Catherine
3708addfdd Gowin: remove unnecessary std::move.
These calls inhibit RVO, a stronger optimization than moving an object.
2025-01-11 22:34:00 +00:00
Catherine
a58735bc57 himbaechel: add missing override qualifiers. 2025-01-11 22:33:59 +00:00
Catherine
b3d126c090 kernel: fix incorrect printf-style format. 2025-01-11 22:33:59 +00:00
Catherine
9dcd27ee98 Gowin: add header includes required on libstdc++. 2025-01-11 22:33:58 +00:00
Catherine
bb9d88d918 Find all components of Python at the same time.
This is explicitly recommended by the FindPython module documentation
and is required to avoid failed builds on some systems. See:
https://cmake.org/cmake/help/latest/module/FindPython.html
2025-01-11 21:26:23 +00:00
12 changed files with 31 additions and 24 deletions

View File

@ -10,7 +10,7 @@ cmake_policy(SET CMP0079 NEW)
# compilation database as not all clang/gcc share the same implicit includes
# leading to essentially non-working compile_commands.json
if(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
@ -191,11 +191,11 @@ if (BUILD_GUI)
set(CMAKE_ENABLE_EXPORTS ON)
endif()
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
if (BUILD_PYTHON)
# TODO: sensible minimum Python version
find_package(Python3 3.5 REQUIRED COMPONENTS Development)
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter Development.Embed)
else()
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
add_definitions("-DNO_PYTHON")
endif()

View File

@ -35,6 +35,7 @@
#include <iostream>
#include <random>
#include <set>
#include <cinttypes>
#include "command.h"
#include "design_utils.h"
@ -459,7 +460,7 @@ void CommandHandler::setupContext(Context *ctx)
std::uniform_int_distribution<uint64_t> distrib{1};
auto seed = distrib(randDev);
ctx->rngstate = seed;
log_info("Generated random seed: %lu\n", seed);
log_info("Generated random seed: %" PRIu64 "\n", seed);
}
if (vm.count("slack_redist_iter")) {

View File

@ -9,8 +9,6 @@ message(STATUS "Enabled ECP5 devices: ${ECP5_DEVICES}")
if(DEFINED ECP5_CHIPDB)
add_custom_target(chipdb-ecp5-bbas ALL)
else()
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
# shared among all families
set(SERIALIZE_CHIPDBS TRUE CACHE BOOL
"Serialize device data preprocessing to minimize memory use")

View File

@ -1,5 +1,15 @@
set(HIMBAECHEL_UARCHES "example;gowin;xilinx;ng-ultra")
foreach(uarch ${HIMBAECHEL_UARCHES})
set(HIMBAECHEL_UARCH "${HIMBAECHEL_UARCHES}" CACHE STRING "Microarchitectures for nextpnr-himbaechel build")
set_property(CACHE HIMBAECHEL_UARCH PROPERTY STRINGS ${HIMBAECHEL_UARCHES})
foreach(item ${HIMBAECHEL_UARCH})
if (NOT item IN_LIST HIMBAECHEL_UARCHES)
message(FATAL_ERROR "Microarchitecture '${item}' not in list of supported architectures")
endif()
endforeach()
foreach(uarch ${HIMBAECHEL_UARCH})
add_subdirectory(${family}/uarch/${uarch})
aux_source_directory(${family}/uarch/${uarch} HM_UARCH_FILES)
foreach(target ${family_targets})

View File

@ -194,7 +194,7 @@ struct ExampleImpl : HimbaechelAPI
}
void drawWire(std::vector<GraphicElement> &g, GraphicElement::style_t style, Loc loc, IdString wire_type,
int32_t tilewire, IdString tile_type)
int32_t tilewire, IdString tile_type) override
{
GraphicElement el;
el.type = GraphicElement::TYPE_LINE;
@ -308,7 +308,7 @@ struct ExampleImpl : HimbaechelAPI
}
void drawPip(std::vector<GraphicElement> &g, GraphicElement::style_t style, Loc loc, WireId src, IdString src_type,
int32_t src_id, WireId dst, IdString dst_type, int32_t dst_id)
int32_t src_id, WireId dst, IdString dst_type, int32_t dst_id) override
{
GraphicElement el;
el.type = GraphicElement::TYPE_ARROW;
@ -329,7 +329,7 @@ struct ExampleArch : HimbaechelArch
{
ExampleArch() : HimbaechelArch("example") {};
bool match_device(const std::string &device) override { return device == "EXAMPLE"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args)
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{
return std::make_unique<ExampleImpl>();
}

View File

@ -2,7 +2,6 @@ message(STATUS "Configuring Himbaechel-Gowin uarch")
cmake_minimum_required(VERSION 3.5)
project(himbaechel-gowin-chipdb NONE)
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
set(ALL_HIMBAECHEL_GOWIN_DEVICES GW1N-1 GW1NZ-1 GW1N-4 GW1N-9 GW1N-9C GW1NS-4 GW2A-18 GW2A-18C)
set(HIMBAECHEL_GOWIN_DEVICES "" CACHE STRING
"Include support for these Gowin devices (available: ${ALL_HIMBAECHEL_GOWIN_DEVICES})")

View File

@ -1,4 +1,5 @@
#include <regex>
#include <map>
#include "himbaechel_api.h"
#include "himbaechel_helpers.h"
@ -43,9 +44,9 @@ struct GowinImpl : HimbaechelAPI
bool checkPipAvail(PipId pip) const override;
// Cluster
bool isClusterStrict(const CellInfo *cell) const { return true; }
bool isClusterStrict(const CellInfo *cell) const override { return true; }
bool getClusterPlacement(ClusterId cluster, BelId root_bel,
std::vector<std::pair<CellInfo *, BelId>> &placement) const;
std::vector<std::pair<CellInfo *, BelId>> &placement) const override;
private:
HimbaechelHelpers h;
@ -109,7 +110,7 @@ struct GowinArch : HimbaechelArch
bool match_device(const std::string &device) override { return device.size() > 2 && device.substr(0, 2) == "GW"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args)
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{
return std::make_unique<GowinImpl>();
}

View File

@ -1,3 +1,5 @@
#include <map>
#include "design_utils.h"
#include "log.h"
#include "nextpnr.h"
@ -1738,7 +1740,7 @@ struct GowinPacker
}
// always prepend first ALU with carry generator block
// three cases: CIN == 0, CIN == 1 and CIN == ?
new_cells.push_back(std::move(alu_add_cin_block(ctx, ci, cin_net)));
new_cells.push_back(alu_add_cin_block(ctx, ci, cin_net));
CellInfo *cin_block_ci = new_cells.back().get();
// CIN block is the cluster root and is always placed in ALU0
// This is a possible place for further optimization
@ -1784,7 +1786,7 @@ struct GowinPacker
break;
}
if (CellTypePort(*cout_net->users.begin()) != cell_alu_cin || cout_net->users.entries() > 1) {
new_cells.push_back(std::move(alu_add_cout_block(ctx, ci, cout_net)));
new_cells.push_back(alu_add_cout_block(ctx, ci, cout_net));
CellInfo *cout_block_ci = new_cells.back().get();
cin_block_ci->constr_children.push_back(cout_block_ci);
NPNR_ASSERT(cout_block_ci->cluster == ClusterId());
@ -1807,7 +1809,7 @@ struct GowinPacker
// ALUs are always paired
if (alu_chain_len & 1) {
// create dummy cell
new_cells.push_back(std::move(alu_add_dummy_block(ctx, ci)));
new_cells.push_back(alu_add_dummy_block(ctx, ci));
CellInfo *dummy_block_ci = new_cells.back().get();
cin_block_ci->constr_children.push_back(dummy_block_ci);
NPNR_ASSERT(dummy_block_ci->cluster == ClusterId());
@ -1907,7 +1909,7 @@ struct GowinPacker
// make actual storage cells
for (int i = 0; i < 4; ++i) {
new_cells.push_back(std::move(ssram_make_lut(ctx, ci, i)));
new_cells.push_back(ssram_make_lut(ctx, ci, i));
CellInfo *lut_ci = new_cells.back().get();
ci->constr_children.push_back(lut_ci);
lut_ci->cluster = ci->name;

View File

@ -1060,7 +1060,7 @@ struct NgUltraArch : HimbaechelArch
{
NgUltraArch() : HimbaechelArch("ng-ultra") {};
bool match_device(const std::string &device) override { return device == "NG-ULTRA"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args)
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{
return std::make_unique<NgUltraImpl>();
}

View File

@ -569,7 +569,7 @@ struct XilinxArch : HimbaechelArch
{
XilinxArch() : HimbaechelArch("xilinx") {};
bool match_device(const std::string &device) override { return device.size() > 3 && device.substr(0, 3) == "xc7"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args)
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{
return std::make_unique<XilinxImpl>();
}

View File

@ -9,8 +9,6 @@ message(STATUS "Enabled iCE40 devices: ${ICE40_DEVICES}")
if(DEFINED ICE40_CHIPDB)
add_custom_target(chipdb-ice40-bbas ALL)
else()
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
# shared among all families
set(SERIALIZE_CHIPDBS TRUE CACHE BOOL
"Serialize device data preprocessing to minimize memory use")

View File

@ -9,8 +9,6 @@ message(STATUS "Enabled MachXO2/XO3 devices: ${MACHXO2_DEVICES}")
if(DEFINED MACHXO2_CHIPDB)
add_custom_target(chipdb-machxo2-bbas ALL)
else()
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
# shared among all families
set(SERIALIZE_CHIPDBS TRUE CACHE BOOL
"Serialize device data preprocessing to minimize memory use")