rubund / graywolf

Other
107 stars 36 forks source link

Large designs overflow EDGE_COST record #21

Closed RTimothyEdwards closed 6 years ago

RTimothyEdwards commented 6 years ago

src/twsc/netgraph.c: lines 71 and 72 structure EDGE_COST has components node1 and node2 cast as SHORT. For a large design (microprocessor-sized, but not insanely big), the number of nodes easily exceeds 65535 and causes arrays to be addressed with negative indexes, crashing TimberwolfSC. The values are set from adding pins_at_rowS and first_indexS, both of which are type INT, so changing these from type SHORT to INT solves the problem, and any design that overflows type INT in the number of nodes is insanely big.

In summary,

typedef struct graph_edge_cost { INT node1 ; INT node2 ; INT cost ; INT channel ; } *EDGE_COST , EDGE_COST_BOX ;

rubund commented 6 years ago

I had to do the same change in src/twsc/sort.c also. If I didn´t, the test suite failed. I used the oppurtunuity to move the definition of the struct into the header file main.h

Thank you