Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F27033141
convert_muxig.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
convert_muxig.cpp
View Options
// Copyright 2025 Oliver Theimer
#include
<filesystem>
#include
<iostream>
#include
<string>
#include
"lorina/blif.hpp"
#include
<lorina/verilog.hpp>
#include
<mockturtle/algorithms/cleanup.hpp>
#include
<mockturtle/io/verilog_reader.hpp>
#include
<mockturtle/properties/migcost.hpp>
#include
<mockturtle/utils/stopwatch.hpp>
#include
"mockturtle/algorithms/cover_to_graph.hpp"
#include
"mockturtle/networks/cover.hpp"
#include
"mockturtle/networks/muxig.hpp"
#include
"mockturtle/algorithms/sim_resub.hpp"
#include
"mockturtle/io/blif_reader.hpp"
#include
"mockturtle/io/write_blif.hpp"
int
main
(
int
argc
,
char
*
argv
[])
{
// Default values
int
max_pis
=
10
;
int
max_divisors
=
150
;
int
max_inserts
=
20
;
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"o:p:d:i:"
))
!=
-1
)
{
switch
(
opt
)
{
case
'p'
:
max_pis
=
std
::
atoi
(
optarg
);
break
;
case
'o'
:
break
;
case
'd'
:
max_divisors
=
std
::
atoi
(
optarg
);
break
;
case
'i'
:
max_inserts
=
std
::
atoi
(
optarg
);
break
;
default
:
std
::
cerr
<<
"Usage: "
<<
argv
[
0
]
<<
" [-p max_pi] [-d max_divisors] [-i max_inserts] "
"<benchmark_file>
\n
"
;
return
1
;
}
}
std
::
string
benchmark
;
if
(
optind
<
argc
)
{
benchmark
=
argv
[
optind
];
}
else
{
std
::
cerr
<<
"Error: Missing required positional argument.
\n
"
;
std
::
cerr
<<
"Usage: "
<<
argv
[
0
]
<<
" [-p max_pi] [-d max_divisors] [-i max_inserts] <benchmark_file>
\n
"
;
return
1
;
}
if
(
!
std
::
filesystem
::
exists
(
benchmark
))
{
std
::
cout
<<
"[ERROR] File does not exist
\n
"
;
return
EXIT_FAILURE
;
}
std
::
filesystem
::
path
path
(
benchmark
);
std
::
string
base_name
=
path
.
stem
().
string
();
mockturtle
::
cover_network
cover
;
if
(
lorina
::
read_blif
(
benchmark
,
mockturtle
::
blif_reader
(
cover
))
!=
lorina
::
return_code
::
success
)
{
std
::
cout
<<
"[ERROR] While Lorina tried to read in file
\n
"
;
return
EXIT_FAILURE
;
}
mockturtle
::
muxig_network
muxig_original
=
mockturtle
::
convert_cover_to_graph
<
mockturtle
::
muxig_network
>
(
cover
);
mockturtle
::
resubstitution_params
ps
;
mockturtle
::
resubstitution_stats
st
;
ps
.
max_inserts
=
max_inserts
;
ps
.
max_pis
=
max_pis
;
ps
.
max_divisors
=
max_divisors
;
ps
.
progress
=
false
;
ps
.
verbose
=
false
;
mockturtle
::
sim_resubstitution
(
muxig_original
,
ps
,
&
st
);
muxig_original
=
mockturtle
::
cleanup_dangling
(
muxig_original
);
mockturtle
::
write_blif
(
muxig_original
,
"temp/"
+
base_name
+
"_muxig_temp.blif"
);
return
EXIT_SUCCESS
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Oct 27, 3:47 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
405019
Default Alt Text
convert_muxig.cpp (2 KB)
Attached To
Mode
R272 SoC_NEM_Synthesis
Attached
Detach File
Event Timeline