Skip to content

Commit 0451b50

Browse files
authored
Merge branch 'master' into fix_parse_runtime
2 parents 4aba2a1 + fe2bcfd commit 0451b50

File tree

72 files changed

+4172
-2110
lines changed

Some content is hidden

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

72 files changed

+4172
-2110
lines changed

ODIN_II/SRC/ast_elaborate.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,9 +1167,6 @@ ast_node_t* finalize_ast(ast_node_t* node, ast_node_t* parent, sc_hierarchy* loc
11671167
"%s", "Cannot mix port connections by name and port connections by ordered list\n");
11681168
}
11691169
}
1170-
1171-
skip_children = true;
1172-
11731170
break;
11741171
}
11751172
case TASK: {
@@ -1198,9 +1195,6 @@ ast_node_t* finalize_ast(ast_node_t* node, ast_node_t* parent, sc_hierarchy* loc
11981195
"%s", "Cannot mix port connections by name and port connections by ordered list\n");
11991196
}
12001197
}
1201-
1202-
skip_children = true;
1203-
12041198
break;
12051199
}
12061200
case MODULE_ITEMS: {

ODIN_II/SRC/ast_util.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,9 @@ char* get_name_of_pin_at_bit(ast_node_t* var_node, int bit, char* instance_name_
625625
var_node = free_whole_tree(var_node);
626626
}
627627
}
628+
} else if (var_node->type == BINARY_OPERATION || var_node->type == UNARY_OPERATION || var_node->type == TERNARY_OPERATION) {
629+
if (!var_node->net_node)
630+
error_message(AST, var_node->loc, "Expression is not allowed for outputs in instance port connections. var_node->type = %s\n", ast_node_name_based_on_ids(var_node));
628631
} else {
629632
return_string = NULL;
630633

ODIN_II/SRC/include/netlist_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ void add_output_port_information(nnode_t* node, int port_width);
3535
void add_input_port_information(nnode_t* node, int port_width);
3636

3737
void combine_nets(nnet_t* output_net, nnet_t* input_net, netlist_t* netlist);
38+
void combine_nets_with_spot_copy(nnet_t* output_net, nnet_t* input_net, long sc_spot_output, netlist_t* netlist);
3839
void join_nets(nnet_t* net, nnet_t* input_net);
40+
void integrate_nets(char* alias_name, char* full_name, nnet_t* input_signal_net);
3941

4042
void remap_pin_to_new_net(npin_t* pin, nnet_t* new_net);
4143
void remap_pin_to_new_node(npin_t* pin, nnode_t* new_node, int pin_idx);

ODIN_II/SRC/memories.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,6 +1711,7 @@ signal_list_t* create_decoder(nnode_t* node, short mark, signal_list_t* input_li
17111711
npin_t* not_output = allocate_npin();
17121712
add_output_pin_to_node(not_g, not_output, 0);
17131713
nnet_t* net = allocate_nnet();
1714+
net->name = make_full_ref_name(NULL, NULL, NULL, not_g->name, 0);
17141715
add_driver_pin_to_net(net, not_output);
17151716
not_output = allocate_npin();
17161717
add_fanout_pin_to_net(net, not_output);
@@ -1750,6 +1751,7 @@ signal_list_t* create_decoder(nnode_t* node, short mark, signal_list_t* input_li
17501751
npin_t* output = allocate_npin();
17511752
nnet_t* net = allocate_nnet();
17521753
add_output_pin_to_node(and_g, output, 0);
1754+
net->name = make_full_ref_name(NULL, NULL, NULL, and_g->name, 0);
17531755
add_driver_pin_to_net(net, output);
17541756
output = allocate_npin();
17551757
add_fanout_pin_to_net(net, output);

ODIN_II/SRC/netlist_create_from_ast.cpp

Lines changed: 396 additions & 297 deletions
Large diffs are not rendered by default.

ODIN_II/SRC/netlist_utils.cpp

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,44 @@ void combine_nets(nnet_t* output_net, nnet_t* input_net, netlist_t* netlist) {
442442
free_nnet(output_net);
443443
}
444444

445+
/*---------------------------------------------------------------------------------------------
446+
* (function: combine_nets_with_spot_copy)
447+
* // output net is a net with a driver
448+
* // input net is a net with all the fanouts
449+
* In addition to combining two nets, it will change the value of
450+
* all input nets driven by the output_net previously.
451+
*-------------------------------------------------------------------------------------------*/
452+
void combine_nets_with_spot_copy(nnet_t* output_net, nnet_t* input_net, long sc_spot_output, netlist_t* netlist) {
453+
long in_net_idx;
454+
long idx_array_size = 0;
455+
long* idx_array = NULL;
456+
457+
// check to see if any matching input_net exist, then save its index
458+
for (in_net_idx = 0; in_net_idx < input_nets_sc->size; in_net_idx++) {
459+
if (input_nets_sc->data[in_net_idx] == output_net) {
460+
idx_array = (long*)vtr::realloc(idx_array, sizeof(long*) * (idx_array_size + 1));
461+
idx_array[idx_array_size] = in_net_idx;
462+
idx_array_size += 1;
463+
}
464+
}
465+
466+
combine_nets(output_net, input_net, netlist);
467+
output_net = NULL;
468+
/* since the driver net is deleted, copy the spot of the input_net over */
469+
output_nets_sc->data[sc_spot_output] = (void*)input_net;
470+
471+
// copy the spot of input_nets for other inputs driven by the output_net
472+
for (in_net_idx = 0; in_net_idx < idx_array_size; in_net_idx++) {
473+
char* net_name = input_nets_sc->string[idx_array[in_net_idx]];
474+
input_nets_sc->data[idx_array[in_net_idx]] = (void*)input_net;
475+
// check to see if there is any matching output net too.
476+
if ((sc_spot_output = sc_lookup_string(output_nets_sc, net_name)) != -1)
477+
output_nets_sc->data[sc_spot_output] = (void*)input_net;
478+
}
479+
480+
vtr::free(idx_array);
481+
}
482+
445483
/*---------------------------------------------------------------------------------------------
446484
* (function: join_nets)
447485
* Copies the fanouts from input net into net
@@ -480,6 +518,71 @@ void join_nets(nnet_t* join_to_net, nnet_t* other_net) {
480518
}
481519
}
482520

521+
/*---------------------------------------------------------------------------------------------
522+
* (function: integrate_nets)
523+
* processing the integration of the input net, named with the
524+
* full_name string (if not exist in input_nets_sc then use driver_net),
525+
* with the alias net (a related module/function/task instance connection).
526+
*-------------------------------------------------------------------------------------------*/
527+
void integrate_nets(char* alias_name, char* full_name, nnet_t* driver_net) {
528+
long sc_spot_output;
529+
long sc_spot_input_old;
530+
long sc_spot_input_new;
531+
532+
sc_spot_input_old = sc_lookup_string(input_nets_sc, alias_name);
533+
oassert(sc_spot_input_old != -1);
534+
535+
/* CMM - Check if this pin should be driven by the top level VCC or GND drivers */
536+
if (strstr(full_name, ONE_VCC_CNS)) {
537+
join_nets(verilog_netlist->one_net, (nnet_t*)input_nets_sc->data[sc_spot_input_old]);
538+
free_nnet((nnet_t*)input_nets_sc->data[sc_spot_input_old]);
539+
input_nets_sc->data[sc_spot_input_old] = (void*)verilog_netlist->one_net;
540+
} else if (strstr(full_name, ZERO_GND_ZERO)) {
541+
join_nets(verilog_netlist->zero_net, (nnet_t*)input_nets_sc->data[sc_spot_input_old]);
542+
free_nnet((nnet_t*)input_nets_sc->data[sc_spot_input_old]);
543+
input_nets_sc->data[sc_spot_input_old] = (void*)verilog_netlist->zero_net;
544+
}
545+
/* check if the instantiation pin exists. */
546+
else if ((sc_spot_output = sc_lookup_string(output_nets_sc, full_name)) == -1) {
547+
/* IF - no driver, then assume that it needs to be aliased to move up as an input */
548+
if ((sc_spot_input_new = sc_lookup_string(input_nets_sc, full_name)) == -1) {
549+
/* if this input is not yet used in this module then we'll add it */
550+
sc_spot_input_new = sc_add_string(input_nets_sc, full_name);
551+
552+
if (driver_net == NULL) {
553+
/* copy the pin to the old spot */
554+
input_nets_sc->data[sc_spot_input_new] = input_nets_sc->data[sc_spot_input_old];
555+
} else {
556+
/* copy the pin to the old spot */
557+
input_nets_sc->data[sc_spot_input_new] = (void*)driver_net;
558+
nnet_t* old_in_net = (nnet_t*)input_nets_sc->data[sc_spot_input_old];
559+
join_nets((nnet_t*)input_nets_sc->data[sc_spot_input_new], old_in_net);
560+
//net = NULL;
561+
old_in_net = free_nnet(old_in_net);
562+
input_nets_sc->data[sc_spot_input_old] = (void*)driver_net;
563+
}
564+
} else {
565+
/* already exists so we'll join the nets */
566+
combine_nets((nnet_t*)input_nets_sc->data[sc_spot_input_old], (nnet_t*)input_nets_sc->data[sc_spot_input_new], verilog_netlist);
567+
input_nets_sc->data[sc_spot_input_old] = NULL;
568+
}
569+
} else {
570+
/* ELSE - we've found a matching net, so add this pin to the net */
571+
nnet_t* out_net = (nnet_t*)output_nets_sc->data[sc_spot_output];
572+
nnet_t* in_net = (nnet_t*)input_nets_sc->data[sc_spot_input_old];
573+
574+
if ((out_net != in_net) && (out_net->combined == true)) {
575+
/* if they haven't been combined already, then join the inputs and output */
576+
join_nets(out_net, in_net);
577+
in_net = free_nnet(in_net);
578+
/* since the driver net is deleted, copy the spot of the in_net over */
579+
input_nets_sc->data[sc_spot_input_old] = (void*)out_net;
580+
} else if ((out_net != in_net) && (out_net->combined == false)) {
581+
// merge the out_net into the in_net and alter related string cache data for all nets driven by the out_net
582+
combine_nets_with_spot_copy(out_net, in_net, sc_spot_output, verilog_netlist);
583+
}
584+
}
585+
}
483586
/*---------------------------------------------------------------------------------------------
484587
* (function: remap_pin_to_new_net)
485588
*-------------------------------------------------------------------------------------------*/

ODIN_II/SRC/partial_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ void instantiate_shift(nnode_t* node, operation_list type, short mark, netlist_t
10131013
npin_t* new_pin1 = allocate_npin();
10141014
npin_t* new_pin2 = allocate_npin();
10151015
nnet_t* new_net = allocate_nnet();
1016-
new_net->name = vtr::strdup(muxes[i][j]->name);
1016+
new_net->name = make_full_ref_name(NULL, NULL, NULL, muxes[i][j]->name, j);
10171017
/* hook the output pin into the node */
10181018
add_output_pin_to_node(muxes[i][j], new_pin1, 0);
10191019
/* hook up new pin 1 into the new net */

0 commit comments

Comments
 (0)