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
e1997b03
Commit
e1997b03
authored
Jan 03, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding commands 'save' and 'load' for mapped networks.
parent
f6dc4a58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
152 additions
and
0 deletions
+152
-0
src/base/abci/abc.c
+145
-0
src/base/main/mainInt.h
+7
-0
No files found.
src/base/abci/abc.c
View file @
e1997b03
...
@@ -371,6 +371,9 @@ static int Abc_CommandIso ( Abc_Frame_t * pAbc, int argc, cha
...
@@ -371,6 +371,9 @@ static int Abc_CommandIso ( Abc_Frame_t * pAbc, int argc, cha
static
int
Abc_CommandTraceStart
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTraceStart
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTraceCheck
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandTraceCheck
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbcSave
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbcLoad
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Get
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Get
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Put
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Put
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Save
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
Abc_CommandAbc9Save
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -1073,6 +1076,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
...
@@ -1073,6 +1076,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Verification"
,
"blockpo"
,
Abc_CommandBlockPo
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Verification"
,
"blockpo"
,
Abc_CommandBlockPo
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Verification"
,
"iso"
,
Abc_CommandIso
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Verification"
,
"iso"
,
Abc_CommandIso
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"save"
,
Abc_CommandAbcSave
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"load"
,
Abc_CommandAbcLoad
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&get"
,
Abc_CommandAbc9Get
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&get"
,
Abc_CommandAbc9Get
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&put"
,
Abc_CommandAbc9Put
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&put"
,
Abc_CommandAbc9Put
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&save"
,
Abc_CommandAbc9Save
,
0
);
Cmd_CommandAdd
(
pAbc
,
"ABC9"
,
"&save"
,
Abc_CommandAbc9Save
,
0
);
...
@@ -29478,6 +29484,145 @@ usage:
...
@@ -29478,6 +29484,145 @@ usage:
}
}
/**Function*************************************************************
Synopsis [Compares to versions of the design and finds the best.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Abc_NtkCompareWithBest
(
Abc_Ntk_t
*
pBest
,
Abc_Ntk_t
*
p
,
float
*
pnBestNtkArea
,
float
*
pnBestNtkDelay
,
int
*
pnBestNtkNodes
,
int
*
pnBestNtkLevels
,
int
fArea
)
{
float
nNtkArea
=
(
float
)
Abc_NtkGetMappedArea
(
p
);
float
nNtkDelay
=
(
float
)
Abc_NtkDelayTrace
(
p
,
NULL
,
NULL
,
0
);
int
nNtkNodes
=
Abc_NtkNodeNum
(
p
);
int
nNtkLevels
=
Abc_NtkLevel
(
p
);
if
(
pBest
==
NULL
||
Abc_NtkPiNum
(
pBest
)
!=
Abc_NtkPiNum
(
p
)
||
Abc_NtkPoNum
(
pBest
)
!=
Abc_NtkPoNum
(
p
)
||
Abc_NtkLatchNum
(
pBest
)
!=
Abc_NtkLatchNum
(
p
)
||
strcmp
(
Abc_NtkName
(
pBest
),
Abc_NtkName
(
p
))
||
(
!
fArea
&&
(
*
pnBestNtkLevels
>
nNtkLevels
||
(
*
pnBestNtkLevels
==
nNtkLevels
&&
*
pnBestNtkDelay
>
nNtkDelay
)))
||
(
fArea
&&
(
*
pnBestNtkNodes
>
nNtkNodes
||
(
*
pnBestNtkNodes
==
nNtkNodes
&&
*
pnBestNtkArea
>
nNtkArea
)))
)
{
*
pnBestNtkArea
=
nNtkArea
;
*
pnBestNtkDelay
=
nNtkDelay
;
*
pnBestNtkNodes
=
nNtkNodes
;
*
pnBestNtkLevels
=
nNtkLevels
;
printf
(
"
\n
Updating the best network (Area = %10.2f Delay = %10.2f Nodes = %6d Level = %6d).
\n\n
"
,
nNtkArea
,
nNtkDelay
,
nNtkNodes
,
nNtkLevels
);
return
1
;
}
return
0
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbcSave
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
int
c
,
fArea
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"ah"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'a'
:
fArea
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pAbc
->
pNtkCur
==
NULL
)
{
Abc_Print
(
-
1
,
"Empty network.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkHasMapping
(
pAbc
->
pNtkCur
)
)
{
Abc_Print
(
-
1
,
"Network has no mapping.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkCompareWithBest
(
pAbc
->
pNtkBest
,
pAbc
->
pNtkCur
,
&
pAbc
->
nBestNtkArea
,
&
pAbc
->
nBestNtkDelay
,
&
pAbc
->
nBestNtkNodes
,
&
pAbc
->
nBestNtkLevels
,
fArea
)
)
return
0
;
// save the design as best
if
(
pAbc
->
pNtkBest
)
Abc_NtkDelete
(
pAbc
->
pNtkBest
);
pAbc
->
pNtkBest
=
Abc_NtkDup
(
pAbc
->
pNtkCur
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: save [-ah]
\n
"
);
Abc_Print
(
-
2
,
"
\t
compares and possibly saves network with mapping
\n
"
);
Abc_Print
(
-
2
,
"
\t
-a : toggle using area as the primary metric [default = %s]
\n
"
,
fArea
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_CommandAbcLoad
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
int
c
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
// restore from best
if
(
pAbc
->
pNtkBest
==
NULL
)
{
Abc_Print
(
-
1
,
"Abc_CommandAbcLoad(): There is no best design saved.
\n
"
);
return
1
;
}
if
(
pAbc
->
pNtkCur
)
Abc_NtkDelete
(
pAbc
->
pNtkCur
);
pAbc
->
pNtkCur
=
Abc_NtkDup
(
pAbc
->
pNtkBest
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: load [-h]
\n
"
);
Abc_Print
(
-
2
,
"
\t
loads mapped network previously saved by
\"
save
\"\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis []
Synopsis []
src/base/main/mainInt.h
View file @
e1997b03
...
@@ -76,6 +76,13 @@ struct Abc_Frame_t_
...
@@ -76,6 +76,13 @@ struct Abc_Frame_t_
int
fAutoexac
;
// marks the autoexec mode
int
fAutoexac
;
// marks the autoexec mode
int
fBatchMode
;
// batch mode flag
int
fBatchMode
;
// batch mode flag
int
fBridgeMode
;
// bridge mode flag
int
fBridgeMode
;
// bridge mode flag
// save/load
Abc_Ntk_t
*
pNtkBest
;
// the current network
float
nBestNtkArea
;
// best area
float
nBestNtkDelay
;
// best delay
int
nBestNtkNodes
;
// best nodes
int
nBestNtkLevels
;
// best levels
// output streams
// output streams
FILE
*
Out
;
FILE
*
Out
;
FILE
*
Err
;
FILE
*
Err
;
...
...
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