Advertisement
Guest User

Untitled

a guest
Apr 11th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.90 KB | None | 0 0
  1. diff --git a/common/design_utils.h b/common/design_utils.h
  2. index 8a42d21..f3d91e6 100644
  3. --- a/common/design_utils.h
  4. +++ b/common/design_utils.h
  5. @@ -82,6 +82,13 @@ template <typename F1> CellInfo *net_driven_by(const Context *ctx, const NetInfo
  6.      }
  7.  }
  8.  
  9. +// If a net is NULL or doesn't go anywhere
  10. +static inline bool
  11. +net_is_unused( const NetInfo *net)
  12. +{
  13. +   return (net == nullptr) || (net->users.size() == 0);
  14. +}
  15. +
  16.  // Connect a net to a port
  17.  void connect_port(const Context *ctx, NetInfo *net, CellInfo *cell, IdString port_name);
  18.  
  19. diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc
  20. index f3a6274..a4cf944 100644
  21. --- a/ice40/arch_place.cc
  22. +++ b/ice40/arch_place.cc
  23. @@ -151,7 +151,7 @@ bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const
  24.                      break;
  25.  
  26.                  // Is that SB_IO used at an input ?
  27. -                if ((cell->ports[id_D_IN_0].net == nullptr) && (cell->ports[id_D_IN_1].net == nullptr))
  28. +                if (net_is_unused(cell->ports[id_D_IN_0].net) && net_is_unused(cell->ports[id_D_IN_1].net))
  29.                      break;
  30.  
  31.                  // Are we perhaps a PAD INPUT Bel that can be placed here?
  32. diff --git a/ice40/pack.cc b/ice40/pack.cc
  33. index 4de88ab..0140d68 100644
  34. --- a/ice40/pack.cc
  35. +++ b/ice40/pack.cc
  36. @@ -804,8 +804,8 @@ static void place_plls(Context *ctx)
  37.          // Only consider bound IO that are used as inputs
  38.          if (!io_ci->attrs.count(ctx->id("BEL")))
  39.              continue;
  40. -        if ((!io_ci->ports.count(id_D_IN_0) || (io_ci->ports[id_D_IN_0].net == nullptr)) &&
  41. -            (!io_ci->ports.count(id_D_IN_1) || (io_ci->ports[id_D_IN_1].net == nullptr)))
  42. +        if ((!io_ci->ports.count(id_D_IN_0) || net_is_unused(io_ci->ports[id_D_IN_0].net)) &&
  43. +            (!io_ci->ports.count(id_D_IN_1) || net_is_unused(io_ci->ports[id_D_IN_1].net)))
  44.              continue;
  45.  
  46.          // Check all placed PLL (either forced by user, or forced by PACKAGEPIN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement