Skip to content

Commit 876e0ca

Browse files
committed
xor gate changes case it is not used --jp
1 parent 6f81edc commit 876e0ca

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

ODIN_II/SRC/partial_map.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void instantiate_bitwise_logic(nnode_t *node, operation_list op, short mark, net
554554
int i, j;
555555

556556
operation_list cell_op;
557-
557+
if (!node) return;
558558
oassert(node->num_input_pins > 0);
559559
oassert(node->num_input_port_sizes >= 2);
560560

@@ -778,7 +778,7 @@ void instantiate_GT(nnode_t *node, operation_list type, short mark, netlist_t *n
778778
int port_A_index;
779779
int port_B_index;
780780
int index = 0;
781-
nnode_t *xor_gate;
781+
nnode_t *xor_gate=NULL;
782782
nnode_t *logical_or_gate;
783783
nnode_t **or_cells;
784784
nnode_t **gt_cells;
@@ -816,8 +816,12 @@ void instantiate_GT(nnode_t *node, operation_list type, short mark, netlist_t *n
816816
node_name_based_on_op(node));
817817
}
818818

819-
/* xor gate identifies if any bits don't match */
820-
xor_gate = make_2port_gate(LOGICAL_XOR, width_a-1, width_b-1, width_max-1, node, mark);
819+
if (width_max>1)
820+
{
821+
/* xor gate identifies if any bits don't match */
822+
xor_gate = make_2port_gate(LOGICAL_XOR, width_a-1, width_b-1, width_max-1, node, mark);
823+
}
824+
821825
/* collects all the GT signals and determines if gt */
822826
logical_or_gate = make_1port_logic_gate(LOGICAL_OR, width_max, node, mark);
823827
/* collects a chain if any 1 happens than the GT cells output 0 */
@@ -882,9 +886,12 @@ void instantiate_GT(nnode_t *node, operation_list type, short mark, netlist_t *n
882886
/* deal with the first greater than test which autom gets a zero */
883887
add_input_pin_to_node(or_cells[i], get_zero_pin(netlist), 1);
884888
}
889+
if (width_max>1)
890+
{
891+
/* get all the equals with the or gates */
892+
connect_nodes(xor_gate, i, or_cells[i], 0);
893+
}
885894

886-
/* get all the equals with the or gates */
887-
connect_nodes(xor_gate, i, or_cells[i], 0);
888895
connect_nodes(or_cells[i], 0, gt_cells[i], 2);
889896

890897
}
@@ -906,9 +913,12 @@ void instantiate_GT(nnode_t *node, operation_list type, short mark, netlist_t *n
906913
/* join that gate to the output */
907914
remap_pin_to_new_node(node->output_pins[0], logical_or_gate, 0);
908915
oassert(logical_or_gate->num_output_pins == 1);
909-
910-
instantiate_bitwise_logic(xor_gate, BITWISE_XOR, mark, netlist);
911-
vtr::free(xor_gate);
916+
if (xor_gate!= NULL)
917+
{
918+
instantiate_bitwise_logic(xor_gate, BITWISE_XOR, mark, netlist);
919+
vtr::free(xor_gate);
920+
}
921+
912922
vtr::free(gt_cells);
913923
vtr::free(or_cells);
914924
}

0 commit comments

Comments
 (0)