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
a4637fb8
Commit
a4637fb8
authored
Oct 11, 2022
by
Dinple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates
parent
f6e8f5a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
39 deletions
+42
-39
.gitignore
+3
-2
CodeElements/Plc_client/plc_client_os.py
+29
-30
CodeElements/Plc_client/plc_client_os_test.py
+10
-7
No files found.
.gitignore
View file @
a4637fb8
...
...
@@ -9,4 +9,5 @@ CodeElements/Plc_client/plc_client_os.py
CodeElements/Plc_client/__pycache__/*
CodeElements/Plc_client/proto_reader.py
CodeElements/Plc_client/plc_client.py
CodeElements/Plc_client/failed_proxy_plc/*
\ No newline at end of file
CodeElements/failed_proxy_plc/*
CodeElements/CTModel/*
\ No newline at end of file
CodeElements/Plc_client/plc_client_os.py
View file @
a4637fb8
...
...
@@ -573,6 +573,7 @@ class PlacementCost(object):
mod_y
=
float
(
info_dict
[
'node_plc'
][
mod_idx
][
1
])
mod_orient
=
info_dict
[
'node_plc'
][
mod_idx
][
2
]
mod_ifFixed
=
int
(
info_dict
[
'node_plc'
][
mod_idx
][
3
])
except
Exception
as
e
:
print
(
'[ERROR PLC PARSER]
%
s'
%
str
(
e
))
...
...
@@ -710,7 +711,7 @@ class PlacementCost(object):
# Retrieve current pin node position
pin_node
=
self
.
modules_w_pins
[
pin_idx
]
pin_node_x_offset
,
pin_node_y_offset
=
pin_node
.
get_offset
()
# Google's Plc client DOES NOT compute (node_position + pin_offset) when reading input
return
(
ref_node_x
+
pin_node_x_offset
,
ref_node_y
+
pin_node_y_offset
)
def
get_wirelength
(
self
)
->
float
:
...
...
@@ -727,6 +728,9 @@ class PlacementCost(object):
x_coord
=
[]
y_coord
=
[]
# default value of weight
weight_fact
=
1.0
# NOTE: connection only defined on PORT, soft/hard macro pins
if
curr_type
==
"PORT"
and
mod
.
get_sink
():
# add source position
...
...
@@ -741,38 +745,46 @@ class PlacementCost(object):
sink
=
self
.
modules_w_pins
[
sink_idx
]
# only consider placed sink
ref_sink
=
self
.
modules_w_pins
[
self
.
get_ref_node_id
(
sink_idx
)]
# if not placed, skip this edge
if
not
ref_sink
.
get_placed_flag
():
continue
# retrieve location
x_coord
.
append
(
self
.
__get_pin_position
(
sink_idx
)[
0
])
y_coord
.
append
(
self
.
__get_pin_position
(
sink_idx
)[
1
])
x_coord
.
append
(
0
)
y_coord
.
append
(
0
)
else
:
# retrieve location
x_coord
.
append
(
self
.
__get_pin_position
(
sink_idx
)[
0
])
y_coord
.
append
(
self
.
__get_pin_position
(
sink_idx
)[
1
])
elif
curr_type
==
"MACRO_PIN"
:
ref_mod
=
self
.
modules_w_pins
[
self
.
get_ref_node_id
(
mod_idx
)]
# if not placed, skip this edge
if
not
ref_mod
.
get_placed_flag
():
continue
# get pin weight
weight_fact
=
mod
.
get_weight
()
# add source position
x_coord
.
append
(
self
.
__get_pin_position
(
mod_idx
)[
0
])
y_coord
.
append
(
self
.
__get_pin_position
(
mod_idx
)[
1
])
if
mod
.
get_sink
():
if
mod
.
get_weight
()
!=
0
:
norm_fact
=
mod
.
get_weight
()
for
input_list
in
mod
.
get_sink
()
.
values
():
for
sink_name
in
input_list
:
# retrieve indx in modules_w_pins
input_idx
=
self
.
mod_name_to_indices
[
sink_name
]
# retrieve location
x_coord
.
append
(
self
.
__get_pin_position
(
input_idx
)[
0
])
y_coord
.
append
(
self
.
__get_pin_position
(
input_idx
)[
1
])
sink_ref_mod
=
self
.
modules_w_pins
[
self
.
get_ref_node_id
(
mod_idx
)]
# if not placed, skip this edge
if
not
sink_ref_mod
.
get_placed_flag
():
x_coord
.
append
(
0
)
y_coord
.
append
(
0
)
else
:
# retrieve location
x_coord
.
append
(
self
.
__get_pin_position
(
input_idx
)[
0
])
y_coord
.
append
(
self
.
__get_pin_position
(
input_idx
)[
1
])
if
x_coord
:
if
norm_fact
!=
1.0
:
total_hpwl
+=
norm_fact
*
\
(
abs
(
max
(
x_coord
)
-
min
(
x_coord
))
+
\
abs
(
max
(
y_coord
)
-
min
(
y_coord
)))
else
:
total_hpwl
+=
(
abs
(
max
(
x_coord
)
-
min
(
x_coord
))
\
+
abs
(
max
(
y_coord
)
-
min
(
y_coord
)))
total_hpwl
+=
weight_fact
*
\
(
abs
(
max
(
x_coord
)
-
min
(
x_coord
))
+
\
abs
(
max
(
y_coord
)
-
min
(
y_coord
)))
return
total_hpwl
def
abu
(
self
,
xx
,
n
=
0.1
):
...
...
@@ -2735,19 +2747,6 @@ class PlacementCost(object):
def
get_type
(
self
):
return
"MACRO_PIN"
# TODO finish this
# class StandardCell:
# def __init__( self, name,
# x = 0.0, y = 0.0, weight = 1.0):
# self.name = name
# self.x = float(x)
# self.y = float(y)
# self.x_offset = 0.0 # not used
# self.y_offset = 0.0 # not used
# self.macro_name = macro_name
# self.weight = weight
# self.sink = {}
def
main
():
test_netlist_dir
=
'./Plc_client/test/'
+
\
'ariane_68_1.3'
...
...
CodeElements/Plc_client/plc_client_os_test.py
View file @
a4637fb8
...
...
@@ -430,12 +430,15 @@ class PlacementCostTest():
str
(
self
.
plc
.
get_cost
()),
self
.
plc_os
.
get_cost
()))
# if remove all soft macros
# soft_macro_indices = [
# m for m in self.plc.get_macro_indices() if self.plc.is_node_soft_macro(m)
# ]
# for mod_idx in soft_macro_indices:
# self.plc_os.unplace_node(mod_idx)
# self.plc.unplace_node(mod_idx)
soft_macro_indices
=
[
m
for
m
in
self
.
plc
.
get_macro_indices
()
if
self
.
plc
.
is_node_soft_macro
(
m
)
]
for
mod_idx
in
soft_macro_indices
:
self
.
plc_os
.
unplace_node
(
mod_idx
)
self
.
plc
.
unplace_node
(
mod_idx
)
print
(
"GL WIRELENGTH: "
,
self
.
plc
.
get_wirelength
())
print
(
"OS WIRELENGTH: "
,
self
.
plc_os
.
get_wirelength
())
print
(
"GL WIRELENGTH: "
,
self
.
plc
.
get_wirelength
())
print
(
"OS WIRELENGTH: "
,
self
.
plc_os
.
get_wirelength
())
...
...
@@ -985,7 +988,7 @@ def main(args):
# PCT.test_place_node()
# PCT.test_miscellaneous()
# PCT.test_observation_extractor()
PCT
.
view_canvas
()
#
PCT.view_canvas()
# PCT.test_environment()
...
...
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