47 int m, nMints = (1<<nFans);
49 assert( nOuts > 0 && nOuts <= 64 && (64 % nOuts) == 0 );
50 fprintf( pFile,
"module table%d(ind, val);\n", Id );
51 fprintf( pFile,
" input [%d:0] ind;\n", nFans-1 );
52 fprintf( pFile,
" output [%d:0] val;\n", nOuts-1 );
53 fprintf( pFile,
" reg [%d:0] val;\n", nOuts-1 );
54 fprintf( pFile,
" always @(ind)\n" );
55 fprintf( pFile,
" begin\n" );
56 fprintf( pFile,
" case (ind)\n" );
57 for ( m = 0; m < nMints; m++ )
58 fprintf( pFile,
" %d\'h%x: val = %d\'h%x;\n", nFans, m, nOuts, (
unsigned)((pTable[(nOuts * m) >> 6] >> ((nOuts * m) & 63)) &
Abc_Tt6Mask(nOuts)) );
59 fprintf( pFile,
" endcase\n" );
60 fprintf( pFile,
" end\n" );
61 fprintf( pFile,
"endmodule\n" );
62 fprintf( pFile,
"\n" );
127 int LineLength = Start;
129 int AddedLength, i, iObj;
134 AddedLength =
strlen(pName) + 2;
135 if ( NameCounter && LineLength + AddedLength + 3 > 70 )
137 fprintf( pFile,
"\n " );
142 fprintf( pFile,
" %s%s", pName, (i==
Vec_IntSize(vVec)-1)?
"" :
"," );
143 LineLength += AddedLength;
152 fprintf( pFile,
"module %s ( ", p->
pName );
153 fprintf( pFile,
"\n " );
157 fprintf( pFile,
",\n " );
161 fprintf( pFile,
" );\n" );
175 fprintf( pFile,
" " );
177 fprintf( pFile,
"input " );
178 else if ( pObj->
fIsPo )
179 fprintf( pFile,
"output " );
181 fprintf( pFile,
" " );
184 fprintf( pFile,
"wire %s %s ;\n", Range,
Wlc_ObjName(p, i) );
190 fprintf( pFile,
" assign " );
192 fprintf( pFile,
"reg %s ", Range );
194 fprintf( pFile,
"wire %s ", Range );
224 fprintf( pFile,
" " );
225 fprintf( pFile,
"always @( " );
228 fprintf( pFile,
" )\n" );
229 fprintf( pFile,
" " );
230 fprintf( pFile,
"begin\n" );
231 fprintf( pFile,
" " );
236 fprintf( pFile,
" " );
237 fprintf( pFile,
"%d : %s = ", k-1,
Wlc_ObjName(p, i) );
240 fprintf( pFile,
" " );
241 fprintf( pFile,
"endcase\n" );
242 fprintf( pFile,
" " );
243 fprintf( pFile,
"end\n" );
272 fprintf( pFile,
"{ {%d{%s[%d]}}, %s }",
Wlc_ObjRange(pObj) -
Wlc_ObjRange(
Wlc_ObjFanin0(p, pObj)),
Wlc_ObjName(p,
Wlc_ObjFaninId0(pObj)),
Wlc_ObjRange(
Wlc_ObjFanin0(p, pObj)) - 1,
Wlc_ObjName(p,
Wlc_ObjFaninId0(pObj)) );
277 fprintf( pFile,
"{" );
280 fprintf( pFile,
" }" );
286 fprintf( pFile,
">>" );
288 fprintf( pFile,
">>>" );
290 fprintf( pFile,
"<<" );
292 fprintf( pFile,
"<<<" );
294 fprintf( pFile,
"&" );
296 fprintf( pFile,
"|" );
298 fprintf( pFile,
"^" );
300 fprintf( pFile,
"&&" );
302 fprintf( pFile,
"||" );
304 fprintf( pFile,
"==" );
306 fprintf( pFile,
"!=" );
308 fprintf( pFile,
"<" );
310 fprintf( pFile,
">" );
312 fprintf( pFile,
"<=" );
314 fprintf( pFile,
">=" );
316 fprintf( pFile,
"+" );
318 fprintf( pFile,
"-" );
320 fprintf( pFile,
"*" );
322 fprintf( pFile,
"//" );
324 fprintf( pFile,
"%%" );
326 fprintf( pFile,
"**" );
331 fprintf( pFile,
" ;\n" );
339 fprintf( pFile,
" " );
340 fprintf( pFile,
"CPL_FF" );
343 fprintf( pFile,
" reg%d (", i );
344 fprintf( pFile,
" .q( %s ),", pName );
345 fprintf( pFile,
" .qbar()," );
347 fprintf( pFile,
" .clk( %s ),",
"1\'b0" );
348 fprintf( pFile,
" .arst( %s ),",
"1\'b0" );
349 fprintf( pFile,
" .arstval( %s )",
"1\'b0" );
350 fprintf( pFile,
" ) ;\n" );
352 fprintf( pFile,
"endmodule\n\n" );
357 pFile = fopen( pFileName,
"w" );
360 fprintf( stdout,
"Wlc_WriteVer(): Cannot open the output file \"%s\".\n", pFileName );
364 fprintf( pFile,
"\n" );
368 fprintf( pFile,
"\n" );
static int Wlc_ObjId(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
static Wlc_Obj_t * Wlc_ObjFoToFi(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
static int Wlc_ObjFaninId1(Wlc_Obj_t *p)
static int Wlc_ObjCiId(Wlc_Obj_t *p)
void Wlc_WriteVerInt(FILE *pFile, Wlc_Ntk_t *p)
static int Wlc_ObjIsSigned(Wlc_Obj_t *p)
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static void Abc_TtPrintHexArrayRev(FILE *pFile, word *pTruth, int nDigits)
static Wlc_Obj_t * Wlc_NtkObj(Wlc_Ntk_t *p, int Id)
static int Wlc_ObjRangeEnd(Wlc_Obj_t *p)
static Wlc_Obj_t * Wlc_ObjFanin0(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
static int Wlc_ObjRange(Wlc_Obj_t *p)
static int Vec_PtrSize(Vec_Ptr_t *p)
ABC_NAMESPACE_IMPL_START void Wlc_WriteTableOne(FILE *pFile, int nFans, int nOuts, word *pTable, int Id)
DECLARATIONS ///.
static int Wlc_ObjFaninId0(Wlc_Obj_t *p)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static Vec_Int_t * Vec_IntStart(int nSize)
static int Wlc_NtkPoNum(Wlc_Ntk_t *p)
#define Wlc_NtkForEachCi(p, pCi, i)
static int Wlc_ObjFaninNum(Wlc_Obj_t *p)
static int Vec_IntEntry(Vec_Int_t *p, int i)
unsigned __int64 word
DECLARATIONS ///.
static int Abc_Base10Log(unsigned n)
#define ABC_NAMESPACE_IMPL_END
static int Wlc_ObjIsCi(Wlc_Obj_t *p)
void Wlc_WriteAddPos(Wlc_Ntk_t *p)
void Wlc_WriteVerIntVec(FILE *pFile, Wlc_Ntk_t *p, Vec_Int_t *vVec, int Start)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int * Wlc_ObjConstValue(Wlc_Obj_t *p)
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
static int Wlc_ObjRangeBeg(Wlc_Obj_t *p)
static word Abc_Tt6Mask(int nBits)
#define ABC_NAMESPACE_IMPL_START
static int Wlc_ObjFaninId(Wlc_Obj_t *p, int i)
static int Vec_IntSize(Vec_Int_t *p)
static int Wlc_ObjTableId(Wlc_Obj_t *p)
void Wlc_WriteTables(FILE *pFile, Wlc_Ntk_t *p)
static Wlc_Obj_t * Wlc_ObjFanin1(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
static int Wlc_NtkPiNum(Wlc_Ntk_t *p)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Wlc_ObjFaninId2(Wlc_Obj_t *p)
static void Vec_IntClear(Vec_Int_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
void Wlc_WriteVer(Wlc_Ntk_t *p, char *pFileName)