Skip to content

Commit

Permalink
Further compilation fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrizioferrandi committed Nov 23, 2022
1 parent 5dfc32e commit 4b0abcb
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/HLS/binding/interconnection/conn_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ void conn_binding::print() const
}
}

unsigned int conn_binding::determine_bit_level_mux() const
unsigned long long conn_binding::determine_bit_level_mux() const
{
CustomOrderedSet<generic_objRef> mux;
for(const auto& it : conn_implementation)
Expand All @@ -1006,7 +1006,7 @@ unsigned int conn_binding::determine_bit_level_mux() const
mux.insert(v.first);
}
}
unsigned int bit_mux = 0;
auto bit_mux = 0ull;
for(const auto& m : mux)
{
bit_mux += GetPointer<mux_obj>(m)->get_bitsize();
Expand Down
2 changes: 1 addition & 1 deletion src/HLS/binding/interconnection/conn_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class conn_binding
/**
* Returns the number of bit-level multiplexers
*/
unsigned int determine_bit_level_mux() const;
unsigned long long determine_bit_level_mux() const;

const std::map<unsigned int, Selectors>& GetSelectors() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/HLS/binding/interconnection/mux_connection_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ void mux_connection_binding::determine_connection(const vertex& op, const HLS_ma
auto base_index = GET_INDEX_NODE(ipe->op);
auto offset = tree_helper::Size(tree_helper::CGetType(ipe->op)) / 16;
#if USE_ALIGNMENT_INFO
alignment = (8 * offset) & (alignment - 1);
alignment = static_cast<unsigned int>(8 * offset) & (alignment - 1);
#endif
generic_objRef address_port = generic_objRef(new adder_conn_obj("adder_conn_obj_" + STR(id++)));
auto local_precision = address_precision(precision, op, data, TreeM);
Expand Down
2 changes: 1 addition & 1 deletion src/HLS/binding/module/fu_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ void fu_binding::fill_array_ref_memory(std::ostream& init_file_a, std::ostream&
}
if(counter % (nbyte_on_memory * 8) != 0)
{
for(unsigned int l = counter % (nbyte_on_memory * 8); l < (nbyte_on_memory * 8); ++l)
for(auto l = counter % (nbyte_on_memory * 8); l < (nbyte_on_memory * 8); ++l)
{
if(is_even || !is_memory_splitted)
{
Expand Down
4 changes: 2 additions & 2 deletions src/HLS/binding/register/reg_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ void reg_binding::add_to_SM(structural_objectRef clock_port, structural_objectRe
PRINT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug, "reg_binding::add_registers - End");
if(HLS->output_level >= OUTPUT_LEVEL_MINIMUM)
{
unsigned int number_ff = 0;
for(unsigned int r = 0; r < get_used_regs(); r++)
auto number_ff = 0ull;
for(auto r = 0U; r < get_used_regs(); r++)
{
number_ff += get_bitsize(r);
}
Expand Down
4 changes: 4 additions & 0 deletions src/HLS/virtual_components/mux_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ unsigned int mux_obj::get_level() const
{
return level;
}
unsigned long long mux_obj::get_bitsize() const
{
return bitsize;
}
5 changes: 1 addition & 4 deletions src/HLS/virtual_components/mux_obj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ class mux_obj : public generic_obj
/**
* return the maximum bitsize associated with the component
*/
unsigned long long get_bitsize() const
{
return bitsize;
}
unsigned long long get_bitsize() const;
};

/// RefCount definition for the class
Expand Down
4 changes: 2 additions & 2 deletions src/circuit/structural_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,12 +1246,12 @@ void port_o::set_port_interface(port_interface _pi)
pi = _pi;
}

unsigned long long port_o::get_port_alignment() const
unsigned int port_o::get_port_alignment() const
{
return aligment;
}

void port_o::set_port_alignment(unsigned long long algn)
void port_o::set_port_alignment(unsigned int algn)
{
aligment = algn;
}
Expand Down
6 changes: 3 additions & 3 deletions src/circuit/structural_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,12 +793,12 @@ struct port_o : public structural_object
/**
* Return the port interface alignment.
*/
unsigned long long get_port_alignment() const;
unsigned int get_port_alignment() const;

/**
* Set the port interface alignment.
*/
void set_port_alignment(unsigned long long algn);
void set_port_alignment(unsigned int algn);

/**
* Return the connected signal, if any. Null pointer otherwise.
Expand Down Expand Up @@ -1131,7 +1131,7 @@ struct port_o : public structural_object
/// port interface type of a port
port_interface pi;

unsigned long long aligment;
unsigned int aligment;

/// when true the port must be specialized at runtime depending on the number of input
bool is_var_args;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ void HLSCWriter::WriteSimulatorInitMemory(const unsigned int function_id)

data_bitsize = tree_helper::GetArrayElementSize(ptd_base_type_node);

unsigned int num_elements = 1;
auto num_elements = 1ull;
if(splitted.size() == 1)
{
num_elements = tree_helper::GetArrayTotalSize(ptd_base_type_node);
Expand Down
12 changes: 6 additions & 6 deletions src/frontend_analysis/IR_analysis/InterfaceInfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ DesignFlowStep_Status InterfaceInfer::Exec()
}();
THROW_ASSERT(input_bw, "unexpected condition");
unsigned int n_resources;
unsigned long long alignment;
unsigned int alignment;
ComputeResourcesAlignment(n_resources, alignment, input_bw, is_acType, is_signed, is_fixed);

std::list<tree_nodeRef> writeStmt;
Expand Down Expand Up @@ -1337,7 +1337,7 @@ void InterfaceInfer::create_resource_Write_simple(const std::set<std::string>& o
void InterfaceInfer::create_resource_array(const std::set<std::string>& operationsR,
const std::set<std::string>& operationsW, const std::string& bundle_name,
const std::string& interfaceType, unsigned long long input_bw,
unsigned int arraySize, unsigned n_resources, unsigned long long alignment,
unsigned int arraySize, unsigned n_resources, unsigned int alignment,
bool is_real, unsigned long long rwBWsize, unsigned int top_id) const
{
const auto n_channels = parameters->getOption<unsigned int>(OPT_channels_number);
Expand Down Expand Up @@ -1366,7 +1366,7 @@ void InterfaceInfer::create_resource_array(const std::set<std::string>& operatio
GetPointerS<module>(interface_top)->set_license(GENERATED_LICENSE);
GetPointerS<module>(interface_top)->set_multi_unit_multiplicity(NResources);

const auto nbitAddres = 32ull - static_cast<unsigned>(__builtin_clzll(arraySize * alignment - 1));
const auto nbitAddres = 32u - static_cast<unsigned>(__builtin_clz(arraySize * alignment - 1));
const auto address_bitsize = HLSMgr->get_address_bitsize();
const auto nbit = 32ull - static_cast<unsigned>(__builtin_clzll(arraySize - 1));
const auto nbitDataSize = 32ull - static_cast<unsigned>(__builtin_clzll(rwBWsize));
Expand Down Expand Up @@ -1815,7 +1815,7 @@ void InterfaceInfer::create_resource_m_axi(const std::set<std::string>& operatio
void InterfaceInfer::create_resource(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
const std::string& arg_name, const std::string& interfaceType,
unsigned long long input_bw, bool isDiffSize, const std::string& fname,
unsigned int n_resources, unsigned long long alignment, bool isReal,
unsigned int n_resources, unsigned int alignment, bool isReal,
unsigned long long rwBWsize, unsigned int top_id) const
{
if(interfaceType == "none" || interfaceType == "none_registered" || interfaceType == "acknowledge" ||
Expand Down Expand Up @@ -1905,7 +1905,7 @@ void InterfaceInfer::create_resource(const std::set<std::string>& operationsR, c
}
}

void InterfaceInfer::ComputeResourcesAlignment(unsigned int& n_resources, unsigned long long& alignment,
void InterfaceInfer::ComputeResourcesAlignment(unsigned int& n_resources, unsigned int& alignment,
unsigned long long input_bw, bool is_acType, bool is_signed,
bool is_fixed)
{
Expand Down Expand Up @@ -1946,7 +1946,7 @@ void InterfaceInfer::ComputeResourcesAlignment(unsigned int& n_resources, unsign
}
else
{
alignment = (input_bw / 32) + 4 * (input_bw % 32 ? 1 : 0);
alignment = static_cast<unsigned int>((input_bw / 32) + 4 * (input_bw % 32 ? 1 : 0));
if(!is_signed && input_bw % 32 == 0 && !is_fixed)
{
alignment += 4;
Expand Down
9 changes: 4 additions & 5 deletions src/frontend_analysis/IR_analysis/InterfaceInfer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class InterfaceInfer : public ApplicationFrontendFlowStep
void create_resource_array(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
const std::string& bundle_name, const std::string& interfaceType,
unsigned long long input_bw, unsigned int arraySize, unsigned n_resources,
unsigned long long alignment, bool is_real, unsigned long long rwBWsize,
unsigned int alignment, bool is_real, unsigned long long rwBWsize,
unsigned int top_id) const;

void create_resource_m_axi(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
Expand All @@ -115,11 +115,10 @@ class InterfaceInfer : public ApplicationFrontendFlowStep

void create_resource(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
const std::string& arg_name, const std::string& interfaceType, unsigned long long input_bw,
bool isDiffSize, const std::string& fname, unsigned int n_resources,
unsigned long long alignment, bool isReal, unsigned long long rwBWsize,
unsigned int top_id) const;
bool isDiffSize, const std::string& fname, unsigned int n_resources, unsigned int alignment,
bool isReal, unsigned long long rwBWsize, unsigned int top_id) const;

void ComputeResourcesAlignment(unsigned int& n_resources, unsigned long long& alignment, unsigned long long input_bw,
void ComputeResourcesAlignment(unsigned int& n_resources, unsigned int& alignment, unsigned long long input_bw,
bool is_acType, bool is_signed, bool is_fixed);

void FixReadWriteCall(const gimple_assign* ga, gimple_node* newGN, const tree_manipulationRef tree_man,
Expand Down
6 changes: 3 additions & 3 deletions src/frontend_analysis/IR_manipulation/create_tree_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ void create_tree_manager::createCostTable()
CostTable = "store_expr|32=" + STR(clock_period);
CostTable += ",load_expr|32=" + STR(clock_period);
CostTable += ",nop_expr|32=" + STR(clock_period);
for(const std::string& op_name : {"mult_expr", "plus_expr", "trunc_div_expr", "trunc_mod_expr", "lshift_expr",
"rshift_expr", "bit_and_expr", "bit_ior_expr", "bit_xor_expr", "cond_expr"})
for(std::string op_name : {"mult_expr", "plus_expr", "trunc_div_expr", "trunc_mod_expr", "lshift_expr",
"rshift_expr", "bit_and_expr", "bit_ior_expr", "bit_xor_expr", "cond_expr"})
{
for(auto fu_prec : {1, 8, 16, 32, 64})
{
Expand Down Expand Up @@ -255,7 +255,7 @@ void create_tree_manager::createCostTable()
}
}
}
for(const std::string& op_name : {"mult_expr", "plus_expr", "rdiv_expr"})
for(std::string op_name : {"mult_expr", "plus_expr", "rdiv_expr"})
{
for(auto fu_prec : {32, 64})
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,18 @@ void CreateAddressTranslation::ComputeAddress(const AsnTypeRef asn_type, const u
const auto field_bpos = tree_helper::get_integer_cst_value(GetPointer<integer_cst>(
GET_NODE(GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index]))->bpos)));
THROW_ASSERT(field_bpos % 8 == 0, "Bitfield not supported");
const auto current_field_beginning = field_bpos / 8;
const auto next_field_beginning = [&]() -> long long int {
const auto current_field_beginning = static_cast<unsigned long long>(field_bpos / 8);
const auto next_field_beginning = [&]() -> unsigned long long int {
if(tree_field_index + 1 > tree_fields.size())
{
return tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
}
else
{
return tree_helper::get_integer_cst_value(GetPointer<const integer_cst>(GET_NODE(
GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos))) /
8;
return static_cast<unsigned long long>(
tree_helper::get_integer_cst_value(GetPointer<const integer_cst>(
GET_NODE(GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos))) /
8);
}
}();
const auto field_size = tree_helper::Size(tree_fields[tree_field_index]) / 8;
Expand Down Expand Up @@ -368,17 +369,18 @@ void CreateAddressTranslation::ComputeAddress(const AsnTypeRef asn_type, const u
const auto field_bpos = tree_helper::get_integer_cst_value(GetPointer<integer_cst>(
GET_NODE(GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index]))->bpos)));
THROW_ASSERT(field_bpos % 8 == 0, "Bitfield not supported");
const auto current_field_beginning = field_bpos / 8;
const auto next_field_beginning = [&]() -> long long int {
const auto current_field_beginning = static_cast<unsigned long long>(field_bpos / 8);
const auto next_field_beginning = [&]() -> unsigned long int {
if(tree_field_index + 1 > tree_fields.size())
{
return tree_helper::Size(TreeM->get_tree_node_const(tree_parameter_type)) / 8;
}
else
{
return tree_helper::get_integer_cst_value(GetPointer<const integer_cst>(GET_NODE(
GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos))) /
8;
return static_cast<unsigned long long>(
tree_helper::get_integer_cst_value(GetPointer<const integer_cst>(
GET_NODE(GetPointer<const field_decl>(GET_NODE(tree_fields[tree_field_index + 1]))->bpos))) /
8);
}
}();
const auto field_size = tree_helper::Size(tree_fields[tree_field_index]) / 8;
Expand Down
6 changes: 3 additions & 3 deletions src/tree/tree_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5245,15 +5245,15 @@ std::vector<unsigned long long> tree_helper::GetArrayDimensions(const tree_nodeC
return dims;
}

unsigned int tree_helper::get_array_num_elements(const tree_managerConstRef& TM, const unsigned int index)
unsigned long long tree_helper::get_array_num_elements(const tree_managerConstRef& TM, const unsigned int index)
{
const auto node = TM->CGetTreeReindex(index);
return GetArrayTotalSize(node);
}

unsigned int tree_helper::GetArrayTotalSize(const tree_nodeConstRef& node)
unsigned long long tree_helper::GetArrayTotalSize(const tree_nodeConstRef& node)
{
unsigned int num_elements = 1u;
auto num_elements = 1ull;
for(const auto& i : GetArrayDimensions(node))
{
num_elements *= i;
Expand Down
5 changes: 2 additions & 3 deletions src/tree/tree_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,15 +1063,14 @@ class tree_helper
*/
static
/// FIXME: to be remove after substitution with GetArrayTotalSize
unsigned int
get_array_num_elements(const tree_managerConstRef& TM, const unsigned int index);
unsigned long long get_array_num_elements(const tree_managerConstRef& TM, const unsigned int index);

/**
* Return the total number of elements of the the base type in the array
* @param node is the array object
* @return the total number of elements of the the base type in the array
*/
static unsigned int GetArrayTotalSize(const tree_nodeConstRef& node);
static unsigned long long GetArrayTotalSize(const tree_nodeConstRef& node);

/**
* Return the indexes of the array_ref
Expand Down
4 changes: 2 additions & 2 deletions src/utility/Factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Factory
class Key
{
Key() = default;
;

template <class T>
friend struct Registrar;
};
Expand All @@ -114,4 +114,4 @@ template <class Base, class... Args>
template <class T>
bool Factory<Base, Args...>::Registrar<T>::__registered = Factory<Base, Args...>::Registrar<T>::RegisterType();

#endif
#endif

0 comments on commit 4b0abcb

Please sign in to comment.