Skip to content

Commit b95cfd6

Browse files
authored
Merge pull request #59 from antmicro/merge-upstream
Merge upstream
2 parents 39fdec1 + 8f72291 commit b95cfd6

File tree

389 files changed

+52590
-49260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

389 files changed

+52590
-49260
lines changed

.clang-format

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
Language: Cpp
2+
BasedOnStyle: Chromium
3+
AccessModifierOffset: -2
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveDeclarations: false
7+
AlignEscapedNewlines: Left
8+
AlignOperands: true
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: false
11+
AllowShortBlocksOnASingleLine: true
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: true
14+
AllowShortIfStatementsOnASingleLine: true
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: true
19+
AlwaysBreakTemplateDeclarations: true
20+
BinPackArguments: true
21+
BinPackParameters: false
22+
BraceWrapping:
23+
AfterClass: false
24+
AfterControlStatement: false
25+
AfterEnum: false
26+
AfterFunction: false
27+
AfterNamespace: false
28+
AfterObjCDeclaration: false
29+
AfterStruct: false
30+
AfterUnion: false
31+
BeforeCatch: false
32+
BeforeElse: false
33+
IndentBraces: false
34+
SplitEmptyFunction: false
35+
SplitEmptyRecord: true
36+
SplitEmptyNamespace: true
37+
BreakBeforeBinaryOperators: All
38+
BreakBeforeBraces: Custom
39+
BreakBeforeInheritanceComma: false
40+
BreakBeforeTernaryOperators: true
41+
BreakConstructorInitializersBeforeComma: false
42+
BreakConstructorInitializers: BeforeComma
43+
BreakAfterJavaFieldAnnotations: false
44+
BreakStringLiterals: true
45+
ColumnLimit: 0
46+
CommentPragmas: '^ IWYU pragma:'
47+
CompactNamespaces: false
48+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
49+
ConstructorInitializerIndentWidth: 4
50+
ContinuationIndentWidth: 4
51+
Cpp11BracedListStyle: true
52+
DerivePointerAlignment: false
53+
DisableFormat: false
54+
ExperimentalAutoDetectBinPacking: false
55+
FixNamespaceComments: true
56+
ForEachMacros:
57+
- foreach
58+
- Q_FOREACH
59+
- BOOST_FOREACH
60+
IncludeCategories:
61+
- Regex: '^<.*\.h>'
62+
Priority: 1
63+
- Regex: '^<.*'
64+
Priority: 2
65+
- Regex: '.*'
66+
Priority: 3
67+
IncludeIsMainRegex: '([-_](test|unittest))?$'
68+
IndentCaseLabels: true
69+
IndentWidth: 4
70+
IndentWrappedFunctionNames: false
71+
IndentPPDirectives: AfterHash
72+
JavaScriptQuotes: Leave
73+
JavaScriptWrapImports: true
74+
KeepEmptyLinesAtTheStartOfBlocks: false
75+
MacroBlockBegin: ''
76+
MacroBlockEnd: ''
77+
MaxEmptyLinesToKeep: 1
78+
NamespaceIndentation: None
79+
ObjCBlockIndentWidth: 2
80+
ObjCSpaceAfterProperty: false
81+
ObjCSpaceBeforeProtocolList: false
82+
PenaltyBreakAssignment: 2
83+
PenaltyBreakBeforeFirstCallParameter: 1
84+
PenaltyBreakComment: 300
85+
PenaltyBreakFirstLessLess: 120
86+
PenaltyBreakString: 1000
87+
PenaltyExcessCharacter: 1000000
88+
PenaltyReturnTypeOnItsOwnLine: 200
89+
PointerAlignment: Left
90+
ReflowComments: false
91+
SortIncludes: false
92+
SortUsingDeclarations: true
93+
SpaceAfterCStyleCast: false
94+
SpaceAfterTemplateKeyword: false
95+
SpaceBeforeAssignmentOperators: true
96+
SpaceBeforeParens: ControlStatements
97+
SpaceInEmptyParentheses: false
98+
SpacesBeforeTrailingComments: 1
99+
SpacesInAngles: false
100+
SpacesInContainerLiterals: true
101+
SpacesInCStyleCastParentheses: false
102+
SpacesInParentheses: false
103+
SpacesInSquareBrackets: false
104+
Standard: Auto
105+
TabWidth: 4
106+
UseTab: Never

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Autoformat run on 2019-05-27T17:22:16.670814
2+
d91bc203bf1ae80e6a4371ef7c168886bb536c1c
3+

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: cpp
22

3-
#dist: trusty
4-
sudo: false
3+
dist: trusty
54
addons:
65
apt:
76
sources:
87
- ubuntu-toolchain-r-test # For newer GCC
98
- george-edison55-precise-backports # For cmake
9+
- llvm-toolchain-trusty-7
1010
packages:
1111
- autoconf
1212
- automake
@@ -40,6 +40,7 @@ addons:
4040
- valgrind
4141
- zip
4242
- qt5-default
43+
- clang-format-7
4344

4445
before_install:
4546
- source .travis/common.sh

.travis/script.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ start_section "vtr.test.5" "${GREEN}Testing..${NC} ${CYAN}odin_reg_operators${NC
6262
end_section "vtr.test.5"
6363

6464
$SPACER
65+
66+
start_section "vtr.test.6" "${GREEN}Checking..${NC} ${CYAN}code formatting${NC}"
67+
./dev/check-format.sh
68+
end_section "vtr.test.6"
69+
70+
$SPACER

BUILDING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ It is also recommended you install the following development tools:
3434
* ctags
3535
* gdb
3636
* valgrind
37+
* clang-format-7
3738

3839
For Docs generation you will need:
3940
* Doxygen

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,15 @@ if(WITH_BLIFEXPLORER)
364364
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/blifexplorer"
365365
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/blifexplorer")
366366
endif()
367+
368+
#
369+
#
370+
# Code Autoformatting
371+
#
372+
#
373+
list(APPEND DIRS_TO_FORMAT_CPP "${CMAKE_CURRENT_SOURCE_DIR}/vpr")
374+
list(APPEND DIRS_TO_FORMAT_CPP "${CMAKE_CURRENT_SOURCE_DIR}/libs/libarchfpga")
375+
list(APPEND DIRS_TO_FORMAT_CPP "${CMAKE_CURRENT_SOURCE_DIR}/libs/libvtrutil")
376+
list(APPEND DIRS_TO_FORMAT_CPP "${CMAKE_CURRENT_SOURCE_DIR}/libs/libpugiutil")
377+
list(APPEND DIRS_TO_FORMAT_CPP "${CMAKE_CURRENT_SOURCE_DIR}/libs/liblog")
378+
include(AutoClangFormat)

ODIN_II/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ OUTPUT/*
33
temp
44
regression_test/latest
55
*_preproc.v
6+
default_out.blif

ODIN_II/SRC/adders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ nnode_t *make_adder(operation_list funct, nnode_t *current_adder, nnode_t *previ
14741474
if (current_pin < width[1])
14751475
{
14761476
npin_t *temp_pin = node->input_pins[current_pin];
1477-
if(temp_pin->net->driver_pin->node->type == GND_NODE)
1477+
if(temp_pin->net->driver_pin == NULL || temp_pin->net->driver_pin->node->type == GND_NODE)
14781478
{
14791479
connect_nodes(netlist->gnd_node,0, new_funct, 0+is_three_port_gate);
14801480
remove_fanout_pins_from_net(temp_pin->net, temp_pin, temp_pin->pin_net_idx);
@@ -1499,7 +1499,7 @@ nnode_t *make_adder(operation_list funct, nnode_t *current_adder, nnode_t *previ
14991499
{
15001500
//pin a is neighbor to pin b
15011501
npin_t *temp_pin = node->input_pins[current_pin+width[1]];
1502-
if(temp_pin->net->driver_pin->node->type == GND_NODE)
1502+
if(temp_pin->net->driver_pin == NULL || temp_pin->net->driver_pin->node->type == GND_NODE)
15031503
{
15041504
nnode_t* attach_to=(subtraction)? netlist->vcc_node: netlist->gnd_node;
15051505
connect_nodes(attach_to,0, new_funct, 1+is_three_port_gate);

ODIN_II/SRC/ast_elaborate.cpp

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,39 @@ long count;
5757
long count_write;
5858
enode *head, *p;
5959

60-
int simplify_ast()
60+
void remove_generate(ast_node_t *node)
6161
{
62-
/* for loop support */
63-
unroll_loops();
64-
65-
//ast_node_t *top = find_top_module();
66-
67-
return 1;
62+
for(int i=0; i<node->num_children; i++){
63+
if(!node->children[i])
64+
continue;
65+
ast_node_t* candidate = node->children[i];
66+
ast_node_t* body_parent = nullptr;
67+
68+
if(candidate->type == GENERATE){
69+
for(int j = 0; j<candidate->num_children; j++){
70+
ast_node_t* new_child = ast_node_deep_copy(candidate->children[j]);
71+
body_parent = body_parent ? newList_entry(body_parent, new_child) : newList(BLOCK, new_child);
72+
}
73+
node->children[i] = body_parent;
74+
free_whole_tree(candidate);
75+
} else {
76+
remove_generate(candidate);
77+
}
78+
}
6879
}
6980

70-
int simplify_ast_module(ast_node_t *ast_module)
81+
int simplify_ast_module(ast_node_t **ast_module)
7182
{
72-
/* for loop support */
73-
//unroll_loops(ast_module);
7483
/* reduce parameters with their values if they have been set */
75-
reduce_parameter(ast_module);
84+
reduce_parameter(*ast_module);
7685
/* simplify assignment expressions */
77-
reduce_assignment_expression(ast_module);
86+
reduce_assignment_expression(*ast_module);
87+
/* for loop support */
88+
unroll_loops(ast_module);
89+
/* remove unused node preventing module instantiation */
90+
remove_generate(*ast_module);
7891
/* find multiply or divide operation that can be replaced with shift operation */
79-
shift_operation(ast_module);
80-
81-
//ast_node_t *top = find_top_module();
92+
shift_operation(*ast_module);
8293

8394
return 1;
8495
}

0 commit comments

Comments
 (0)