Skip to content

Commit 15abe44

Browse files
committed
Updates to the jsonc writer.
1 parent ee04349 commit 15abe44

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/base/io/ioJsonc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -707,16 +707,19 @@ void Jsonc_WriteTest( Abc_Ntk_t * p, char * pFileName )
707707
assert( pGate != NULL );
708708
Vec_IntWriteEntry( vObj2Num, Abc_ObjId(pObj), Counter );
709709
fprintf( pFile, " {\n" );
710-
fprintf( pFile, " \"type\": \"%s\",\n", Mio_GateReadName(pGate) );
711-
fprintf( pFile, " \"name\": \"%s\",\n", Jsonc_GetNodeOutName(pObj) );
710+
fprintf( pFile, " \"type\": \"%s\",\n", "instance" );
711+
fprintf( pFile, " \"name\": \"%s\",\n", Mio_GateReadName(pGate) );
712712
fprintf( pFile, " \"fanins\": [\n" );
713713
fprintf( pFile, " {\n" );
714714
for ( pPin = Mio_GateReadPins(pGate), k = 0; pPin; pPin = Mio_PinReadNext(pPin), k++ )
715715
{
716716
Abc_Obj_t * pFanin = Abc_ObjFanin0Ntk( Abc_ObjFanin(pObj, k) );
717717
int FanId = Vec_IntEntry( vObj2Num, Abc_ObjId(pFanin) );
718718
assert( FanId >= 0 );
719-
fprintf( pFile, " \"%s\": { \"node\": %d }%s\n", Mio_PinReadName(pPin), FanId, Mio_PinReadNext(pPin) ? "," : "" );
719+
fprintf( pFile, " \"%s\": { \"node\": %d", Mio_PinReadName(pPin), FanId );
720+
if ( Abc_ObjIsNode(pFanin) && pFanin->pData != NULL )
721+
fprintf( pFile, ", \"pin\": \"%s\"", Mio_GateReadOutName((Mio_Gate_t *)pFanin->pData) );
722+
fprintf( pFile, " }%s\n", Mio_PinReadNext(pPin) ? "," : "" );
720723
}
721724
fprintf( pFile, " }\n" );
722725
fprintf( pFile, " ]\n" );
@@ -734,8 +737,8 @@ void Jsonc_WriteTest( Abc_Ntk_t * p, char * pFileName )
734737
fprintf( pFile, " \"name\": \"%s\",\n", Name );
735738
fprintf( pFile, " \"bit\": %d,\n", Bit );
736739
fprintf( pFile, " \"fanin\": { \"node\": %d", FanId );
737-
//if ( Abc_ObjIsNode(pDriver) && pDriver->pData != NULL )
738-
// fprintf( pFile, ", \"pin\": \"%s\"", Mio_GateReadOutName((Mio_Gate_t *)pDriver->pData) );
740+
if ( Abc_ObjIsNode(pDriver) && pDriver->pData != NULL )
741+
fprintf( pFile, ", \"pin\": \"%s\"", Mio_GateReadOutName((Mio_Gate_t *)pDriver->pData) );
739742
fprintf( pFile, " }\n" );
740743
fprintf( pFile, " }%s\n", ++Counter == Total ? "" : "," );
741744
}

0 commit comments

Comments
 (0)