Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
macroplacement
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
macroplacement
Commits
ccf490ad
Commit
ccf490ad
authored
Sep 29, 2022
by
Dinple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix netlist parser
parent
93752bef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
25 deletions
+46
-25
CodeElements/Plc_client/plc_client_os.py
+41
-20
CodeElements/Plc_client/plc_client_os_test.py
+5
-5
No files found.
CodeElements/Plc_client/plc_client_os.py
View file @
ccf490ad
...
...
@@ -159,7 +159,6 @@ class PlacementCost(object):
# node found
if
line_item
[
0
]
==
'node'
:
node_cnt
+=
1
node_name
=
''
input_list
=
[]
...
...
@@ -169,8 +168,14 @@ class PlacementCost(object):
# retrieve node name
if
line_item
[
0
]
==
'name'
:
node_name
=
line_item
[
1
]
if
node_name
==
"__metadata__"
:
print
(
"skipping __metadata__"
)
else
:
# print(node_name)
node_cnt
+=
1
else
:
node_name
=
'N/A name'
# advance ptr
line
=
fp
.
readline
()
...
...
@@ -198,23 +203,42 @@ class PlacementCost(object):
line_item
=
re
.
findall
(
r'\w+'
,
line
)
key
=
line_item
[
1
]
# advance, expect value
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\w+'
,
line
)
if
key
==
"macro_name"
:
# advance, expect value
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\w+'
,
line
)
# advance, expect value item
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\-*\w+\.*\/{0,1}\w*[\w+\/{0,1}\w*
]*'
,
line
)
# advance, expect value item
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\w+[^\:\n\\{\}\s"
]*'
,
line
)
attr_dict
[
key
]
=
line_item
attr_dict
[
key
]
=
line_item
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\w+'
,
line
)
line_item
=
re
.
findall
(
r'\w+'
,
line
)
else
:
# advance, expect value
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\w+'
,
line
)
if
attr_dict
[
'type'
][
1
]
==
'macro'
:
# advance, expect value item
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\-*\w+\.*\/{0,1}\w*[\w+\/{0,1}\w*]*'
,
line
)
attr_dict
[
key
]
=
line_item
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line
=
fp
.
readline
()
line_item
=
re
.
findall
(
r'\w+'
,
line
)
if
node_name
==
"__metadata__"
:
logging
.
info
(
'[NETLIST PARSER INFO] skipping invalid net input'
)
elif
attr_dict
[
'type'
][
1
]
==
'macro'
:
# soft macro
# check if all required information is obtained
try
:
...
...
@@ -301,6 +325,7 @@ class PlacementCost(object):
x_offset
=
attr_dict
[
'x_offset'
][
1
],
y_offset
=
attr_dict
[
'y_offset'
][
1
],
macro_name
=
attr_dict
[
'macro_name'
][
1
])
if
'weight'
in
attr_dict
.
keys
():
hard_macro_pin
.
set_weight
(
float
(
attr_dict
[
'weight'
][
1
]))
...
...
@@ -1677,19 +1702,15 @@ class PlacementCost(object):
return
mod
.
get_width
(),
mod
.
get_height
()
def
make_soft_macros_square
(
self
):
"""
update soft macro width/height base on its square area
"""
pass
def
update_soft_macros_position
(
self
,
coord_dict
):
"""
For sync-up with Google's plc_client after FD placer
"""
for
mod_idx
in
coord_dict
.
keys
():
self
.
modules_w_pins
[
mod_idx
]
.
set_pos
(
coord_dict
[
mod_idx
])
def
set_soft_macro_position
(
self
,
node_idx
,
x_pos
,
y_pos
):
"""
used for updating soft macro position
...
...
@@ -2688,7 +2709,7 @@ class PlacementCost(object):
def
main
():
test_netlist_dir
=
'./Plc_client/test/'
+
\
'ariane
13
3'
'ariane
_68_1.
3'
netlist_file
=
os
.
path
.
join
(
test_netlist_dir
,
'netlist.pb.txt'
)
plc
=
PlacementCost
(
netlist_file
)
...
...
CodeElements/Plc_client/plc_client_os_test.py
View file @
ccf490ad
...
...
@@ -44,8 +44,8 @@ Example:
--marv 51.790
\
--smooth 2
$ python3 -m Plc_client.plc_client_os_test --netlist ./Plc_client/test/ariane
13
3/netlist.pb.txt
\
--plc ./Plc_client/test/ariane
133
/initial.plc
\
$ python3 -m Plc_client.plc_client_os_test --netlist ./Plc_client/test/ariane
_68_1.
3/netlist.pb.txt
\
--plc ./Plc_client/test/ariane
_68_1.3/
/initial.plc
\
--width 1599
\
--height 1600.06
\
--col 24
\
...
...
@@ -347,7 +347,7 @@ class PlacementCostTest():
self
.
plc_os
.
set_placement_grid
(
self
.
GRID_COL
,
self
.
GRID_ROW
)
self
.
plc_os
.
display_canvas
()
self
.
unplace_node
()
self
.
plc_os
.
unplace_all_nodes
()
print
(
np
.
flip
(
np
.
array
(
self
.
plc_util
.
get_node_mask
(
0
))
.
reshape
(
35
,
33
),
axis
=
0
))
print
(
np
.
flip
(
np
.
array
(
self
.
plc
.
get_node_mask
(
0
))
.
reshape
(
35
,
33
),
axis
=
0
))
...
...
@@ -800,11 +800,11 @@ def main(args):
# PCT.test_proxy_cost()
# PCT.test_placement_util(keep_save_file=False)
# PCT.test_place_node()
PCT
.
test_miscellaneous
()
#
PCT.test_miscellaneous()
# PCT.test_observation_extractor()
# PCT.view_canvas()
# PCT.test_proxy_congestion()
#
PCT.test_environment()
PCT
.
test_environment
()
if
__name__
==
'__main__'
:
...
...
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