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
fd2bceab
Commit
fd2bceab
authored
Sep 20, 2022
by
sakundu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Proto buf netlist generation script.
parent
48c53522
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
324 additions
and
21 deletions
+324
-21
Flows/util/gen_pb.tcl
+27
-21
Flows/util/gen_pb_blockage.tcl
+297
-0
No files found.
Flows/util/gen_pb.tcl
View file @
fd2bceab
...
...
@@ -16,20 +16,16 @@ proc print_header { fp } {
set user
[
exec
whoami
]
set date
[
exec
date
]
set run_dir
[
exec
pwd
]
set
fp_box_ll
[
dbget top.fplan.box_ll
]
set
fp_box_ur
[
dbget top.fplan.box_ur
]
set
canvas_width
[
dbget top.fplan.coreBox_sizex
]
set
canvas_height
[
dbget top.fplan.coreBox_sizey
]
puts
$fp
"# User:
$user
"
puts
$fp
"# Date:
$date
"
puts
$fp
"# Run area:
$run
_dir"
puts
$fp
"# Block :
$design
"
puts
$fp
"# FP bbox:
$fp
_box_ll
$fp
_box_ur
"
puts
$fp
"# FP bbox:
{0.0 0.0} {
$canvas
_width
$canvas
_height}
"
## Add dummy Column and Row info ##
puts
$fp
"# Columns : 10 Rows : 10"
## Add blockage for core to die spacing ##
foreach box
[
dbShape -output rect
[
dbget top.fplan.box
]
XOR
[
dbget top.fplan.coreBox
]]
{
puts
$fp
"# Blockage :
$box
1"
}
}
#### Print helper ####
...
...
@@ -96,7 +92,7 @@ proc print_net { net_ptr fp } {
}
#### Procedure to write Ports ####
proc
write_node_port
{
port_ptr fp
}
{
proc
write_node_port
{
port_ptr fp
{
origin_x 0
}
{
origin_y 0
}
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${port_ptr}
.name
]
0
]
...
...
@@ -130,19 +126,27 @@ proc write_node_port { port_ptr fp } {
set X1
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 0
]
set X2
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 2
]
set X
[
expr
(
$X1 + $X2
)
/2
]
if
{
$side
==
"top"
||
$side
==
"bottom"
}
{
set X
[
expr
$X -
$origin
_x
]
}
print_float
$fp
"x"
$X
### Attribute: Y ###
set Y1
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 1
]
set Y2
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 3
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
]
if
{
$side
==
"left"
||
$side
==
"right"
}
{
set Y
[
expr
$Y -
$origin
_y
]
}
print_float
$fp
"y"
$Y
puts
$fp
"}"
}
#### Procedure to write Macros ####
proc
write_node_macro
{
macro_ptr fp
}
{
proc
write_node_macro
{
macro_ptr fp
{
origin_x 0
}
{
origin_y 0
}
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${macro_ptr}
.name
]
0
]
...
...
@@ -166,13 +170,13 @@ proc write_node_macro { macro_ptr fp } {
### Attribute: X ###
set X1
[
lindex
[
dbget
${macro_ptr}
.box
]
0 0
]
set X2
[
lindex
[
dbget
${macro_ptr}
.box
]
0 2
]
set X
[
expr
(
$X1 + $X2
)
/2
]
set X
[
expr
(
$X1 + $X2
)
/2
-
$origin
_x
]
print_float
$fp
"x"
$X
### Attribute: Y ###
set Y1
[
lindex
[
dbget
${macro_ptr}
.box
]
0 1
]
set Y2
[
lindex
[
dbget
${macro_ptr}
.box
]
0 3
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
-
$origin
_y
]
print_float
$fp
"y"
$Y
### Attribute: Y ###
...
...
@@ -184,7 +188,7 @@ proc write_node_macro { macro_ptr fp } {
}
#### Procedure to Write Macro Pins ####
proc
write_node_macro_pin
{
macro_pin_ptr fp
}
{
proc
write_node_macro_pin
{
macro_pin_ptr fp
{
origin_x 0
}
{
origin_y 0
}
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${macro_pin_ptr}
.name
]
0
]
...
...
@@ -203,8 +207,8 @@ proc write_node_macro_pin { macro_pin_ptr fp } {
### Attribute: type ###
print_placeholder
$fp
"type"
"macro_pin"
set X
[
dbget
${macro_pin_ptr}
.pt
_x
]
set Y
[
dbget
${macro_pin_ptr}
.pt
_y
]
set X
[
expr
[
dbget
${macro_pin_ptr}
.pt_x
]
-
$origin
_x
]
set Y
[
expr
[
dbget
${macro_pin_ptr}
.pt_y
]
-
$origin
_y
]
set cell_height
[
dbget
${macro_pin_ptr}
.cellTerm.cell.size_y
]
set cell_width
[
dbget
${macro_pin_ptr}
.cellTerm.cell.size_x
]
set pin_x
[
dbget
${macro_pin_ptr}
.cellTerm.pt_x
]
...
...
@@ -228,7 +232,7 @@ proc write_node_macro_pin { macro_pin_ptr fp } {
}
#### Procedure to Write Std-cell ###
proc
write_node_stdcell
{
inst_ptr fp
}
{
proc
write_node_stdcell
{
inst_ptr fp
{
origin_x 0
}
{
origin_y 0
}
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${inst_ptr}
.name
]
0
]
...
...
@@ -257,13 +261,13 @@ proc write_node_stdcell { inst_ptr fp } {
### Attribute: X ###
set X1
[
lindex
[
dbget
${inst_ptr}
.box
]
0 0
]
set X2
[
lindex
[
dbget
${inst_ptr}
.box
]
0 2
]
set X
[
expr
(
$X1 + $X2
)
/2
]
set X
[
expr
(
$X1 + $X2
)
/2
-
$origin
_x
]
print_float
$fp
"x"
$X
### Attribute: Y ###
set Y1
[
lindex
[
dbget
${inst_ptr}
.box
]
0 1
]
set Y2
[
lindex
[
dbget
${inst_ptr}
.box
]
0 3
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
-
$origin
_y
]
print_float
$fp
"y"
$Y
puts
$fp
"}"
...
...
@@ -276,20 +280,22 @@ proc gen_pb_netlist { } {
set fp
[
open
$out
_file w+
]
print_header
$fp
set origin_x
[
dbget top.fplan.coreBox_llx
]
set origin_y
[
dbget top.fplan.coreBox_lly
]
foreach port_ptr
[
dbget top.terms
]
{
write_node_port
$port
_ptr
$fp
write_node_port
$port
_ptr
$fp
$origin
_x
$origin
_y
}
foreach macro_ptr
[
dbget top.insts.cell.subClass block -p2
]
{
write_node_macro
$macro
_ptr
$fp
write_node_macro
$macro
_ptr
$fp
$origin
_x
$origin
_y
foreach macro_pin_ptr
[
dbget
${macro_ptr}
.instTerms
]
{
write_node_macro_pin
$macro
_pin_ptr
$fp
write_node_macro_pin
$macro
_pin_ptr
$fp
$origin
_x
$origin
_y
}
}
foreach inst_ptr
[
dbget top.insts.cell.subClass core -p2
]
{
write_node_stdcell
$inst
_ptr
$fp
write_node_stdcell
$inst
_ptr
$fp
$origin
_x
$origin
_y
}
close
$fp
...
...
Flows/util/gen_pb_blockage.tcl
0 → 100644
View file @
fd2bceab
#############################################################################
# This script was written and developed by ABKGroup students at UCSD.
# However, the underlying commands and reports are copyrighted by Cadence.
# We thank Cadence for granting permission to share our research to help
# promote and foster the next generation of innovators.
# Author: Sayak Kundu, ABKGroup, UCSD
#
# Usage: First source the script in Innovus shell. then use gen_pb_netlist
# command to write out the netlist. The protobuf netlist will be available
# as <design name>.pb.txt.
#############################################################################
#### Print the design header ####
proc
print_header
{
fp
}
{
set design
[
dbget top.name
]
set user
[
exec
whoami
]
set date
[
exec
date
]
set run_dir
[
exec
pwd
]
set fp_box_ll
[
dbget top.fplan.box_ll
]
set fp_box_ur
[
dbget top.fplan.box_ur
]
puts
$fp
"# User:
$user
"
puts
$fp
"# Date:
$date
"
puts
$fp
"# Run area:
$run
_dir"
puts
$fp
"# Block :
$design
"
puts
$fp
"# FP bbox:
$fp
_box_ll
$fp
_box_ur"
## Add dummy Column and Row info ##
puts
$fp
"# Columns : 10 Rows : 10"
## Add blockage for core to die spacing ##
foreach box
[
dbShape -output rect
[
dbget top.fplan.box
]
XOR
[
dbget top.fplan.coreBox
]]
{
puts
$fp
"# Blockage :
$box
1"
}
}
#### Print helper ####
proc
print_placeholder
{
fp key value
}
{
puts
$fp
" attr {"
puts
$fp
" key:
\"
$key
\"
"
puts
$fp
" value {"
puts
$fp
" placeholder:
\"
$value
\"
"
puts
$fp
" }"
puts
$fp
" }"
}
proc
print_float
{
fp key value
}
{
puts
$fp
" attr {"
puts
$fp
" key:
\"
$key
\"
"
puts
$fp
" value {"
puts
$fp
" f:
$value
"
puts
$fp
" }"
puts
$fp
" }"
}
### Helper to convert Orientation format ###
proc
get_orient
{
tmp_orient
}
{
set orient
"N"
if
{
$tmp
_orient ==
"R0"
}
{
set orient
"N"
}
else
if
{
$tmp
_orient ==
"R180"
}
{
set orient
"S"
}
else
if
{
$tmp
_orient ==
"R90"
}
{
set orient
"W"
}
else
if
{
$tmp
_orient ==
"R270"
}
{
set orient
"E"
}
else
if
{
$tmp
_orient ==
"MY"
}
{
set oreint
"FN"
}
else
if
{
$tmp
_orient ==
"MX"
}
{
set oreint
"FS"
}
else
if
{
$tmp
_orient ==
"MX90"
}
{
set orient
"FW"
}
else
if
{
$tmp
_orient ==
"MY90"
}
{
set orient
"FE"
}
return
$orient
}
#### Procedure to print the sinks ####
proc
print_net
{
net_ptr fp
}
{
### Print Terms ###
foreach term
[
dbget
[
dbget
${net_ptr}
.terms.isOutput 1 -p
]
.name -e
]
{
puts
$fp
" input:
\"
${term}
\"
"
}
### Print Macro Pins ###
foreach macro_pin
[
dbget
[
dbget
[
dbget
${net_ptr}
.instTerms.isInput 1 -p
\
]
.inst.cell.subClass block -p3
]
.name -e
]
{
puts
$fp
" input:
\"
${macro_pin}
\"
"
}
### Print Stdcells ###
foreach inst
[
dbget
[
dbget
[
dbget
${net_ptr}
.instTerms.isInput 1 -p
\
]
.inst.cell.subClass core -p2
]
.name -e
]
{
puts
$fp
" input:
\"
${inst}
\"
"
}
}
#### Procedure to write Ports ####
proc
write_node_port
{
port_ptr fp
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${port_ptr}
.name
]
0
]
puts
$fp
" name:
\"
${name}
\"
"
if
{
[
dbget
${port_ptr}
.isInput
]
== 1
}
{
set net_ptr
[
dbget
${port_ptr}
.net
]
print_net
$net
_ptr
$fp
}
### Attribute: type ###
print_placeholder
$fp
"type"
"port"
### Attribute: Side ###
set tmp_side
[
dbget
${port_ptr}
.side
]
set side
""
if
{
$tmp
_side ==
"West"
}
{
set side
"left"
}
else
if
{
$tmp
_side ==
"East"
}
{
set side
"right"
}
else
if
{
$tmp
_side ==
"North"
}
{
set side
"top"
}
else
if
{
$tmp
_side ==
"South"
}
{
set side
"bottom"
}
else
{
puts
"Error: Wrong Direction. Port Name:
$name
"
}
print_placeholder
$fp
"side"
$side
### Attribute: X ###
set X1
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 0
]
set X2
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 2
]
set X
[
expr
(
$X1 + $X2
)
/2
]
print_float
$fp
"x"
$X
### Attribute: Y ###
set Y1
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 1
]
set Y2
[
lindex
[
dbget
${port_ptr}
.pinShapes.rect
]
0 3
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
]
print_float
$fp
"y"
$Y
puts
$fp
"}"
}
#### Procedure to write Macros ####
proc
write_node_macro
{
macro_ptr fp
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${macro_ptr}
.name
]
0
]
puts
$fp
" name:
\"
${name}
\"
"
### Attribute: ref_name ###
set ref_name
[
dbget
${macro_ptr}
.cell.name
]
print_placeholder
$fp
"ref_name"
${ref_name}
### Attribute: Width ###
set width
[
dbget
${macro_ptr}
.box_sizex
]
print_float
$fp
"width"
$width
### Attribute: Height ###
set height
[
dbget
${macro_ptr}
.box_sizey
]
print_float
$fp
"height"
$height
### Attribute: type ###
print_placeholder
$fp
"type"
"macro"
### Attribute: X ###
set X1
[
lindex
[
dbget
${macro_ptr}
.box
]
0 0
]
set X2
[
lindex
[
dbget
${macro_ptr}
.box
]
0 2
]
set X
[
expr
(
$X1 + $X2
)
/2
]
print_float
$fp
"x"
$X
### Attribute: Y ###
set Y1
[
lindex
[
dbget
${macro_ptr}
.box
]
0 1
]
set Y2
[
lindex
[
dbget
${macro_ptr}
.box
]
0 3
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
]
print_float
$fp
"y"
$Y
### Attribute: Y ###
set tmp_orient
[
dbget
${macro_ptr}
.orient
]
set orient
[
get_orient
$tmp
_orient
]
print_placeholder
$fp
"orientation"
$orient
puts
$fp
"}"
}
#### Procedure to Write Macro Pins ####
proc
write_node_macro_pin
{
macro_pin_ptr fp
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${macro_pin_ptr}
.name
]
0
]
puts
$fp
" name:
\"
${name}
\"
"
### Print all the sinks ###
if
{
[
dbget
${macro_pin_ptr}
.isOutput
]
== 1
}
{
set net_ptr
[
dbget
${macro_pin_ptr}
.net
]
print_net
$net
_ptr
$fp
}
### Attribute: Macro Name ###
set macro_name
[
lindex
[
dbget
${macro_pin_ptr}
.inst.name
]
0
]
print_placeholder
$fp
"macro_name"
$macro
_name
### Attribute: type ###
print_placeholder
$fp
"type"
"macro_pin"
set X
[
dbget
${macro_pin_ptr}
.pt_x
]
set Y
[
dbget
${macro_pin_ptr}
.pt_y
]
set cell_height
[
dbget
${macro_pin_ptr}
.cellTerm.cell.size_y
]
set cell_width
[
dbget
${macro_pin_ptr}
.cellTerm.cell.size_x
]
set pin_x
[
dbget
${macro_pin_ptr}
.cellTerm.pt_x
]
set pin_y
[
dbget
${macro_pin_ptr}
.cellTerm.pt_y
]
set x_offset
[
expr
$pin
_x -
$cell
_width/2
]
set y_offset
[
expr
$pin
_y -
$cell
_height/2
]
### Attribute: x_offset ###
print_float
$fp
"x_offset"
$x
_offset
### Attribute: y_offset ###
print_float
$fp
"y_offset"
$y
_offset
### Attribute: X ###
print_float
$fp
"x"
$X
### Attribute: Y ###
print_float
$fp
"y"
$Y
puts
$fp
"}"
}
#### Procedure to Write Std-cell ###
proc
write_node_stdcell
{
inst_ptr fp
}
{
puts
$fp
"node {"
set name
[
lindex
[
dbget
${inst_ptr}
.name
]
0
]
puts
$fp
" name:
\"
${name}
\"
"
### Print all the sinks ###
foreach net_ptr
[
dbget
[
dbget
${inst_ptr}
.instTerms.isOutput 1 -p
]
.net -e
]
{
print_net
$net
_ptr
$fp
}
### Attribute: ref_name ###
set ref_name
[
dbget
${inst_ptr}
.cell.name
]
print_placeholder
$fp
"ref_name"
$ref
_name
### Attribute: Width ###
set width
[
dbget
${inst_ptr}
.box_sizex
]
print_float
$fp
"width"
$width
### Attribute: Height ###
set height
[
dbget
${inst_ptr}
.box_sizey
]
print_float
$fp
"height"
$height
### Attribute: type ###
print_placeholder
$fp
"type"
"stdcell"
### Attribute: X ###
set X1
[
lindex
[
dbget
${inst_ptr}
.box
]
0 0
]
set X2
[
lindex
[
dbget
${inst_ptr}
.box
]
0 2
]
set X
[
expr
(
$X1 + $X2
)
/2
]
print_float
$fp
"x"
$X
### Attribute: Y ###
set Y1
[
lindex
[
dbget
${inst_ptr}
.box
]
0 1
]
set Y2
[
lindex
[
dbget
${inst_ptr}
.box
]
0 3
]
set Y
[
expr
(
$Y1 + $Y2
)
/2
]
print_float
$fp
"y"
$Y
puts
$fp
"}"
}
#### Generate protobuff format netlist ####
proc
gen_pb_netlist
{
}
{
set design
[
dbget top.name
]
set out_file
"
${design}
.pb.txt"
set fp
[
open
$out
_file w+
]
print_header
$fp
foreach port_ptr
[
dbget top.terms
]
{
write_node_port
$port
_ptr
$fp
}
foreach macro_ptr
[
dbget top.insts.cell.subClass block -p2
]
{
write_node_macro
$macro
_ptr
$fp
foreach macro_pin_ptr
[
dbget
${macro_ptr}
.instTerms
]
{
write_node_macro_pin
$macro
_pin_ptr
$fp
}
}
foreach inst_ptr
[
dbget top.insts.cell.subClass core -p2
]
{
write_node_stdcell
$inst
_ptr
$fp
}
close
$fp
puts
"Output netlist:
$out
_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