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
8988a64b
Commit
8988a64b
authored
Aug 17, 2022
by
Dinple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_cost() implementation done
parent
802f5eb7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
23 deletions
+124
-23
CodeElements/Plc_client/plc_client_os.py
+24
-5
CodeElements/Plc_client/plc_client_os_test.py
+16
-15
CodeElements/Plc_client/test/sample_clustered_uniform_two_soft/netlist.pb.txt
+84
-3
No files found.
CodeElements/Plc_client/plc_client_os.py
View file @
8988a64b
...
...
@@ -42,6 +42,9 @@ class PlacementCost(object):
self
.
hrouting_alloc
=
0.0
self
.
vrouting_alloc
=
0.0
# net information
self
.
net_cnt
=
0
# All modules look-up table
self
.
modules
=
[]
self
.
modules_w_pins
=
[]
...
...
@@ -194,11 +197,16 @@ class PlacementCost(object):
x
=
attr_dict
[
'x'
][
1
],
y
=
attr_dict
[
'y'
][
1
],
macro_name
=
attr_dict
[
'macro_name'
][
1
])
if
'weight'
in
attr_dict
.
keys
():
soft_macro_pin
.
set_weight
(
float
(
attr_dict
[
'weight'
][
1
]))
if
input_list
:
if
'weight'
in
attr_dict
.
keys
():
self
.
net_cnt
+=
1
*
float
(
attr_dict
[
'weight'
][
1
])
else
:
self
.
net_cnt
+=
1
soft_macro_pin
.
add_sinks
(
input_list
)
if
'weight'
in
attr_dict
.
keys
():
soft_macro_pin
.
set_weight
(
float
(
attr_dict
[
'weight'
][
1
]))
self
.
modules_w_pins
.
append
(
soft_macro_pin
)
# mapping node_name ==> node idx
...
...
@@ -247,6 +255,7 @@ class PlacementCost(object):
hard_macro_pin
.
set_weight
(
float
(
attr_dict
[
'weight'
][
1
]))
if
input_list
:
self
.
net_cnt
+=
1
hard_macro_pin
.
add_sinks
(
input_list
)
self
.
modules_w_pins
.
append
(
hard_macro_pin
)
...
...
@@ -273,7 +282,9 @@ class PlacementCost(object):
side
=
attr_dict
[
'side'
][
1
])
if
input_list
:
self
.
net_cnt
+=
1
port
.
add_sinks
(
input_list
)
# ports does not have pins so update connection immediately
port
.
add_connections
(
input_list
)
self
.
modules_w_pins
.
append
(
port
)
...
...
@@ -350,8 +361,17 @@ class PlacementCost(object):
"""
Compute wirelength cost from wirelength
"""
return
0.0
# temp_net_cnt = math.floor(self.net_cnt * 0.15)
# if temp_net_cnt == 0:
# temp_net_cnt = 1
# unknown_threshold = 100
# if self.net_cnt <= unknown_threshold:
# return self.get_wirelength() / ((self.get_canvas_width_height()[0] + self.get_canvas_width_height()[1]) * temp_net_cnt)
# else:
return
self
.
get_wirelength
()
/
((
self
.
get_canvas_width_height
()[
0
]
+
self
.
get_canvas_width_height
()[
1
])
*
self
.
net_cnt
)
def
get_area
(
self
)
->
float
:
"""
...
...
@@ -431,7 +451,6 @@ class PlacementCost(object):
else
:
total_hpwl
+=
(
abs
(
max
(
x_coord
)
-
min
(
x_coord
))
\
+
abs
(
max
(
y_coord
)
-
min
(
y_coord
)))
return
total_hpwl
def
get_congestion_cost
(
self
)
->
float
:
...
...
CodeElements/Plc_client/plc_client_os_test.py
View file @
8988a64b
...
...
@@ -14,8 +14,8 @@ class CircuitDataBaseTest():
# NETLIST_PATH = "./Plc_client/test/ariane_port2soft/netlist.pb.txt"
# NETLIST_PATH = "./Plc_client/test/sample_clustered_nomacro/netlist.pb.txt"
# NETLIST_PATH = "./Plc_client/test/sample_clustered_macroxy/netlist.pb.txt"
NETLIST_PATH
=
"./Plc_client/test/ariane/netlist.pb.txt"
#
NETLIST_PATH = "./Plc_client/test/ariane133/netlist.pb.txt"
#
NETLIST_PATH = "./Plc_client/test/ariane/netlist.pb.txt"
NETLIST_PATH
=
"./Plc_client/test/ariane133/netlist.pb.txt"
# Google's Ariane
# CANVAS_WIDTH = 356.592
...
...
@@ -24,16 +24,16 @@ class CircuitDataBaseTest():
# GRID_ROW = 33
# Ariane133
#
CANVAS_WIDTH = 1599.99
#
CANVAS_HEIGHT = 1598.8
#
GRID_COL = 50
#
GRID_ROW = 50
CANVAS_WIDTH
=
1599.99
CANVAS_HEIGHT
=
1598.8
GRID_COL
=
50
GRID_ROW
=
50
# Sample clustered
CANVAS_WIDTH
=
500
CANVAS_HEIGHT
=
500
GRID_COL
=
5
GRID_ROW
=
5
#
CANVAS_WIDTH = 500
#
CANVAS_HEIGHT = 500
# GRID_COL = 4
# GRID_ROW = 4
def
test_proxy_cost
(
self
):
# Google's Binary Executable
...
...
@@ -48,16 +48,17 @@ class CircuitDataBaseTest():
self
.
plc
.
set_placement_grid
(
self
.
GRID_COL
,
self
.
GRID_ROW
)
self
.
plc_os
.
set_canvas_size
(
self
.
CANVAS_WIDTH
,
self
.
CANVAS_HEIGHT
)
self
.
plc_os
.
set_placement_grid
(
self
.
GRID_COL
,
self
.
GRID_ROW
)
print
(
self
.
plc_os
.
display_canvas
())
#
print(self.plc_os.display_canvas())
print
(
self
.
plc_os
.
get_wirelength
(),
self
.
plc
.
get_wirelength
())
assert
int
(
self
.
plc_os
.
get_wirelength
())
==
int
(
self
.
plc
.
get_wirelength
())
print
(
"os wl cost"
,
self
.
plc_os
.
get_cost
())
print
(
"gl wl cost"
,
self
.
plc
.
get_cost
())
assert
abs
(
self
.
plc
.
get_cost
()
-
self
.
plc_os
.
get_cost
())
<=
10e-3
assert
int
(
sum
(
self
.
plc_os
.
get_grid_cells_density
()))
==
int
(
sum
(
self
.
plc
.
get_grid_cells_density
()))
assert
int
(
self
.
plc_os
.
get_density_cost
())
==
int
(
self
.
plc
.
get_density_cost
())
print
(
"os density"
,
self
.
plc_os
.
get_density_cost
())
print
(
"gl density"
,
self
.
plc
.
get_density_cost
())
print
(
"wirelength cost"
,
self
.
plc
.
get_wirelength
(),
self
.
plc
.
get_cost
())
print
(
"os density cost"
,
self
.
plc_os
.
get_density_cost
())
print
(
"gl density cost"
,
self
.
plc
.
get_density_cost
())
def
test_metadata
(
self
):
# Google's Binary Executable
...
...
CodeElements/Plc_client/test/sample_clustered_uniform_two_soft/netlist.pb.txt
View file @
8988a64b
...
...
@@ -68,6 +68,7 @@ node {
}
node {
name: "Grp_2/Poutput_single_0"
input: "Grp_3/Pinput"
attr {
key: "macro_name"
value {
...
...
@@ -83,7 +84,7 @@ node {
attr {
key: "x"
value {
f:
20
f:
4
}
}
attr {
...
...
@@ -95,7 +96,7 @@ node {
attr {
key: "y"
value {
f: 4
5
f: 4
}
}
attr {
...
...
@@ -122,6 +123,46 @@ node {
attr {
key: "x"
value {
f: 4
}
}
attr {
key: "x_offset"
value {
f: 0
}
}
attr {
key: "y"
value {
f: 4
}
}
attr {
key: "y_offset"
value {
f: 0
}
}
}
node {
name: "Grp_3/Poutput_single_0"
input: "Grp_2/Pinput"
attr {
key: "macro_name"
value {
placeholder: "Grp_3"
}
}
attr {
key: "type"
value {
placeholder: "macro_pin"
}
}
attr {
key: "x"
value {
f: 20
}
}
...
...
@@ -134,7 +175,7 @@ node {
attr {
key: "y"
value {
f:
45
f:
20
}
}
attr {
...
...
@@ -144,3 +185,42 @@ node {
}
}
}
node {
name: "Grp_3/Pinput"
attr {
key: "macro_name"
value {
placeholder: "Grp_3"
}
}
attr {
key: "type"
value {
placeholder: "macro_pin"
}
}
attr {
key: "x"
value {
f: 20
}
}
attr {
key: "x_offset"
value {
f: 0
}
}
attr {
key: "y"
value {
f: 20
}
}
attr {
key: "y_offset"
value {
f: 0
}
}
}
\ No newline at end of file
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