1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-01-26 20:22:44 +00:00

Use Bits library for bit instrisics.

Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
Keith Rothman
2021-02-17 10:49:19 -08:00
parent 558a753d3d
commit 8f668f06ca

View File

@@ -24,6 +24,8 @@
#error Include after "nextpnr.h" only.
#endif
#include "bits.h"
NEXTPNR_NAMESPACE_BEGIN
// Implementation for exclusive state groups, used to implement generic
@@ -103,10 +105,10 @@ template <size_t StateCount, typename StateType = int8_t, typename CountType = u
// Check whether the state group is now unselected or satified.
auto value = selected_states.to_ulong();
auto number_selected = __builtin_popcount(value);
auto number_selected = nextpnr::Bits::popcount(value);
if (number_selected == 1) {
// Group is no longer overconstrained.
state = __builtin_ctz(value);
state = nextpnr::Bits::ctz(value);
NPNR_ASSERT(selected_states[state]);
} else if (number_selected == 0) {
// Group is unselected.