Skip to content

Commit

Permalink
Fixing ioFixing utlility script and minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tajayi committed Dec 20, 2019
1 parent dc0aeee commit 8228185
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
3 changes: 1 addition & 2 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,16 @@ $(RESULTS_DIR)/2_2_floorplan_io.def: $(OBJECTS_DIR)/merged.lef $(RESULTS_DIR)/2_
openroad $(SCRIPTS_DIR)/io_placement.tcl \
2>&1 | tee $(LOG_DIR)/2_2_floorplan_io.log
@! grep --color "Error:" $(LOG_DIR)/2_2_floorplan_io.log
$(SCRIPTS_DIR)/fixIoPins.py --inputDef $@ --outputDef $@ --margin $(IO_PIN_MARGIN)

# STEP 3: Timing Driven Mixed Sized Placement
# Only run if required
#-------------------------------------------------------------------------------
$(RESULTS_DIR)/2_3_floorplan_tdms.def: $(RESULTS_DIR)/2_2_floorplan_io.def $(RESULTS_DIR)/1_synth.v $(RESULTS_DIR)/1_synth.sdc $(LIB_FILES) $(OBJECTS_DIR)/merged_padded.lef | ./PORT9.dat ./POST9.dat ./POWV9.dat
ifeq ($(RUN_MACRO_PLACEMENT),1)

openroad $(SCRIPTS_DIR)/tdms_place.tcl \
2>&1 | tee $(LOG_DIR)/2_3_tdms_place.log
@! grep --color "Error:" $(LOG_DIR)/2_3_tdms_place.log
$(SCRIPTS_DIR)/fixIoPins.py --inputDef $@ --outputDef $@ --margin $(IO_PIN_MARGIN)
else
cp $< $@
endif
Expand Down
41 changes: 20 additions & 21 deletions flow/scripts/fixIoPins.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,35 @@
# Function used by re.sub
def replace_coords(match):
# print(match.groups())
global countFail, countL, countB, countR, countT
global countFail, countWest, countSouth, countEast, countNorth

# Left-side
# West side
if match[1] == str(margin):
countL += 1
return "PLACED ( 0 " + match[2] + " ) N"
# Bottom-side
countWest += 1
return "PLACED ( 0 " + match[2] + " ) E + LAYER " + match[3] + " ( " + str(margin*-1) + " 0 ) ( " + str(margin) + " " + str(margin*2) + " )"
# South side
elif match[2] == str(margin):
countB += 1
return "PLACED ( " + match[1] + " 0 ) N"
# Right-side
countSouth += 1
return "PLACED ( " + match[1] + " 0 ) N + LAYER " + match[3] + " ( " + str(margin*-1) + " 0 ) ( " + str(margin) + " " + str(margin*2) + " )"
# East side
elif match[1] == str(width - margin):
countR += 1
return "PLACED ( "+ str(width) + " " + match[2] + " ) N"
# Top-side
countEast += 1
return "PLACED ( "+ str(width) + " " + match[2] + " ) W + LAYER " + match[3] + " ( " + str(margin*-1) + " 0 ) ( " + str(margin) + " " + str(margin*2) + " )"
# North side
elif match[2] == str(height - margin):
countT += 1
return "PLACED ( " + match[1] + " " + str(height) + " ) N"
countNorth += 1
return "PLACED ( " + match[1] + " " + str(height) + " ) S + LAYER " + match[3] + " ( " + str(margin*-1) + " 0 ) ( " + str(margin) + " " + str(margin*2) + " )"
# Shouldn't happen
else:
countFail += 1
return "PLACED ( " + match[1] + " " + match[2] + " ) N"
return match[0]

margin = int(args.margin)
countFail = 0
countL = 0
countB = 0
countR = 0
countT = 0
countWest = 0
countSouth = 0
countEast = 0
countNorth = 0

# Open Def File
f = open(args.inputDef)
Expand All @@ -63,18 +63,17 @@ def replace_coords(match):

# Find width and height
dieAreaPattern = r"DIEAREA *\( *\d+ *\d+ *\) *\( *(\d+) *(\d+) *\)"
# dieAreaPattern = r"(DIEAREA.*)"
m = re.search(dieAreaPattern, content)

width = int(m.group(1))
height = int(m.group(2))


# Perform replacement
placePattern = r"PLACED \( (\d+) (\d+) \) N"
placePattern = r"PLACED \( (\d+) (\d+) \) N \+ LAYER (\S+) \( \S+ \S+ \) \( \S+ \S+ \)"
result, count = re.subn(placePattern, replace_coords, content, 0, re.S)

print("Replacements made: L:" + str(countL) + " B:" + str(countB) + " R:" + str(countR) + " T:" + str(countT))
print("Replacements made - West:" + str(countWest) + " South:" + str(countSouth) + " East:" + str(countEast) + " North:" + str(countNorth))

if countFail > 0:
print("WARNING: Failed to make " + str(countFail) + " replacements" )
Expand Down
4 changes: 2 additions & 2 deletions flow/test/test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ set -o pipefail

mkdir -p $TEST_DIR/logs/$PLATFORM

make -C $TEST_DIR/.. DESIGN_CONFIG=./designs/$DESIGN\_$PLATFORM.mk clean_all
make -C $TEST_DIR/.. DESIGN_CONFIG=./designs/$DESIGN\_$PLATFORM.mk 2>&1 | tee $LOG_FILE
make -C $TEST_DIR/.. DESIGN_CONFIG=./designs/$PLATFORM/$DESIGN.mk clean_all
make -C $TEST_DIR/.. DESIGN_CONFIG=./designs/$PLATFORM/$DESIGN.mk 2>&1 | tee $LOG_FILE


#diff $LOG_FILE $GOLD_LOG_FILE

0 comments on commit 8228185

Please sign in to comment.