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
3b45177e
Commit
3b45177e
authored
Aug 22, 2022
by
Dinple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MACRO weight
parent
0173d080
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
15 deletions
+29
-15
CodeElements/Plc_client/plc_client_os.py
+29
-15
No files found.
CodeElements/Plc_client/plc_client_os.py
View file @
3b45177e
...
@@ -354,7 +354,8 @@ class PlacementCost(object):
...
@@ -354,7 +354,8 @@ class PlacementCost(object):
if
inputs
:
if
inputs
:
for
k
in
inputs
.
keys
():
for
k
in
inputs
.
keys
():
if
macro_type
==
"MACRO"
:
if
macro_type
==
"MACRO"
:
macro
.
add_connections
(
inputs
[
k
])
weight
=
pin
.
get_weight
()
macro
.
add_connections
(
inputs
[
k
],
weight
)
elif
macro_type
==
"macro"
:
elif
macro_type
==
"macro"
:
weight
=
pin
.
get_weight
()
weight
=
pin
.
get_weight
()
macro
.
add_connections
(
inputs
[
k
],
weight
)
macro
.
add_connections
(
inputs
[
k
],
weight
)
...
@@ -889,10 +890,21 @@ class PlacementCost(object):
...
@@ -889,10 +890,21 @@ class PlacementCost(object):
def
save_placement
(
self
):
def
save_placement
(
self
):
pass
pass
def
display_canvas
(
self
,
annotate
=
True
):
def
display_canvas
(
self
,
annotate
=
True
,
amplify
=
False
):
#define Matplotlib figure and axis
#define Matplotlib figure and axis
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
8
,
8
),
dpi
=
50
)
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
8
,
8
),
dpi
=
50
)
if
amplify
:
PORT_SIZE
=
4
FONT_SIZE
=
10
PIN_SIZE
=
4
else
:
PORT_SIZE
=
2
FONT_SIZE
=
5
PIN_SIZE
=
2
# Plt config
# Plt config
ax
.
margins
(
x
=
0.05
,
y
=
0.05
)
ax
.
margins
(
x
=
0.05
,
y
=
0.05
)
ax
.
set_aspect
(
'equal'
,
adjustable
=
'box'
)
ax
.
set_aspect
(
'equal'
,
adjustable
=
'box'
)
...
@@ -907,21 +919,21 @@ class PlacementCost(object):
...
@@ -907,21 +919,21 @@ class PlacementCost(object):
# Construct module blocks
# Construct module blocks
for
mod
in
self
.
modules_w_pins
:
for
mod
in
self
.
modules_w_pins
:
if
mod
.
get_type
()
==
'PORT'
:
if
mod
.
get_type
()
==
'PORT'
:
plt
.
plot
(
*
mod
.
get_pos
(),
'ro'
,
markersize
=
4
)
plt
.
plot
(
*
mod
.
get_pos
(),
'ro'
,
markersize
=
PORT_SIZE
)
elif
mod
.
get_type
()
==
'MACRO'
:
elif
mod
.
get_type
()
==
'MACRO'
:
ax
.
add_patch
(
Rectangle
((
mod
.
get_pos
()[
0
]
-
mod
.
get_width
()
/
2
,
mod
.
get_pos
()[
1
]
-
mod
.
get_height
()
/
2
),
\
ax
.
add_patch
(
Rectangle
((
mod
.
get_pos
()[
0
]
-
mod
.
get_width
()
/
2
,
mod
.
get_pos
()[
1
]
-
mod
.
get_height
()
/
2
),
\
mod
.
get_width
(),
mod
.
get_height
(),
\
mod
.
get_width
(),
mod
.
get_height
(),
\
alpha
=
0.5
,
zorder
=
1000
,
facecolor
=
'b'
,
edgecolor
=
'darkblue'
))
alpha
=
0.5
,
zorder
=
1000
,
facecolor
=
'b'
,
edgecolor
=
'darkblue'
))
if
annotate
:
if
annotate
:
ax
.
annotate
(
mod
.
get_name
(),
mod
.
get_pos
(),
color
=
'r'
,
weight
=
'bold'
,
fontsize
=
7
,
ha
=
'center'
,
va
=
'center'
)
ax
.
annotate
(
mod
.
get_name
(),
mod
.
get_pos
(),
color
=
'r'
,
weight
=
'bold'
,
fontsize
=
FONT_SIZE
,
ha
=
'center'
,
va
=
'center'
)
elif
mod
.
get_type
()
==
'MACRO_PIN'
:
elif
mod
.
get_type
()
==
'MACRO_PIN'
:
plt
.
plot
(
*
mod
.
get_pos
(),
'bo'
,
markersize
=
1
)
plt
.
plot
(
*
mod
.
get_pos
(),
'bo'
,
markersize
=
PIN_SIZE
)
elif
mod
.
get_type
()
==
'macro'
:
elif
mod
.
get_type
()
==
'macro'
:
ax
.
add_patch
(
Rectangle
((
mod
.
get_pos
()[
0
]
-
mod
.
get_width
()
/
2
,
mod
.
get_pos
()[
1
]
-
mod
.
get_height
()
/
2
),
\
ax
.
add_patch
(
Rectangle
((
mod
.
get_pos
()[
0
]
-
mod
.
get_width
()
/
2
,
mod
.
get_pos
()[
1
]
-
mod
.
get_height
()
/
2
),
\
mod
.
get_width
(),
mod
.
get_height
(),
\
mod
.
get_width
(),
mod
.
get_height
(),
\
alpha
=
0.5
,
zorder
=
1000
,
facecolor
=
'y'
))
alpha
=
0.5
,
zorder
=
1000
,
facecolor
=
'y'
))
if
annotate
:
if
annotate
:
ax
.
annotate
(
mod
.
get_name
(),
mod
.
get_pos
(),
wrap
=
True
,
color
=
'r'
,
weight
=
'bold'
,
fontsize
=
7
,
ha
=
'center'
,
va
=
'center'
)
ax
.
annotate
(
mod
.
get_name
(),
mod
.
get_pos
(),
wrap
=
True
,
color
=
'r'
,
weight
=
'bold'
,
fontsize
=
FONT_SIZE
,
ha
=
'center'
,
va
=
'center'
)
plt
.
show
()
plt
.
show
()
plt
.
close
(
'all'
)
plt
.
close
(
'all'
)
...
@@ -1063,8 +1075,9 @@ class PlacementCost(object):
...
@@ -1063,8 +1075,9 @@ class PlacementCost(object):
return
self
.
width
return
self
.
width
class
SoftMacroPin
:
class
SoftMacroPin
:
def
__init__
(
self
,
name
,
def
__init__
(
self
,
name
,
x
=
0.0
,
y
=
0.0
,
macro_name
=
""
,
weight
=
1.0
):
x
=
0.0
,
y
=
0.0
,
macro_name
=
""
,
weight
=
1.0
):
self
.
name
=
name
self
.
name
=
name
self
.
x
=
float
(
x
)
self
.
x
=
float
(
x
)
self
.
y
=
float
(
y
)
self
.
y
=
float
(
y
)
...
@@ -1139,7 +1152,7 @@ class PlacementCost(object):
...
@@ -1139,7 +1152,7 @@ class PlacementCost(object):
def
get_name
(
self
):
def
get_name
(
self
):
return
self
.
name
return
self
.
name
def
add_connection
(
self
,
module_name
):
def
add_connection
(
self
,
module_name
,
weight
):
# NOTE: assume PORT names does not contain slash
# NOTE: assume PORT names does not contain slash
ifPORT
=
False
ifPORT
=
False
module_name_splited
=
module_name
.
rsplit
(
'/'
,
1
)
module_name_splited
=
module_name
.
rsplit
(
'/'
,
1
)
...
@@ -1148,18 +1161,19 @@ class PlacementCost(object):
...
@@ -1148,18 +1161,19 @@ class PlacementCost(object):
if
ifPORT
:
if
ifPORT
:
# adding PORT
# adding PORT
self
.
connection
[
module_name
]
=
1
self
.
connection
[
module_name
]
=
1
*
weight
else
:
else
:
# adding soft/hard macros
# adding soft/hard macros
if
module_name_splited
[
0
]
in
self
.
connection
.
keys
():
if
module_name_splited
[
0
]
in
self
.
connection
.
keys
():
self
.
connection
[
module_name_splited
[
0
]]
+=
1
self
.
connection
[
module_name_splited
[
0
]]
+=
1
*
weight
else
:
else
:
self
.
connection
[
module_name_splited
[
0
]]
=
1
self
.
connection
[
module_name_splited
[
0
]]
=
1
*
weight
def
add_connections
(
self
,
module_names
):
def
add_connections
(
self
,
module_names
,
weight
):
# NOTE: assume PORT names does not contain slash
# NOTE: assume PORT names does not contain slash
# consider weight on soft macro pins
for
module_name
in
module_names
:
for
module_name
in
module_names
:
self
.
add_connection
(
module_name
)
self
.
add_connection
(
module_name
,
weight
)
def
get_connection
(
self
):
def
get_connection
(
self
):
return
self
.
connection
return
self
.
connection
...
@@ -1190,7 +1204,7 @@ class PlacementCost(object):
...
@@ -1190,7 +1204,7 @@ class PlacementCost(object):
def
__init__
(
self
,
name
,
def
__init__
(
self
,
name
,
x
=
0.0
,
y
=
0.0
,
x
=
0.0
,
y
=
0.0
,
x_offset
=
0.0
,
y_offset
=
0.0
,
x_offset
=
0.0
,
y_offset
=
0.0
,
macro_name
=
""
,
weight
=
0
.0
):
macro_name
=
""
,
weight
=
1
.0
):
self
.
name
=
name
self
.
name
=
name
self
.
x
=
float
(
x
)
self
.
x
=
float
(
x
)
self
.
y
=
float
(
y
)
self
.
y
=
float
(
y
)
...
...
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