Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang format not working in CI #2790

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Expand All @@ -68,7 +68,7 @@ IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
IndentPPDirectives: AfterHash
IndentPPDirectives: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ jobs:
with:
python-version: 3.10.10
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Install dependencies
run: ./.github/scripts/install_dependencies.sh
Expand Down
103 changes: 54 additions & 49 deletions libs/libarchfpga/src/arch_check.cpp

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion libs/libarchfpga/src/arch_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ void warn_model_missing_timing(const t_model* model, const char* file, uint32_t
* @param sub_tile sub tile to check
* @param logical_block logical block type
*/
void check_port_direct_mappings(t_physical_tile_type_ptr physical_tile, t_sub_tile* sub_tile, t_logical_block_type_ptr logical_block);
void check_port_direct_mappings(t_physical_tile_type_ptr physical_tile,
t_sub_tile* sub_tile,
t_logical_block_type_ptr logical_block);

/**
* @brief Checks the timing consistency between tha pb_type and the corresponding model.
Expand Down
432 changes: 170 additions & 262 deletions libs/libarchfpga/src/arch_util.cpp

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions libs/libarchfpga/src/arch_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ t_logical_block_type get_empty_logical_type(const char* name = EMPTY_BLOCK_NAME)

std::unordered_set<t_logical_block_type_ptr> get_equivalent_sites_set(t_physical_tile_type_ptr type);

void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
char* new_name,
t_pb_type* copy);
void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type, char* new_name, t_pb_type* copy);

void ProcessLutClass(t_pb_type* lut_pb_type);

Expand All @@ -86,14 +84,11 @@ e_power_estimation_method power_method_inherited(e_power_estimation_method paren

void CreateModelLibrary(t_arch* arch);

void SyncModelsPbTypes(t_arch* arch,
const std::vector<t_logical_block_type>& Types);
void SyncModelsPbTypes(t_arch* arch, const std::vector<t_logical_block_type>& Types);

void SyncModelsPbTypes_rec(t_arch* arch,
t_pb_type* pb_type);
void SyncModelsPbTypes_rec(t_arch* arch, t_pb_type* pb_type);

void primitives_annotation_clock_match(t_pin_to_pin_annotation* annotation,
t_pb_type* parent_pb_type);
void primitives_annotation_clock_match(t_pin_to_pin_annotation* annotation, t_pb_type* parent_pb_type);

bool segment_exists(const t_arch* arch, std::string name);
const t_segment_inf* find_segment(const t_arch* arch, std::string name);
Expand All @@ -106,8 +101,12 @@ bool block_type_contains_blif_model(t_logical_block_type_ptr type, const std::st
//Returns true of a pb_type (or it's children) contain the specified blif model name
bool pb_type_contains_blif_model(const t_pb_type* pb_type, const std::string& blif_model_name);

const t_pin_to_pin_annotation* find_sequential_annotation(const t_pb_type* pb_type, const t_model_ports* port, enum e_pin_to_pin_delay_annotations annot_type);
const t_pin_to_pin_annotation* find_combinational_annotation(const t_pb_type* pb_type, std::string in_port, std::string out_port);
const t_pin_to_pin_annotation* find_sequential_annotation(const t_pb_type* pb_type,
const t_model_ports* port,
enum e_pin_to_pin_delay_annotations annot_type);
const t_pin_to_pin_annotation* find_combinational_annotation(const t_pb_type* pb_type,
std::string in_port,
std::string out_port);

/**
* @brief Updates the physical and logical types based on the equivalence between one and the other.
Expand Down
4 changes: 1 addition & 3 deletions libs/libarchfpga/src/cad_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ struct t_pack_patterns {
* Linked list for easy insertion/deletion
*/
struct t_cluster_placement_primitive {
t_cluster_placement_primitive() {
pb_graph_node = nullptr;
}
t_cluster_placement_primitive() { pb_graph_node = nullptr; }
t_pb_graph_node* pb_graph_node;
bool valid;
float base_cost; /* cost independent of current status of packing */
Expand Down
6 changes: 1 addition & 5 deletions libs/libarchfpga/src/clock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
#include <string>
#include <vector>

enum class e_clock_type {
SPINE,
RIB,
H_TREE
};
enum class e_clock_type { SPINE, RIB, H_TREE };

struct t_metal_layer {
float r_metal;
Expand Down
8 changes: 2 additions & 6 deletions libs/libarchfpga/src/device_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ DeviceGrid::DeviceGrid(std::string grid_name,
size_t DeviceGrid::num_instances(t_physical_tile_type_ptr type, int layer_num) const {
size_t count = 0;
//instance_counts_ is not initialized
if (instance_counts_.empty()) {
return 0;
}
if (instance_counts_.empty()) { return 0; }
soheilshahrouz marked this conversation as resolved.
Show resolved Hide resolved

int num_layers = (int)grid_.dim_size(0);

if (layer_num == -1) {
//Count all layers
for (int curr_layer_num = 0; curr_layer_num < num_layers; ++curr_layer_num) {
auto iter = instance_counts_[curr_layer_num].find(type);
if (iter != instance_counts_[curr_layer_num].end()) {
count += iter->second;
}
if (iter != instance_counts_[curr_layer_num].end()) { count += iter->second; }
}
return count;
} else {
Expand Down
19 changes: 8 additions & 11 deletions libs/libarchfpga/src/device_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,22 @@ class DeviceGrid {
public:
DeviceGrid() = default;
DeviceGrid(std::string grid_name, vtr::NdMatrix<t_grid_tile, 3> grid);
DeviceGrid(std::string grid_name, vtr::NdMatrix<t_grid_tile, 3> grid, std::vector<t_logical_block_type_ptr> limiting_res);
DeviceGrid(std::string grid_name,
vtr::NdMatrix<t_grid_tile, 3> grid,
std::vector<t_logical_block_type_ptr> limiting_res);

const std::string& name() const { return name_; }

///@brief Return the number of layers(number of dies)
inline int get_num_layers() const {
return (int)grid_.dim_size(0);
}
inline int get_num_layers() const { return (int)grid_.dim_size(0); }

///@brief Return the width of the grid at the specified layer
size_t width() const { return grid_.dim_size(1); }
///@brief Return the height of the grid at the specified layer
size_t height() const { return grid_.dim_size(2); }

///@brief Return the size of the flattened grid on the given layer
inline size_t grid_size() const {
return grid_.size();
}
inline size_t grid_size() const { return grid_.size(); }

///@brief deallocate members of DeviceGrid
void clear();
Expand Down Expand Up @@ -114,9 +112,7 @@ class DeviceGrid {
}

///@brief Return the nth t_grid_tile on the given layer of the flattened grid - Used by serializer functions
inline const t_grid_tile* get_grid_locs_grid_loc(int n) const {
return &grid_.get(n);
}
inline const t_grid_tile* get_grid_locs_grid_loc(int n) const { return &grid_.get(n); }

private:
///@brief count_instances() counts the number of each tile type on each layer and store it in instance_counts_. It is called in the constructor.
Expand All @@ -131,7 +127,8 @@ class DeviceGrid {
* @note which can be used for indexing in the second dimension, allowing
* @note traditional 2-d indexing to be used
*/
vtr::NdMatrix<t_grid_tile, 3> grid_; //This stores the grid of complex blocks. It is a 3D matrix: [0..num_layers-1][0..grid.width()-1][0..grid_height()-1]
vtr::NdMatrix<t_grid_tile, 3>
grid_; //This stores the grid of complex blocks. It is a 3D matrix: [0..num_layers-1][0..grid.width()-1][0..grid_height()-1]

///@brief instance_counts_ stores the number of each tile type on each layer. It is initialized in count_instances().
std::vector<std::map<t_physical_tile_type_ptr, size_t>> instance_counts_; /* [layer_num][physical_tile_type_ptr] */
Expand Down
Loading
Loading