Use NEXTPNR_NAMESPACE macro's now that headers are seperated.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
parent
a8e35062c6
commit
351ca3b5ea
@ -19,10 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bits.h"
|
#include "bits.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace nextpnr {
|
#include "log.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
int Bits::generic_popcount(unsigned int v)
|
int Bits::generic_popcount(unsigned int v)
|
||||||
{
|
{
|
||||||
@ -37,7 +40,7 @@ int Bits::generic_popcount(unsigned int v)
|
|||||||
int Bits::generic_ctz(unsigned int x)
|
int Bits::generic_ctz(unsigned int x)
|
||||||
{
|
{
|
||||||
if (x == 0) {
|
if (x == 0) {
|
||||||
throw std::runtime_error("Cannot call ctz with arg = 0");
|
log_error("Cannot call ctz with arg = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < std::numeric_limits<unsigned int>::digits; ++i) {
|
for (size_t i = 0; i < std::numeric_limits<unsigned int>::digits; ++i) {
|
||||||
@ -47,7 +50,7 @@ int Bits::generic_ctz(unsigned int x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unreachable!
|
// Unreachable!
|
||||||
throw std::runtime_error("Unreachable!");
|
log_error("Unreachable!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace nextpnr
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
#pragma intrinsic(_BitScanForward, _BitScanReverse, __popcnt)
|
#pragma intrinsic(_BitScanForward, _BitScanReverse, __popcnt)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Uses plain nextpnr namespace to avoid header inclusion nightmare that is
|
#include "nextpnr_namespaces.h"
|
||||||
// "nextpnr.h".
|
|
||||||
namespace nextpnr {
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
struct Bits
|
struct Bits
|
||||||
{
|
{
|
||||||
@ -71,6 +71,6 @@ struct Bits
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace nextpnr
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* BITS_H */
|
#endif /* BITS_H */
|
||||||
|
@ -17,18 +17,19 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_BITARRAY_H
|
||||||
|
#define DYNAMIC_BITARRAY_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "nextpnr_namespaces.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
// This class implements a simple dynamic bitarray, backed by some resizable
|
// This class implements a simple dynamic bitarray, backed by some resizable
|
||||||
// random access storage. The default is to use a std::vector<uint8_t>.
|
// random access storage. The default is to use a std::vector<uint8_t>.
|
||||||
|
|
||||||
#ifndef DYNAMIC_BITARRAY_H
|
|
||||||
#define DYNAMIC_BITARRAY_H
|
|
||||||
|
|
||||||
namespace nextpnr {
|
|
||||||
|
|
||||||
template <typename Storage = std::vector<uint8_t>> class DynamicBitarray
|
template <typename Storage = std::vector<uint8_t>> class DynamicBitarray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -76,6 +77,6 @@ template <typename Storage = std::vector<uint8_t>> class DynamicBitarray
|
|||||||
Storage storage;
|
Storage storage;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace nextpnr
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* DYNAMIC_BITARRAY_H */
|
#endif /* DYNAMIC_BITARRAY_H */
|
||||||
|
@ -111,10 +111,10 @@ template <size_t StateCount, typename StateType = int8_t, typename CountType = u
|
|||||||
|
|
||||||
// Check whether the state group is now unselected or satified.
|
// Check whether the state group is now unselected or satified.
|
||||||
auto value = selected_states.to_ulong();
|
auto value = selected_states.to_ulong();
|
||||||
auto number_selected = nextpnr::Bits::popcount(value);
|
auto number_selected = Bits::popcount(value);
|
||||||
if (number_selected == 1) {
|
if (number_selected == 1) {
|
||||||
// Group is no longer overconstrained.
|
// Group is no longer overconstrained.
|
||||||
state = nextpnr::Bits::ctz(value);
|
state = Bits::ctz(value);
|
||||||
NPNR_ASSERT(selected_states[state]);
|
NPNR_ASSERT(selected_states[state]);
|
||||||
} else if (number_selected == 0) {
|
} else if (number_selected == 0) {
|
||||||
// Group is unselected.
|
// Group is unselected.
|
||||||
|
@ -144,7 +144,7 @@ class SAPlacer
|
|||||||
{
|
{
|
||||||
log_break();
|
log_break();
|
||||||
|
|
||||||
nextpnr::ScopeLock<Context> lock(ctx);
|
ScopeLock<Context> lock(ctx);
|
||||||
|
|
||||||
size_t placed_cells = 0;
|
size_t placed_cells = 0;
|
||||||
std::vector<CellInfo *> autoplaced;
|
std::vector<CellInfo *> autoplaced;
|
||||||
|
@ -151,7 +151,7 @@ class HeAPPlacer
|
|||||||
{
|
{
|
||||||
auto startt = std::chrono::high_resolution_clock::now();
|
auto startt = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
nextpnr::ScopeLock<Context> lock(ctx);
|
ScopeLock<Context> lock(ctx);
|
||||||
place_constraints();
|
place_constraints();
|
||||||
build_fast_bels();
|
build_fast_bels();
|
||||||
seed_placement();
|
seed_placement();
|
||||||
|
@ -806,7 +806,7 @@ bool router1(Context *ctx, const Router1Cfg &cfg)
|
|||||||
try {
|
try {
|
||||||
log_break();
|
log_break();
|
||||||
log_info("Routing..\n");
|
log_info("Routing..\n");
|
||||||
nextpnr::ScopeLock<Context> lock(ctx);
|
ScopeLock<Context> lock(ctx);
|
||||||
auto rstart = std::chrono::high_resolution_clock::now();
|
auto rstart = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
log_info("Setting up routing queue.\n");
|
log_info("Setting up routing queue.\n");
|
||||||
|
@ -1218,7 +1218,7 @@ struct Router2
|
|||||||
ThreadContext st;
|
ThreadContext st;
|
||||||
int iter = 1;
|
int iter = 1;
|
||||||
|
|
||||||
nextpnr::ScopeLock<Context> lock(ctx);
|
ScopeLock<Context> lock(ctx);
|
||||||
|
|
||||||
for (size_t i = 0; i < nets_by_udata.size(); i++)
|
for (size_t i = 0; i < nets_by_udata.size(); i++)
|
||||||
route_queue.push_back(i);
|
route_queue.push_back(i);
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace nextpnr {
|
#include "nextpnr_namespaces.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
// Provides a simple RAII locking object. ScopeLock takes a lock when
|
// Provides a simple RAII locking object. ScopeLock takes a lock when
|
||||||
// constructed, and releases the lock on destruction or if "unlock_early" is
|
// constructed, and releases the lock on destruction or if "unlock_early" is
|
||||||
@ -60,6 +62,6 @@ template <typename LockingObject> class ScopeLock
|
|||||||
bool locked_;
|
bool locked_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace nextpnr
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* SCOPE_LOCK_H */
|
#endif /* SCOPE_LOCK_H */
|
||||||
|
@ -1267,7 +1267,7 @@ void Arch::report_invalid_bel(BelId bel, CellInfo *cell) const
|
|||||||
nameOfBel(bel), mapping);
|
nameOfBel(bel), mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arch::read_lut_equation(nextpnr::DynamicBitarray<> *equation, const Property &equation_parameter) const
|
void Arch::read_lut_equation(DynamicBitarray<> *equation, const Property &equation_parameter) const
|
||||||
{
|
{
|
||||||
equation->fill(false);
|
equation->fill(false);
|
||||||
std::string eq_str = equation_parameter.as_string();
|
std::string eq_str = equation_parameter.as_string();
|
||||||
|
@ -1737,7 +1737,7 @@ struct Arch : ArchAPI<ArchRanges>
|
|||||||
std::regex raw_bin_constant;
|
std::regex raw_bin_constant;
|
||||||
std::regex verilog_bin_constant;
|
std::regex verilog_bin_constant;
|
||||||
std::regex verilog_hex_constant;
|
std::regex verilog_hex_constant;
|
||||||
void read_lut_equation(nextpnr::DynamicBitarray<> *equation, const Property &equation_parameter) const;
|
void read_lut_equation(DynamicBitarray<> *equation, const Property &equation_parameter) const;
|
||||||
bool route_vcc_to_unused_lut_pins();
|
bool route_vcc_to_unused_lut_pins();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
bool rotate_and_merge_lut_equation(std::vector<LogicLevel> *result, const LutBel &lut_bel,
|
bool rotate_and_merge_lut_equation(std::vector<LogicLevel> *result, const LutBel &lut_bel,
|
||||||
const nextpnr::DynamicBitarray<> &old_equation, const std::vector<int32_t> &pin_map,
|
const DynamicBitarray<> &old_equation, const std::vector<int32_t> &pin_map,
|
||||||
uint32_t used_pins)
|
uint32_t used_pins)
|
||||||
{
|
{
|
||||||
// pin_map maps pin indicies from the old pin to the new pin.
|
// pin_map maps pin indicies from the old pin to the new pin.
|
||||||
|
@ -46,7 +46,7 @@ struct LutCell
|
|||||||
std::vector<IdString> pins;
|
std::vector<IdString> pins;
|
||||||
std::unordered_set<IdString> lut_pins;
|
std::unordered_set<IdString> lut_pins;
|
||||||
std::unordered_set<IdString> vcc_pins;
|
std::unordered_set<IdString> vcc_pins;
|
||||||
nextpnr::DynamicBitarray<> equation;
|
DynamicBitarray<> equation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LutBel
|
struct LutBel
|
||||||
@ -94,7 +94,7 @@ struct LutMapper
|
|||||||
//
|
//
|
||||||
// If a conflict arises, return false and result is in an indeterminate state.
|
// If a conflict arises, return false and result is in an indeterminate state.
|
||||||
bool rotate_and_merge_lut_equation(std::vector<LogicLevel> *result, const LutBel &lut_bel,
|
bool rotate_and_merge_lut_equation(std::vector<LogicLevel> *result, const LutBel &lut_bel,
|
||||||
const nextpnr::DynamicBitarray<> &old_equation, const std::vector<size_t> &pin_map,
|
const DynamicBitarray<> &old_equation, const std::vector<size_t> &pin_map,
|
||||||
uint32_t used_pins);
|
uint32_t used_pins);
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
2
tests
2
tests
@ -1 +1 @@
|
|||||||
Subproject commit 34c511444eff51291fa732369e434ff687de310f
|
Subproject commit a751e0d9081477e33c620b5224ccd2026f2fa0cf
|
Loading…
Reference in New Issue
Block a user