Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
ec0b9b6b
Commit
ec0b9b6b
authored
Sep 16, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to word-level Verilog parser.
parent
6d0b555d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
5 deletions
+23
-5
src/base/wlc/wlc.h
+5
-1
src/base/wlc/wlcBlast.c
+6
-0
src/base/wlc/wlcNtk.c
+11
-4
src/base/wlc/wlcReadVer.c
+0
-0
src/base/wlc/wlcWriteVer.c
+1
-0
No files found.
src/base/wlc/wlc.h
View file @
ec0b9b6b
...
@@ -80,7 +80,8 @@ typedef enum {
...
@@ -80,7 +80,8 @@ typedef enum {
WLC_OBJ_ARI_DIVIDE
,
// 36: arithmetic division
WLC_OBJ_ARI_DIVIDE
,
// 36: arithmetic division
WLC_OBJ_ARI_MODULUS
,
// 37: arithmetic modulus
WLC_OBJ_ARI_MODULUS
,
// 37: arithmetic modulus
WLC_OBJ_ARI_POWER
,
// 38: arithmetic power
WLC_OBJ_ARI_POWER
,
// 38: arithmetic power
WLC_OBJ_NUMBER
// 39: unused
WLC_OBJ_TABLE
,
// 39: arithmetic power
WLC_OBJ_NUMBER
// 40: unused
}
Wlc_ObjType_t
;
}
Wlc_ObjType_t
;
...
@@ -117,6 +118,8 @@ struct Wlc_Ntk_t_
...
@@ -117,6 +118,8 @@ struct Wlc_Ntk_t_
int
iObj
;
int
iObj
;
int
nObjsAlloc
;
int
nObjsAlloc
;
Mem_Flex_t
*
pMemFanin
;
Mem_Flex_t
*
pMemFanin
;
Mem_Flex_t
*
pMemTable
;
Vec_Ptr_t
*
vTables
;
// object names
// object names
Abc_Nam_t
*
pManName
;
// object names
Abc_Nam_t
*
pManName
;
// object names
Vec_Int_t
vNameIds
;
// object name IDs
Vec_Int_t
vNameIds
;
// object name IDs
...
@@ -159,6 +162,7 @@ static inline int Wlc_ObjRange( Wlc_Obj_t * p )
...
@@ -159,6 +162,7 @@ static inline int Wlc_ObjRange( Wlc_Obj_t * p )
static
inline
int
Wlc_ObjRangeEnd
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_BIT_SELECT
);
return
p
->
Fanins
[
1
]
>>
16
;
}
static
inline
int
Wlc_ObjRangeEnd
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_BIT_SELECT
);
return
p
->
Fanins
[
1
]
>>
16
;
}
static
inline
int
Wlc_ObjRangeBeg
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_BIT_SELECT
);
return
p
->
Fanins
[
1
]
&
0xFFFF
;
}
static
inline
int
Wlc_ObjRangeBeg
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_BIT_SELECT
);
return
p
->
Fanins
[
1
]
&
0xFFFF
;
}
static
inline
int
*
Wlc_ObjConstValue
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_CONST
);
return
Wlc_ObjFanins
(
p
);
}
static
inline
int
*
Wlc_ObjConstValue
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_CONST
);
return
Wlc_ObjFanins
(
p
);
}
static
inline
int
Wlc_ObjTableId
(
Wlc_Obj_t
*
p
)
{
assert
(
p
->
Type
==
WLC_OBJ_TABLE
);
return
p
->
Fanins
[
1
];
}
static
inline
void
Wlc_NtkCleanCopy
(
Wlc_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vCopies
,
p
->
nObjsAlloc
,
0
);
}
static
inline
void
Wlc_NtkCleanCopy
(
Wlc_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vCopies
,
p
->
nObjsAlloc
,
0
);
}
static
inline
int
Wlc_NtkHasCopy
(
Wlc_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vCopies
)
>
0
;
}
static
inline
int
Wlc_NtkHasCopy
(
Wlc_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vCopies
)
>
0
;
}
...
...
src/base/wlc/wlcBlast.c
View file @
ec0b9b6b
...
@@ -328,6 +328,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p )
...
@@ -328,6 +328,12 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p )
assert
(
Vec_IntSize
(
vTemp3
)
==
nRange
);
assert
(
Vec_IntSize
(
vTemp3
)
==
nRange
);
Vec_IntAppend
(
vBits
,
vTemp3
);
Vec_IntAppend
(
vBits
,
vTemp3
);
}
}
else
if
(
pObj
->
Type
==
WLC_OBJ_TABLE
)
{
assert
(
pObj
->
Type
!=
WLC_OBJ_TABLE
);
for
(
k
=
0
;
k
<
nRange
;
k
++
)
Vec_IntPush
(
vBits
,
0
);
}
else
assert
(
0
);
else
assert
(
0
);
}
}
assert
(
nBits
==
Vec_IntSize
(
vBits
)
);
assert
(
nBits
==
Vec_IntSize
(
vBits
)
);
...
...
src/base/wlc/wlcNtk.c
View file @
ec0b9b6b
...
@@ -68,7 +68,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
...
@@ -68,7 +68,8 @@ static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
"//"
,
// 36: arithmetic division
"//"
,
// 36: arithmetic division
"%%"
,
// 37: arithmetic modulus
"%%"
,
// 37: arithmetic modulus
"**"
,
// 38: arithmetic power
"**"
,
// 38: arithmetic power
NULL
// 39: unused
"table"
,
// 39: lookup table
NULL
// 40: unused
};
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -155,10 +156,10 @@ void Wlc_ObjAddFanins( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFanins )
...
@@ -155,10 +156,10 @@ void Wlc_ObjAddFanins( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFanins )
if
(
Wlc_ObjHasArray
(
pObj
)
)
if
(
Wlc_ObjHasArray
(
pObj
)
)
pObj
->
pFanins
[
0
]
=
(
int
*
)
Mem_FlexEntryFetch
(
p
->
pMemFanin
,
Vec_IntSize
(
vFanins
)
*
sizeof
(
int
)
);
pObj
->
pFanins
[
0
]
=
(
int
*
)
Mem_FlexEntryFetch
(
p
->
pMemFanin
,
Vec_IntSize
(
vFanins
)
*
sizeof
(
int
)
);
memcpy
(
Wlc_ObjFanins
(
pObj
),
Vec_IntArray
(
vFanins
),
sizeof
(
int
)
*
Vec_IntSize
(
vFanins
)
);
memcpy
(
Wlc_ObjFanins
(
pObj
),
Vec_IntArray
(
vFanins
),
sizeof
(
int
)
*
Vec_IntSize
(
vFanins
)
);
// special treatment of CONST
and SELECT
// special treatment of CONST
, SELECT and TABLE
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
if
(
pObj
->
Type
==
WLC_OBJ_CONST
)
pObj
->
nFanins
=
0
;
pObj
->
nFanins
=
0
;
else
if
(
pObj
->
Type
==
WLC_OBJ_BIT_SELECT
)
else
if
(
pObj
->
Type
==
WLC_OBJ_BIT_SELECT
||
pObj
->
Type
==
WLC_OBJ_TABLE
)
pObj
->
nFanins
=
1
;
pObj
->
nFanins
=
1
;
}
}
void
Wlc_NtkFree
(
Wlc_Ntk_t
*
p
)
void
Wlc_NtkFree
(
Wlc_Ntk_t
*
p
)
...
@@ -167,6 +168,9 @@ void Wlc_NtkFree( Wlc_Ntk_t * p )
...
@@ -167,6 +168,9 @@ void Wlc_NtkFree( Wlc_Ntk_t * p )
Abc_NamStop
(
p
->
pManName
);
Abc_NamStop
(
p
->
pManName
);
if
(
p
->
pMemFanin
)
if
(
p
->
pMemFanin
)
Mem_FlexStop
(
p
->
pMemFanin
,
0
);
Mem_FlexStop
(
p
->
pMemFanin
,
0
);
if
(
p
->
pMemTable
)
Mem_FlexStop
(
p
->
pMemTable
,
0
);
Vec_PtrFreeP
(
&
p
->
vTables
);
ABC_FREE
(
p
->
vPis
.
pArray
);
ABC_FREE
(
p
->
vPis
.
pArray
);
ABC_FREE
(
p
->
vPos
.
pArray
);
ABC_FREE
(
p
->
vPos
.
pArray
);
ABC_FREE
(
p
->
vCis
.
pArray
);
ABC_FREE
(
p
->
vCis
.
pArray
);
...
@@ -258,7 +262,7 @@ void Wlc_ObjCollectCopyFanins( Wlc_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
...
@@ -258,7 +262,7 @@ void Wlc_ObjCollectCopyFanins( Wlc_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
for
(
i
=
0
;
i
<
nInts
;
i
++
)
for
(
i
=
0
;
i
<
nInts
;
i
++
)
Vec_IntPush
(
vFanins
,
pInts
[
i
]
);
Vec_IntPush
(
vFanins
,
pInts
[
i
]
);
}
}
else
if
(
pObj
->
Type
==
WLC_OBJ_BIT_SELECT
)
else
if
(
pObj
->
Type
==
WLC_OBJ_BIT_SELECT
||
pObj
->
Type
==
WLC_OBJ_TABLE
)
{
{
assert
(
Vec_IntSize
(
vFanins
)
==
1
);
assert
(
Vec_IntSize
(
vFanins
)
==
1
);
Vec_IntPush
(
vFanins
,
pObj
->
Fanins
[
1
]
);
Vec_IntPush
(
vFanins
,
pObj
->
Fanins
[
1
]
);
...
@@ -316,6 +320,9 @@ void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p )
...
@@ -316,6 +320,9 @@ void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p )
pNew
->
pManName
=
p
->
pManName
;
pNew
->
pManName
=
p
->
pManName
;
p
->
pManName
=
NULL
;
p
->
pManName
=
NULL
;
Vec_IntErase
(
&
p
->
vNameIds
);
Vec_IntErase
(
&
p
->
vNameIds
);
// transfer table
pNew
->
pMemTable
=
p
->
pMemTable
;
p
->
pMemTable
=
NULL
;
pNew
->
vTables
=
p
->
vTables
;
p
->
vTables
=
NULL
;
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
src/base/wlc/wlcReadVer.c
View file @
ec0b9b6b
This diff is collapsed.
Click to expand it.
src/base/wlc/wlcWriteVer.c
View file @
ec0b9b6b
...
@@ -87,6 +87,7 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
...
@@ -87,6 +87,7 @@ void Wlc_WriteVerInt( FILE * pFile, Wlc_Ntk_t * p )
int
nDigits
=
Abc_Base10Log
(
pObj
->
End
+
1
)
+
Abc_Base10Log
(
pObj
->
Beg
+
1
);
int
nDigits
=
Abc_Base10Log
(
pObj
->
End
+
1
)
+
Abc_Base10Log
(
pObj
->
Beg
+
1
);
sprintf
(
Range
,
"%s[%d:%d]%*s"
,
pObj
->
Signed
?
"signed "
:
" "
,
pObj
->
End
,
pObj
->
Beg
,
8
-
nDigits
,
""
);
sprintf
(
Range
,
"%s[%d:%d]%*s"
,
pObj
->
Signed
?
"signed "
:
" "
,
pObj
->
End
,
pObj
->
Beg
,
8
-
nDigits
,
""
);
fprintf
(
pFile
,
" "
);
fprintf
(
pFile
,
" "
);
assert
(
pObj
->
Type
!=
WLC_OBJ_TABLE
);
if
(
pObj
->
Type
==
WLC_OBJ_PI
)
if
(
pObj
->
Type
==
WLC_OBJ_PI
)
fprintf
(
pFile
,
"input wire %s %-16s"
,
Range
,
pName
);
fprintf
(
pFile
,
"input wire %s %-16s"
,
Range
,
pName
);
else
if
(
pObj
->
Type
==
WLC_OBJ_PO
)
else
if
(
pObj
->
Type
==
WLC_OBJ_PO
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment