| #!/usr/bin/env bash |
| |
| export REDIR_FILE="/dev/stderr" |
| export PYTHONHASHSEED=0 |
| |
| SCRIPT_SRC="$(realpath ${BASH_SOURCE[0]})" |
| SCRIPT_DIR="$(dirname "${SCRIPT_SRC}")" |
| |
| source $SCRIPT_DIR/common.sh |
| |
| if [ -z "$INPUT_DIRECTORY" ]; then |
| if [ ! -z "$1" ]; then |
| INPUT_DIRECTORY=$1 |
| else |
| msg "No \$INPUT_DIRECTORY set or argument given." |
| exit 1 |
| fi |
| fi |
| if [ -z "$OUTPUT_DIRECTORY" ]; then |
| if [ ! -z "$2" ]; then |
| OUTPUT_DIRECTORY=$2 |
| else |
| msg "No \$OUTPUT_DIRECTORY set or argument given." |
| exit 1 |
| fi |
| fi |
| |
| TEMP_DIR=$(realpath ../tempdir-openram) |
| if [ -d "$TEMP_DIR" ]; then |
| msg "Temp directory exists!" |
| exit 1 |
| fi |
| |
| mkdir -p $TEMP_DIR |
| |
| rm -rf $OUTPUT_DIRECTORY/libraries |
| mkdir $OUTPUT_DIRECTORY/libraries |
| |
| # Copy accross the template files |
| msg "Copying template files." |
| $SCRIPT_DIR/template-files.py $INPUT_DIRECTORY $OUTPUT_DIRECTORY $TEMP_DIR ; RETCODE=$? |
| if [ "$RETCODE" -ne 0 ]; then |
| msg "Error: Failed to copy template files!?" |
| exit 1 |
| else |
| msg "Successfully copied template files." |
| fi |
| |
| # Copy accross the template files |
| #msg "Copying tlef files." |
| #$SCRIPT_DIR/tlef.py $INPUT_DIRECTORY $OUTPUT_DIRECTORY $TEMP_DIR ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to copy tlef files!?" |
| # exit 1 |
| #else |
| # msg "Successfully copied tlef files." |
| #fi |
| |
| # Split apart LIB files |
| #msg "Splitting existing LIB files." |
| #$SCRIPT_DIR/liberty_rewrite.sh $INPUT_DIRECTORY $OUTPUT_DIRECTORY $TEMP_DIR ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to rewrite Liberty JSON files!?" |
| # exit 1 |
| #else |
| # msg "Successfully rewrote Liberty JSON files." |
| #fi |
| |
| |
| # Split apart LEF files first |
| #msg "Splitting existing LEF files." |
| #find $INPUT_DIRECTORY -name \*.lef -print \ |
| # | parallel -v $SCRIPT_DIR/lef_rewrite.py \{\} $OUTPUT_DIRECTORY $TEMP_DIR \ |
| # ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to split LEF files!?" |
| # exit 1 |
| #else |
| # msg "Successfully split LEF files." |
| #fi |
| |
| # Split apart the CDL files into netlist.csv files |
| #msg "Splitting CDL into CSV files." |
| #$SCRIPT_DIR/cdl_rewrite.py $INPUT_DIRECTORY $OUTPUT_DIRECTORY $TEMP_DIR ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to split CDL files into CSV files!?" |
| # exit 1 |
| #else |
| # msg "Successfully split CDL files into CSV files." |
| #fi |
| |
| # Convert the netlist.csv files to .cdl file |
| #$SCRIPT_DIR/netlist-csv2cdl.py $OUTPUT_DIRECTORY ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to convert netlist.csv into CDL files!?" |
| # exit 1 |
| #else |
| # msg "Successfully converted netlist.csv into CDL files." |
| #fi |
| |
| # Split apart the GDS files |
| # Depends on CDL and LEF |
| msg "Splitting GDS files." |
| |
| find $INPUT_DIRECTORY -name \*.gds -print | sed -e's-gds/.*$--' | sort | uniq \ |
| | parallel -v $SCRIPT_DIR/gds_to_lef_gds_mag.py \{\} $OUTPUT_DIRECTORY $INPUT_DIRECTORY/sky130A.tech $TEMP_DIR \ |
| ; RETCODE=$? |
| if [ "$RETCODE" -ne 0 ]; then |
| msg "Error: Failed to split GDS files!?" |
| exit 1 |
| else |
| msg "Successfully split GDS files." |
| fi |
| |
| $SCRIPT_DIR/gds-preview.sh $INPUT_DIRECTORY $OUTPUT_DIRECTORY $TEMP_DIR || exit 1 |
| |
| # Convert the verilog files |
| #msg "Splitting Verilog files." |
| #$SCRIPT_DIR/verilog_split.py $INPUT_DIRECTORY $OUTPUT_DIRECTORY $TEMP_DIR ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to split Verilog files!?" |
| # exit 1 |
| #else |
| # msg "Successfully split Verilog files." |
| #fi |
| |
| # Generate the blackbox verilog files |
| #msg "Generating blackbox Verilog model files." |
| #$SCRIPT_DIR/generate_verilog_blackbox.py $OUTPUT_DIRECTORY/skywater-pdk/libraries/*/*/models/* ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to generate blackbox Verilog model files!?" |
| # exit 1 |
| #else |
| # msg "Successfully generated blackbox Verilog model files." |
| #fi |
| #msg "Generating blackbox Verilog cell files." |
| #$SCRIPT_DIR/generate_verilog_blackbox.py $OUTPUT_DIRECTORY/skywater-pdk/libraries/*/*/cells/* ; RETCODE=$? |
| #if [ "$RETCODE" -ne 0 ]; then |
| # msg "Error: Failed to generate blackbox Verilog cell files!?" |
| # exit 1 |
| #else |
| # msg "Successfully generated blackbox Verilog cell files." |
| #fi |
| |
| # Generate the .svg symbol images |
| #$SCRIPT_DIR/symbols.sh $OUTPUT_DIRECTORY || exit 1 |
| |
| # Generate the .svg schematic images |
| #$SCRIPT_DIR/schematics.sh $OUTPUT_DIRECTORY || exit 1 |
| |
| # Remove the .pins files |
| find $OUTPUT_DIRECTORY -name *.pins -delete |
| |
| # FIXME: Copy across the "tech" files needed for openram |
| # FIXME: Copy across the macros directory and rebuilt the macros. |
| |
| # Output the status. |
| export DESCRIBE=$(git describe) |
| git describe > $OUTPUT_DIRECTORY/build-tool-version |
| |
| git describe |
| git diff HEAD |
| |
| msg "Doing git operations." |
| ( |
| cd $OUTPUT_DIRECTORY |
| git add -A |
| git diff HEAD --stat |
| git commit -m"Built based on $DESCRIBE" |
| git push origin master:"ram-$DESCRIBE" |
| ) |
| msg "Finished git operations." |
| |
| msg "FINISHED: Build completed successfully @ $(date) using $(git describe)." |