Skip to content

Commit 94f671d

Browse files
authored
Merge pull request #3348 from verilog-to-routing/remove_3d_attr
Removing 3D Attributes Script
2 parents a632849 + 55b5aa6 commit 94f671d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# This script is intended to be used on RR graph XML files generated by VPR.
4+
# If the architecture is a 2D architecture, you can simply call this script
5+
# to remove all attributes related to 3D FPGA support (layer="0",
6+
# layer_low="0", layer_high="0"). In VPR, these values default to 0.
7+
8+
# This also helps convert older RR graph files that used the "layer" attribute
9+
# instead of "layer_low" and "layer_high" for nodes, by removing the "layer" attribute
10+
# altogether. As a result, VPR can read the file without issues, and it slightly
11+
# reduces the file size for 2D architectures.
12+
13+
# Exit if any command fails
14+
set -e
15+
16+
# Check that a file was provided
17+
if [ $# -ne 1 ]; then
18+
echo "Usage: $0 <filename>"
19+
exit 1
20+
fi
21+
22+
FILE="$1"
23+
24+
# Check file existence
25+
if [ ! -f "$FILE" ]; then
26+
echo "Error: File '$FILE' not found."
27+
exit 1
28+
fi
29+
30+
# Remove all occurrences in-place
31+
sed -i \
32+
-e 's/layer="0"//g' \
33+
-e 's/layer_low="0"//g' \
34+
-e 's/layer_high="0"//g' \
35+
"$FILE"
36+
37+
echo "Removed layer attributes from '$FILE'."

0 commit comments

Comments
 (0)