Skip to content

Commit 77ee5e2

Browse files
committed
Add - io.tcl preplacement
Signed-off-by: louiic <[email protected]>
1 parent e2afd83 commit 77ee5e2

File tree

1 file changed

+105
-0
lines changed
  • flow/designs/asap7/megaboom

1 file changed

+105
-0
lines changed

flow/designs/asap7/megaboom/io.tcl

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
proc natural_sort {list} {
2+
return [lsort -command natural_compare $list]
3+
}
4+
# Custom comparison function
5+
proc natural_compare {str1 str2} {
6+
set list1 [split $str1]
7+
set list2 [split $str2]
8+
set len [expr {min([llength $list1], [llength $list2])}]
9+
for {set i 0} {$i < $len} {incr i} {
10+
set part1 [lindex $list1 $i]
11+
set part2 [lindex $list2 $i]
12+
if {$part1 ne $part2} {
13+
if {[string is integer -strict $part1] && [string is integer -strict $part2]} {
14+
return [expr {$part1 - $part2}]
15+
} else {
16+
return [string compare $part1 $part2]
17+
}
18+
}
19+
}
20+
return [expr {[llength $list1] - [llength $list2]}] ;# If all parts are equal, compare by length
21+
}
22+
23+
24+
proc match_pins { regex } {
25+
set pins {}
26+
# The regex for get_ports is not the tcl regex
27+
foreach pin [get_ports -regex .*] {
28+
set input [get_property $pin name]
29+
# We want the Tcl regex
30+
if {![regexp $regex $input]} {
31+
continue
32+
}
33+
lappend pins [get_property $pin name]
34+
}
35+
return [natural_sort $pins]
36+
}
37+
38+
set block [ord::get_db_block]
39+
40+
set m4pitch 0.048
41+
set m5pitch 0.048
42+
43+
array set pinGroups [list]
44+
set pinGroups(top) [ list \
45+
"pitch $m5pitch" \
46+
"start 500" \
47+
"io_debug_req" \
48+
"io_debug_resp" \
49+
"io_interrupts" \
50+
]
51+
52+
set pinGroups(left) [ list \
53+
"pitch $m4pitch" \
54+
"start 200" \
55+
"io_l2_axi4_0_ar" \
56+
"io_l2_axi4_0_aw" \
57+
"io_l2_axi4_0_b" \
58+
"io_l2_axi4_0_r" \
59+
"io_l2_axi4_0_w" \
60+
]
61+
62+
set pinGroups(right) [ list \
63+
"pitch $m4pitch" \
64+
"start 200" \
65+
"io_mem_axi4_0_ar" \
66+
"io_mem_axi4_0_aw" \
67+
"io_mem_axi4_0_b" \
68+
"io_mem_axi4_0_r" \
69+
"io_mem_axi4_0_w" \
70+
"break 50" \
71+
"io_mmio_axi4_0_ar" \
72+
"io_mmio_axi4_0_aw" \
73+
"io_mmio_axi4_0_b" \
74+
"io_mmio_axi4_0_r" \
75+
"io_mmio_axi4_0_w" \
76+
]
77+
78+
79+
foreach side [array names pinGroups] {
80+
set pStart 0
81+
set pStop 0
82+
set pitch 0
83+
foreach ex $pinGroups($side) {
84+
if { [regexp {pitch (\S+)} $ex - number] } {
85+
set pitch $number
86+
continue
87+
}
88+
if { [regexp {start (\d+)} $ex - number] } {
89+
set pStart $number
90+
set pStop $number
91+
continue
92+
}
93+
if { [regexp {break (\d+)} $ex - number] } {
94+
set pStart [expr $pStart + $number]
95+
continue
96+
}
97+
#set pins [concat {*}[match_pins ${ex}.*]]
98+
set pins [match_pins ${ex}.*]
99+
set pStop [expr $pStart + (($pitch * 8) * [llength $pins])]
100+
set_io_pin_constraint -region ${side}:${pStart}-${pStop} -pin_names $pins
101+
set pStart [expr $pStop + ($pitch * 20)]
102+
}
103+
}
104+
105+
#place_pins -hor_layer M4 -ver_layer M5

0 commit comments

Comments
 (0)