Expose private members for unit tests

This commit is contained in:
Miodrag Milanovic 2024-07-08 09:10:32 +02:00
parent f3e098bbde
commit 1f96a5f5d7
3 changed files with 16 additions and 5 deletions

View File

@ -30,6 +30,12 @@
#include "himbaechel_helpers.h"
#ifdef GTEST_API_
#define TESTABLE_PRIVATE public
#else
#define TESTABLE_PRIVATE private
#endif
NEXTPNR_NAMESPACE_BEGIN
struct NgUltraImpl : HimbaechelAPI
@ -88,7 +94,7 @@ public:
dict<BelId, IdString> unused_pll;
dict<BelId, BelId> dsp_cascade;
private:
TESTABLE_PRIVATE:
void write_bitstream_json(const std::string &filename);
void route_lowskew();
void parse_csv(const std::string &filename);

View File

@ -181,7 +181,7 @@ void NgUltraPacker::update_dffs()
}
}
int make_init_with_const_input(int init, int input, bool value)
int NgUltraPacker::make_init_with_const_input(int init, int input, bool value)
{
int new_init = 0;
for (int i = 0; i < 16; i++) {
@ -1441,7 +1441,7 @@ void NgUltraPacker::mandatory_param(CellInfo *cell, IdString param)
log_error("Mandatory parameter '%s' of cell '%s'(%s) is missing.\n", param.c_str(ctx), cell->name.c_str(ctx), cell->type.c_str(ctx));
}
static int memory_width(int config, bool ecc)
int NgUltraPacker::memory_width(int config, bool ecc)
{
if (ecc) {
if (config==4)
@ -1464,7 +1464,7 @@ static int memory_width(int config, bool ecc)
}
}
static int memory_addr_bits(int config,bool ecc)
int NgUltraPacker::memory_addr_bits(int config,bool ecc)
{
if (ecc) {
if (config==4)

View File

@ -73,7 +73,7 @@ struct NgUltraPacker
void duplicate_gck();
void insert_bypass_gck();
private:
TESTABLE_PRIVATE:
void set_lut_input_if_constant(CellInfo *cell, IdString input);
void lut_to_fe(CellInfo *lut, CellInfo *fe, bool no_dff, Property lut_table);
void dff_to_fe(CellInfo *dff, CellInfo *fe, bool pass_thru_lut);
@ -100,6 +100,11 @@ private:
void dsp_same_driver(IdString port, CellInfo *cell, CellInfo **target);
void dsp_same_sink(IdString port, CellInfo *cell, CellInfo **target);
int make_init_with_const_input(int init, int input, bool value);
int memory_width(int config, bool ecc);
int memory_addr_bits(int config,bool ecc);
void constrain_location(CellInfo *cell);
// Cell creating
std::unique_ptr<CellInfo> create_cell(IdString type, IdString name);