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
d690cd79
Commit
d690cd79
authored
Aug 15, 2022
by
Dinple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial cluster port adj
parent
8d03aea7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
35 deletions
+85
-35
CodeElements/Plc_client/plc_client_os.py
+56
-14
CodeElements/Plc_client/plc_client_os_test.py
+29
-21
No files found.
CodeElements/Plc_client/plc_client_os.py
View file @
d690cd79
...
...
@@ -676,7 +676,7 @@ class PlacementCost(object):
def
get_macro_adjacency
(
self
)
->
list
:
"""
Compute Adjacency Matrix
(Unclustered PORTs)
Compute Adjacency Matrix
"""
# NOTE: in pb.txt, netlist input count exceed certain threshold will be ommitted
#[MACRO][macro]
...
...
@@ -745,12 +745,8 @@ class PlacementCost(object):
"""
Compute Adjacency Matrix (Unclustered PORTs)
"""
# NOTE: in pb.txt, netlist input count exceed certain threshold will be ommitted
macro_adj
=
[
0
]
*
self
.
module_cnt
*
self
.
module_cnt
assert
len
(
macro_adj
)
==
self
.
module_cnt
*
self
.
module_cnt
#[MACRO][macro][PORT]
module_indices
=
self
.
hard_macro_indices
+
self
.
soft_macro_indices
+
self
.
port_indices
module_indices
=
self
.
hard_macro_indices
+
self
.
soft_macro_indices
#[Grid Cell] => [PORT]
clustered_ports
=
{}
...
...
@@ -764,8 +760,61 @@ class PlacementCost(object):
clustered_ports
[(
row
,
col
)]
.
append
(
port
)
else
:
clustered_ports
[(
row
,
col
)]
=
[
port
]
# NOTE: in pb.txt, netlist input count exceed certain threshold will be ommitted
macro_adj
=
[
0
]
*
(
len
(
module_indices
)
+
len
(
clustered_ports
))
*
(
len
(
module_indices
)
+
len
(
clustered_ports
))
# instantiate macros
for
row_idx
,
module_idx
in
enumerate
(
module_indices
):
# row index
# store temp module
curr_module
=
self
.
modules_w_pins
[
module_idx
]
# get module name
curr_module_name
=
curr_module
.
get_name
()
for
col_idx
,
h_module_idx
in
enumerate
(
module_indices
):
# col index
entry
=
0
# store connected module
h_module
=
self
.
modules_w_pins
[
h_module_idx
]
# get connected module name
h_module_name
=
h_module
.
get_name
()
if
curr_module_name
in
h_module
.
get_connection
():
entry
+=
h_module
.
get_connection
()[
curr_module_name
]
return
clustered_ports
if
h_module_name
in
curr_module
.
get_connection
():
entry
+=
curr_module
.
get_connection
()[
h_module_name
]
macro_adj
[
row_idx
*
(
self
.
hard_macro_cnt
+
self
.
soft_macro_cnt
)
+
col_idx
]
=
entry
macro_adj
[
col_idx
*
(
self
.
hard_macro_cnt
+
self
.
soft_macro_cnt
)
+
row_idx
]
=
entry
# instantiate clustered ports
for
cluster_idx
,
cluster_cell
in
enumerate
(
clustered_ports
):
for
port
in
clustered_ports
[
cluster_cell
]:
# get module name
curr_port_name
=
port
.
get_name
()
# assuming ports only connects to macros
for
col_idx
,
h_module_idx
in
enumerate
(
module_indices
):
# col index
entry
=
0
# store connected module
h_module
=
self
.
modules_w_pins
[
h_module_idx
]
# get connected module name
h_module_name
=
h_module
.
get_name
()
if
curr_module_name
in
h_module
.
get_connection
():
entry
+=
h_module
.
get_connection
()[
curr_port_name
]
if
h_module_name
in
curr_module
.
get_connection
():
entry
+=
curr_module
.
get_connection
()[
h_module_name
]
macro_adj
[
row_idx
*
(
self
.
hard_macro_cnt
+
self
.
soft_macro_cnt
+
cluster_idx
)
+
col_idx
]
=
entry
macro_adj
[
col_idx
*
(
self
.
hard_macro_cnt
+
self
.
soft_macro_cnt
+
cluster_idx
)
+
row_idx
]
=
entry
return
macro_adj
def
get_node_location
(
self
):
pass
...
...
@@ -1183,12 +1232,5 @@ def main():
print
(
plc
.
get_grid_cells_density
())
print
(
plc
.
get_density_cost
())
temppins
=
plc
.
soft_macros_to_inpins
[
plc
.
modules_w_pins
[
plc
.
soft_macro_indices
[
0
]]
.
get_name
()]
print
(
plc
.
modules_w_pins
[
plc
.
mod_name_to_indices
[
temppins
[
17
]]]
.
get_name
())
print
(
plc
.
modules_w_pins
[
plc
.
mod_name_to_indices
[
temppins
[
17
]]]
.
get_sink
())
print
(
plc
.
modules_w_pins
[
plc
.
soft_macro_indices
[
54
]]
.
get_name
())
temppins2
=
plc
.
soft_macros_to_inpins
[
plc
.
modules_w_pins
[
plc
.
soft_macro_indices
[
54
]]
.
get_name
()]
if
__name__
==
'__main__'
:
main
()
CodeElements/Plc_client/plc_client_os_test.py
View file @
d690cd79
...
...
@@ -16,6 +16,24 @@ class CircuitDataBaseTest():
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
CANVAS_HEIGHT
=
356.640
GRID_COL
=
35
GRID_ROW
=
33
# Ariane133
# CANVAS_WIDTH = 1599.99
# CANVAS_HEIGHT = 1598.8
# GRID_COL = 50
# GRID_ROW = 50
# Sample clustered
# CANVAS_WIDTH = 80
# CANVAS_HEIGHT = 80
# GRID_COL = 5
# GRID_ROW = 5
def
test_proxy_cost
(
self
):
# Google's Binary Executable
self
.
plc
=
plc_client
.
PlacementCost
(
self
.
NETLIST_PATH
)
...
...
@@ -24,28 +42,11 @@ class CircuitDataBaseTest():
self
.
plc_os
=
plc_client_os
.
PlacementCost
(
netlist_file
=
self
.
NETLIST_PATH
,
macro_macro_x_spacing
=
50
,
macro_macro_y_spacing
=
50
)
# Google's Ariane
CANVAS_WIDTH
=
356.592
CANVAS_HEIGHT
=
356.640
GRID_COL
=
35
GRID_ROW
=
33
# Ariane133
# CANVAS_WIDTH = 1599.99
# CANVAS_HEIGHT = 1598.8
# GRID_COL = 50
# GRID_ROW = 50
# Sample clustered
# CANVAS_WIDTH = 80
# CANVAS_HEIGHT = 80
# GRID_COL = 5
# GRID_ROW = 5
self
.
plc
.
set_canvas_size
(
CANVAS_WIDTH
,
CANVAS_HEIGHT
)
self
.
plc
.
set_placement_grid
(
GRID_COL
,
GRID_ROW
)
self
.
plc_os
.
set_canvas_size
(
CANVAS_WIDTH
,
CANVAS_HEIGHT
)
self
.
plc_os
.
set_placement_grid
(
GRID_COL
,
GRID_ROW
)
self
.
plc
.
set_canvas_size
(
self
.
CANVAS_WIDTH
,
self
.
CANVAS_HEIGHT
)
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
)
assert
int
(
self
.
plc_os
.
get_wirelength
())
==
int
(
self
.
plc
.
get_wirelength
())
assert
int
(
sum
(
self
.
plc_os
.
get_grid_cells_density
()))
==
int
(
sum
(
self
.
plc
.
get_grid_cells_density
()))
...
...
@@ -58,7 +59,13 @@ class CircuitDataBaseTest():
self
.
plc_os
=
plc_client_os
.
PlacementCost
(
netlist_file
=
self
.
NETLIST_PATH
,
macro_macro_x_spacing
=
50
,
macro_macro_y_spacing
=
50
)
self
.
plc
.
set_canvas_size
(
self
.
CANVAS_WIDTH
,
self
.
CANVAS_HEIGHT
)
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
)
self
.
plc_os
.
get_grid_cells_density
()
assert
int
(
self
.
plc_os
.
get_area
())
==
int
(
self
.
plc
.
get_area
())
...
...
@@ -79,6 +86,7 @@ class CircuitDataBaseTest():
assert
self
.
plc
.
get_macro_routing_allocation
()
==
self
.
plc_os
.
get_macro_routing_allocation
()
assert
sum
(
self
.
plc
.
get_macro_adjacency
())
==
sum
(
self
.
plc_os
.
get_macro_adjacency
())
assert
sum
(
self
.
plc
.
get_macro_and_clustered_port_adjacency
()[
0
])
==
sum
(
self
.
plc_os
.
get_macro_and_clustered_port_adjacency
())
def
test_miscellaneous
(
self
):
# Google's Binary Executable
...
...
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