From 2f61a9b98a621a35aa4763abaaf27ca12bfbbefa Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 12 Jun 2018 12:13:11 +0200 Subject: ice40: Start working on a packer, currently not tested Signed-off-by: David Shah --- common/design_utils.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common') diff --git a/common/design_utils.h b/common/design_utils.h index 43ff180b..9d027d58 100644 --- a/common/design_utils.h +++ b/common/design_utils.h @@ -37,6 +37,8 @@ template CellInfo *net_only_drives(NetInfo *net, F1 cell_pred, IdString port, bool exclusive = false) { + if (net == nullptr) + return nullptr; if (exclusive && (net->users.size() != 1)) { return nullptr; } else { @@ -54,6 +56,8 @@ CellInfo *net_only_drives(NetInfo *net, F1 cell_pred, IdString port, template CellInfo *net_driven_by(NetInfo *net, F1 cell_pred, IdString port) { + if (net == nullptr) + return nullptr; if (cell_pred(net->driver.cell) && net->driver.port == port) { return net->driver.cell; } else { -- cgit v1.2.3 From 47eeda40bce5b520f1c5aafb52f5b4c11b799d60 Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 12 Jun 2018 13:45:59 +0200 Subject: Implement the placement validity checker Signed-off-by: David Shah --- common/place.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/place.cc b/common/place.cc index 0223c78f..b187b0f0 100644 --- a/common/place.cc +++ b/common/place.cc @@ -28,6 +28,7 @@ #include #include +#include "arch_place.h" #include "log.h" #include "place.h" @@ -102,7 +103,8 @@ void place_design(Design *design) while ((bi != blist.end()) && ((design->chip.getBelType(*bi) != bel_type || - !design->chip.checkBelAvail(*bi)))) + !design->chip.checkBelAvail(*bi)) || + !isValidBelForCell(design, cell, *bi))) bi++; if (bi == blist.end()) log_error("Too many \'%s\' used in design\n", -- cgit v1.2.3