Skip to content

Commit 5da3f33

Browse files
committed
Merge branch 'master' of github.com:verilog-to-routing/vtr-verilog-to-routing into merge-upstream
2 parents 07e0dc4 + 804307b commit 5da3f33

40 files changed

+1780
-727
lines changed

ODIN_II/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ regression_test/runs
22
OUTPUT/*
33
temp
44
regression_test/latest
5+
*_preproc.v

ODIN_II/Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ MAKEFLAGS := -s
2323

2424
BUILD_DIR=../build
2525

26-
.PHONY: help build debug test
26+
.PHONY: help build debug test large_test
2727

2828
help:
2929
@echo -e "\n\
30-
The Following three options are available\n\n\
31-
build build using the VTR_ROOT makefile \n\
32-
debug build using the VTR_ROOT makefile with debug flags and extra warning flags for ODIN only\n\
33-
clean remove the build file for ODIN only\n\
34-
test run the complete battery of test before commiting changes or to assert functionnalityn\
30+
The Following options are available\n\n\
31+
build build using the VTR_ROOT makefile \n\
32+
debug build using the VTR_ROOT makefile with debug flags and extra warning flags for ODIN only\n\
33+
clean remove the build file for ODIN only\n\
34+
test run the complete battery of test before commiting changes or to assert functionality\n\
35+
large_test run the complete battery of test before merging changes\n\
3536
"
3637

3738
init:
@@ -52,4 +53,7 @@ clean:
5253
$(RM) -Rf $(BUILD_DIR)/ODIN_II
5354

5455
test:
55-
./verify_odin.sh --test pre_commit --nb_of_process $(( $(nproc --all) + 1 )) --limit_ressource
56+
./verify_odin.sh --test pre_commit --nb_of_process $(NB_OF_PROCESS) --limit_ressource
57+
58+
large_test:
59+
./verify_odin.sh --test pre_merge --nb_of_process $(NB_OF_PROCESS) --limit_ressource

ODIN_II/SRC/ast_elaborate.cpp

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,22 @@ int simplify_ast()
6161
{
6262
/* for loop support */
6363
unroll_loops();
64+
65+
//ast_node_t *top = find_top_module();
66+
67+
return 1;
68+
}
69+
70+
int simplify_ast_module(ast_node_t *ast_module)
71+
{
72+
/* for loop support */
73+
//unroll_loops(ast_module);
6474
/* reduce parameters with their values if they have been set */
65-
reduce_parameter();
75+
reduce_parameter(ast_module);
6676
/* simplify assignment expressions */
67-
reduce_assignment_expression();
77+
reduce_assignment_expression(ast_module);
6878
/* find multiply or divide operation that can be replaced with shift operation */
69-
shift_operation();
79+
shift_operation(ast_module);
7080

7181
//ast_node_t *top = find_top_module();
7282

@@ -210,8 +220,7 @@ void record_expression(ast_node_t *node, std::vector<std::string> expressions, b
210220
if(node->num_children > 0)
211221
record_expression(node->children[0], expressions, found_statement);
212222

213-
214-
if(!(*found_statement) && (/*node->type == BLOCKING_STATEMENT || */node->type == BLOCKING_STATEMENT)){
223+
if(!(*found_statement) && (node->type == NON_BLOCKING_STATEMENT || node->type == BLOCKING_STATEMENT)){
215224
*found_statement = TRUE;
216225

217226
}else if(*found_statement){
@@ -437,41 +446,39 @@ ast_node_t *search_marked_node(ast_node_t *node, int is, std::string temp)
437446
* (function: reduce_assignment_expression)
438447
* reduce the number nodes which can be calculated to optimize the AST
439448
*-------------------------------------------------------------------------*/
440-
void reduce_assignment_expression()
449+
void reduce_assignment_expression(ast_node_t *ast_module)
441450
{
442451
head = NULL;
443452
p = NULL;
444453
ast_node_t *T = NULL;
445454

446455

447456
// find out most unique_count prepared for new AST nodes
448-
for (long i = 0; i < num_modules; i++)
449-
if (count_id < ast_modules[i]->unique_count)
450-
count_id = ast_modules[i]->unique_count;
457+
//for (long i = 0; i < num_modules; i++)
451458

452-
for (long i = 0; i < num_modules; i++)
459+
if (count_id < ast_module->unique_count)
460+
count_id = ast_module->unique_count;
461+
462+
count_assign = 0;
463+
std::vector<ast_node_t *> list_assign;
464+
find_assign_node(ast_module, list_assign);
465+
for (long j = 0; j < count_assign; j++)
453466
{
454-
count_assign = 0;
455-
std::vector<ast_node_t *> list_assign;
456-
find_assign_node(ast_modules[i], list_assign);
457-
for (long j = 0; j < count_assign; j++)
467+
if (check_tree_operation(list_assign[j]->children[1]) && (list_assign[j]->children[1]->num_children > 0))
458468
{
459-
if (check_tree_operation(list_assign[j]->children[1]) && (list_assign[j]->children[1]->num_children > 0))
460-
{
461-
store_exp_list(list_assign[j]->children[1]);
462-
if (deal_with_bracket(list_assign[j]->children[1])) // there are multiple brackets multiplying -- ()*(), stop expanding brackets which may not simplify AST but make it mroe complex
463-
return;
469+
store_exp_list(list_assign[j]->children[1]);
470+
if (deal_with_bracket(list_assign[j]->children[1])) // there are multiple brackets multiplying -- ()*(), stop expanding brackets which may not simplify AST but make it mroe complex
471+
return;
464472

465-
if (simplify_expression())
466-
{
467-
enode *tail = find_tail(head);
468-
free_whole_tree(list_assign[j]->children[1]);
469-
T = (ast_node_t*)vtr::malloc(sizeof(ast_node_t));
470-
construct_new_tree(tail, T, list_assign[j]->line_number, list_assign[j]->file_number);
471-
list_assign[j]->children[1] = T;
472-
}
473-
free_exp_list();
473+
if (simplify_expression())
474+
{
475+
enode *tail = find_tail(head);
476+
free_whole_tree(list_assign[j]->children[1]);
477+
T = (ast_node_t*)vtr::malloc(sizeof(ast_node_t));
478+
construct_new_tree(tail, T, list_assign[j]->line_number, list_assign[j]->file_number);
479+
list_assign[j]->children[1] = T;
474480
}
481+
free_exp_list();
475482
}
476483
}
477484
}
@@ -1426,16 +1433,13 @@ void check_operation(enode *begin, enode *end)
14261433
* (function: reduce_parameter)
14271434
* replace parameters with their values in the AST
14281435
*-------------------------------------------------------------------------*/
1429-
void reduce_parameter()
1436+
void reduce_parameter(ast_node_t *ast_module)
14301437
{
1431-
for (long i = 0; i < num_modules; i++)
1432-
{
1433-
std::vector<ast_node_t *>para;
1434-
find_parameter(ast_modules[i], para);
1435-
if (ast_modules[i]->types.module.is_instantiated == 0 && !para.empty())
1436-
remove_para_node(ast_modules[i], para);
1438+
std::vector<ast_node_t *>para;
1439+
find_parameter(ast_module, para);
1440+
if (ast_module->types.module.is_instantiated == 0 && !para.empty())
1441+
remove_para_node(ast_module, para);
14371442

1438-
}
14391443

14401444
}
14411445

@@ -1497,13 +1501,10 @@ void change_para_node(ast_node_t *node, std::string name, long value)
14971501
* (function: copy_tree)
14981502
* find multiply or divide operation that can be replaced with shift operation
14991503
*-------------------------------------------------------------------------*/
1500-
void shift_operation()
1504+
void shift_operation(ast_node_t *ast_module)
15011505
{
1502-
long i;
1503-
if(ast_modules){
1504-
for (i = 0; i < num_modules; i++){
1505-
search_certain_operation(ast_modules[i]);
1506-
}
1506+
if(ast_module){
1507+
search_certain_operation(ast_module);
15071508
}
15081509

15091510
}

ODIN_II/SRC/ast_loop_unroll.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ void unroll_loops()
2828
}
2929
}
3030

31+
/*
32+
* (function: unroll_loops)
33+
*/
34+
void unroll_loops(ast_node_t *ast_module)
35+
{
36+
ast_node_t* module = for_preprocessor(ast_module);
37+
if(module != ast_module)
38+
free_whole_tree(ast_module);
39+
ast_module = module;
40+
}
41+
3142
/*
3243
* (function: for_preprocessor)
3344
*/

0 commit comments

Comments
 (0)