shenpeifu / vtr-verilog-to-routing

Automatically exported from code.google.com/p/vtr-verilog-to-routing
0 stars 0 forks source link

ABC crash on 64b Mac #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The ABC step fails on my system (Mac OS X 10.9.3 x64) on _some_ (huge) BLIF 
files generated by ODIN II. The attached file aes_flat.v can reproduce this 
behavior during resyn2, after going through ODIN (tested on the latest SVN rev).

I could not attach the BLIF file due to its size (31MB), but this is the output 
:

----------
$ ./abc -c "read aes.odin.blif; resyn; resyn2"
The 4-input library started with 43906 nodes and 24772 subgraphs. Time =   0.05 
sec
Warning: Constant-0 drivers added to 1 non-driven nets in network 
"aes_cipher_top":
top.aes_key_expand_128+u0^BUF_NODE~1815
Segmentation fault: 11
----------

The latest revision of the ABC repository doesn't crash. The bug comes from a 
truncated pointer in the CUDD package used by ABC :

----------
$ lldb ./abc 
Current executable set to './abc' (x86_64).
(lldb) r
Process 43615 launched: './abc' (x86_64)
The 4-input library started with 43906 nodes and 24772 subgraphs. Time =   0.04 
sec
UC Berkeley, ABC for VTR 7.0 (compiled May 27 2014 14:45:36)
abc 01> read aes.odin.blif; resyn; resyn2
Warning: Constant-0 drivers added to 1 non-driven nets in network 
"aes_cipher_top":
top.aes_key_expand_128+u0^BUF_NODE~1815
Process 43615 stopped
* thread #1: tid = 0x6aeee, 0x000000010013ff1a 
abc`cuddGarbageCollectZdd(unique=0x0000000104731480, clearCache=1) + 248 at 
cuddTable.c:896, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=1, address=0x6bd9a02)
    frame #0: 0x000000010013ff1a abc`cuddGarbageCollectZdd(unique=0x0000000104731480, clearCache=1) + 248 at cuddTable.c:896
   893      for (i = 0; i < slots; i++) {
   894          c = &cache[i];
   895          if (c->data != NULL) {
-> 896          if (cuddClean(c->f)->ref == 0 ||
   897          cuddClean(c->g)->ref == 0 ||
   898          (((ptruint)c->f & 0x2) && Cudd_Regular(c->h)->ref == 0) ||
   899          (c->data != DD_NON_CONSTANT &&
----------

Indeed, the SIZEOF_VOID_P constant in src/bdd/mtr/mtr.h is assigned its default 
value on Darwin. The proposed attached patch cudd-bugfix-darwin.h adds a few 
preprocessor directives that forces the good pointer size to be used on these 
systems and fixes the issue. 

The "official" ABC Makefile includes a small program arch_flags.c compiled 
during the build which sets the good values for SIZEOF_VOID_P (among other data 
sizes).

Regards,
-- Christophe Huriaux

Original issue reported on code.google.com by c.huri...@gmail.com on 27 May 2014 at 7:15

Attachments: