f4pga/wrappers/sh: cleanup
Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
parent
66d69b237a
commit
8dc2c18038
|
@ -161,20 +161,20 @@ def synth():
|
||||||
|
|
||||||
def write_fasm(genfasm_extra_args = None):
|
def write_fasm(genfasm_extra_args = None):
|
||||||
print("[F4PGA] Running (deprecated) write fasm")
|
print("[F4PGA] Running (deprecated) write fasm")
|
||||||
run_bash_cmds(vpr_common_cmds('fasm')+f"""
|
run_bash_cmds(vpr_common_cmds('fasm')+"""
|
||||||
TOP="${{EBLIF%.*}}"
|
TOP="${EBLIF%.*}"
|
||||||
FASM_EXTRA="${{TOP}}_fasm_extra.fasm"
|
FASM_EXTRA="${TOP}_fasm_extra.fasm"
|
||||||
|
""" + f"""
|
||||||
'{which('genfasm')}' \
|
'{which('genfasm')}' \
|
||||||
${{ARCH_DEF}} ${{EBLIF}} --device ${{DEVICE_NAME}} \
|
${{ARCH_DEF}} ${{EBLIF}} --device ${{DEVICE_NAME}} \
|
||||||
${{VPR_OPTIONS}} \
|
${{VPR_OPTIONS}} \
|
||||||
--read_rr_graph ${{RR_GRAPH}} {' '.join(genfasm_extra_args) if genfasm_extra_args is not None else ''}
|
--read_rr_graph ${{RR_GRAPH}} {' '.join(genfasm_extra_args) if genfasm_extra_args is not None else ''}
|
||||||
|
""" + """
|
||||||
echo "FASM extra: $FASM_EXTRA"
|
echo "FASM extra: $FASM_EXTRA"
|
||||||
if [ -f $FASM_EXTRA ]; then
|
if [ -f $FASM_EXTRA ]; then
|
||||||
echo "writing final fasm"
|
echo "writing final fasm"
|
||||||
cat ${{TOP}}.fasm $FASM_EXTRA > tmp.fasm
|
cat ${TOP}.fasm $FASM_EXTRA > tmp.fasm
|
||||||
mv tmp.fasm ${{TOP}}.fasm
|
mv tmp.fasm ${TOP}.fasm
|
||||||
fi
|
fi
|
||||||
""")
|
""")
|
||||||
Path('vpr_stdout.log').rename('fasm.log')
|
Path('vpr_stdout.log').rename('fasm.log')
|
||||||
|
@ -189,17 +189,19 @@ def vpr_common():
|
||||||
|
|
||||||
def write_bitstream():
|
def write_bitstream():
|
||||||
print("[F4PGA] Running (deprecated) write bitstream")
|
print("[F4PGA] Running (deprecated) write bitstream")
|
||||||
run_bash_cmds(f"""
|
run_bash_cmds("""
|
||||||
set -e
|
set -e
|
||||||
echo "Writing bitstream ..."
|
echo "Writing bitstream ..."
|
||||||
FRM2BIT=""
|
FRM2BIT=""
|
||||||
if [ ! -z ${{FRAMES2BIT}} ]; then FRM2BIT="--frm2bit ${{FRAMES2BIT}}"; fi
|
if [ ! -z ${FRAMES2BIT} ]; then FRM2BIT="--frm2bit ${FRAMES2BIT}"; fi
|
||||||
|
""" + f"""
|
||||||
eval set -- $(
|
eval set -- $(
|
||||||
getopt \
|
getopt \
|
||||||
--options=d:f:b:p: \
|
--options=d:f:b:p: \
|
||||||
--longoptions=device:,fasm:,bit:,part: \
|
--longoptions=device:,fasm:,bit:,part: \
|
||||||
--name $0 -- {' '.join(sys_argv[1:])}
|
--name $0 -- {' '.join(sys_argv[1:])}
|
||||||
)
|
)
|
||||||
|
""" + """
|
||||||
DEVICE=""
|
DEVICE=""
|
||||||
FASM=""
|
FASM=""
|
||||||
BIT=""
|
BIT=""
|
||||||
|
@ -213,28 +215,28 @@ while true; do
|
||||||
--) break ;;
|
--) break ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
DATABASE_DIR=${{DATABASE_DIR:=$(prjxray-config)}}
|
DATABASE_DIR=${DATABASE_DIR:=$(prjxray-config)}
|
||||||
if [ -z $DEVICE ]; then
|
if [ -z $DEVICE ]; then
|
||||||
# Try to find device name. Accept only when exactly one is found
|
# Try to find device name. Accept only when exactly one is found
|
||||||
PART_DIRS=(${{DATABASE_DIR}}/*/${{PART}})
|
PART_DIRS=(${DATABASE_DIR}/*/${PART})
|
||||||
if [ ${{#PART_DIRS[@]}} -eq 1 ]; then
|
if [ ${#PART_DIRS[@]} -eq 1 ]; then
|
||||||
DEVICE=$(basename $(dirname "${{PART_DIRS[0]}}"))
|
DEVICE=$(basename $(dirname "${PART_DIRS[0]}"))
|
||||||
else
|
else
|
||||||
echo "Please provide device name"
|
echo "Please provide device name"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
DBROOT=`realpath ${{DATABASE_DIR}}/${{DEVICE}}`
|
DBROOT=`realpath ${DATABASE_DIR}/${DEVICE}`
|
||||||
if [ -z $FASM ]; then echo "Please provide fasm file name"; exit 1; fi
|
if [ -z $FASM ]; then echo "Please provide fasm file name"; exit 1; fi
|
||||||
if [ -z $BIT ]; then echo "Please provide bit file name"; exit 1; fi
|
if [ -z $BIT ]; then echo "Please provide bit file name"; exit 1; fi
|
||||||
xcfasm \
|
xcfasm \
|
||||||
--db-root ${{DBROOT}} \
|
--db-root ${DBROOT} \
|
||||||
--part ${{PART}} \
|
--part ${PART} \
|
||||||
--part_file ${{DBROOT}}/${{PART}}/part.yaml \
|
--part_file ${DBROOT}/${PART}/part.yaml \
|
||||||
--sparse \
|
--sparse \
|
||||||
--emit_pudc_b_pullup \
|
--emit_pudc_b_pullup \
|
||||||
--fn_in ${{FASM}} \
|
--fn_in ${FASM} \
|
||||||
--bit_out ${{BIT}} ${{FRM2BIT}}
|
--bit_out ${BIT} ${FRM2BIT}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,7 +244,7 @@ xcfasm \
|
||||||
|
|
||||||
def analysis():
|
def analysis():
|
||||||
print("[F4PGA] Running (deprecated) analysis")
|
print("[F4PGA] Running (deprecated) analysis")
|
||||||
run_bash_cmds(vpr_common_cmds('analysis')+f"""
|
run_bash_cmds(vpr_common_cmds('analysis')+"""
|
||||||
run_vpr \
|
run_vpr \
|
||||||
--analysis \
|
--analysis \
|
||||||
--gen_post_synthesis_netlist on \
|
--gen_post_synthesis_netlist on \
|
||||||
|
@ -256,10 +258,11 @@ run_vpr \
|
||||||
|
|
||||||
def repack():
|
def repack():
|
||||||
print("[F4PGA] Running (deprecated) repack")
|
print("[F4PGA] Running (deprecated) repack")
|
||||||
run_bash_cmds(vpr_common_cmds()+f"""
|
run_bash_cmds(vpr_common_cmds()+"""
|
||||||
DESIGN=${{EBLIF/.eblif/}}
|
DESIGN=${EBLIF/.eblif/}
|
||||||
[ ! -z "${{JSON}}" ] && JSON_ARGS="--json-constraints ${{JSON}}" || JSON_ARGS=
|
[ ! -z "${JSON}" ] && JSON_ARGS="--json-constraints ${JSON}" || JSON_ARGS=
|
||||||
[ ! -z "${{PCF_PATH}}" ] && PCF_ARGS="--pcf-constraints ${{PCF_PATH}}" || PCF_ARGS=
|
[ ! -z "${PCF_PATH}" ] && PCF_ARGS="--pcf-constraints ${PCF_PATH}" || PCF_ARGS=
|
||||||
|
""" + f"""
|
||||||
PYTHONPATH=$F4PGA_SHARE_DIR/scripts:$PYTHONPATH \
|
PYTHONPATH=$F4PGA_SHARE_DIR/scripts:$PYTHONPATH \
|
||||||
'{which('python3')}' "$F4PGA_SHARE_DIR"/scripts/repacker/repack.py \
|
'{which('python3')}' "$F4PGA_SHARE_DIR"/scripts/repacker/repack.py \
|
||||||
--vpr-arch ${{ARCH_DEF}} \
|
--vpr-arch ${{ARCH_DEF}} \
|
||||||
|
@ -287,6 +290,7 @@ eval set -- "$(
|
||||||
--longoptions=device:,fasm:,format:,bit:,part: \
|
--longoptions=device:,fasm:,format:,bit:,part: \
|
||||||
--name $0 -- {' '.join(sys_argv[1:])}
|
--name $0 -- {' '.join(sys_argv[1:])}
|
||||||
)"
|
)"
|
||||||
|
""" + """
|
||||||
DEVICE=""
|
DEVICE=""
|
||||||
FASM=""
|
FASM=""
|
||||||
BIT_FORMAT="4byte"
|
BIT_FORMAT="4byte"
|
||||||
|
@ -305,6 +309,7 @@ done
|
||||||
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
|
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
|
||||||
if [ -z $FASM ]; then echo "Please provide an input FASM file name"; exit 1; fi
|
if [ -z $FASM ]; then echo "Please provide an input FASM file name"; exit 1; fi
|
||||||
if [ -z $BIT ]; then echo "Please provide an output bistream file name"; exit 1; fi
|
if [ -z $BIT ]; then echo "Please provide an output bistream file name"; exit 1; fi
|
||||||
|
""" + f"""
|
||||||
if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then
|
if [[ "$DEVICE" =~ ^(qlf_k4n8.*)$ ]]; then
|
||||||
'{which('qlf_fasm')}' \
|
'{which('qlf_fasm')}' \
|
||||||
--db-root "${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}/fasm_database/${{DEVICE}}" \
|
--db-root "${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}/fasm_database/${{DEVICE}}" \
|
||||||
|
@ -338,8 +343,10 @@ if [[ '{device}' =~ ^(qlf_k4n8_qlf_k4n8)$ ]];then
|
||||||
else
|
else
|
||||||
DEVICE_1={device}
|
DEVICE_1={device}
|
||||||
fi
|
fi
|
||||||
ARCH_DIR="$F4PGA_SHARE_DIR"/arch/${{DEVICE_1}}_${{DEVICE_1}}
|
""" + """
|
||||||
PINMAP_XML=${{ARCH_DIR}}/${{PINMAPXML}}
|
ARCH_DIR="$F4PGA_SHARE_DIR"/arch/${DEVICE_1}_${DEVICE_1}
|
||||||
|
PINMAP_XML=${ARCH_DIR}/${PINMAPXML}
|
||||||
|
""" + f"""
|
||||||
'{which('python3')}' "$F4PGA_SHARE_DIR"/scripts/create_lib.py \
|
'{which('python3')}' "$F4PGA_SHARE_DIR"/scripts/create_lib.py \
|
||||||
-n "${{DEV}}_0P72_SSM40" \
|
-n "${{DEV}}_0P72_SSM40" \
|
||||||
-m fpga_top \
|
-m fpga_top \
|
||||||
|
@ -357,15 +364,17 @@ def ql():
|
||||||
|
|
||||||
def fasm2bels():
|
def fasm2bels():
|
||||||
print("[F4PGA] Running (deprecated) fasm2bels")
|
print("[F4PGA] Running (deprecated) fasm2bels")
|
||||||
run_bash_cmds(f"""
|
run_bash_cmds("""
|
||||||
set -e
|
set -e
|
||||||
SHARE_DIR_PATH=${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}
|
SHARE_DIR_PATH=${{SHARE_DIR_PATH:="$F4PGA_SHARE_DIR"}}
|
||||||
|
""" + f"""
|
||||||
eval set -- "$(
|
eval set -- "$(
|
||||||
getopt \
|
getopt \
|
||||||
--options=d:P:p:b:v:o:q \
|
--options=d:P:p:b:v:o:q \
|
||||||
--longoptions=device:,part:,pcf:,bit:,out-verilog:,out-pcf:,out-qcf:, \
|
--longoptions=device:,part:,pcf:,bit:,out-verilog:,out-pcf:,out-qcf:, \
|
||||||
--name $0 -- {' '.join(sys_argv[1:])}
|
--name $0 -- {' '.join(sys_argv[1:])}
|
||||||
)"
|
)"
|
||||||
|
""" + """
|
||||||
DEVICE=""
|
DEVICE=""
|
||||||
PART=""
|
PART=""
|
||||||
PCF=""
|
PCF=""
|
||||||
|
@ -388,9 +397,10 @@ done
|
||||||
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
|
if [ -z $DEVICE ]; then echo "Please provide device name"; exit 1; fi
|
||||||
if [ -z $BIT ]; then echo "Please provide an input bistream file name"; exit 1; fi
|
if [ -z $BIT ]; then echo "Please provide an input bistream file name"; exit 1; fi
|
||||||
# $DEVICE is not ql-eos-s3 or ql-pp3e
|
# $DEVICE is not ql-eos-s3 or ql-pp3e
|
||||||
if ! [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then echo "ERROR: Unsupported device '${{DEVICE}}' for fasm2bels"; exit -1; fi
|
if ! [[ "$DEVICE" =~ ^(ql-eos-s3|ql-pp3e)$ ]]; then echo "ERROR: Unsupported device '${DEVICE}' for fasm2bels"; exit -1; fi
|
||||||
if [ -z "{{PCF}}" ]; then PCF_ARGS=""; else PCF_ARGS="--input-pcf ${{PCF}}"; fi
|
if [ -z "{PCF}" ]; then PCF_ARGS=""; else PCF_ARGS="--input-pcf ${PCF}"; fi
|
||||||
echo "Running fasm2bels"
|
echo "Running fasm2bels"
|
||||||
|
""" + f"""
|
||||||
'{which('python3')}' "`readlink -f ${{SHARE_DIR_PATH}}/scripts/fasm2bels.py`" "${{BIT}}" \
|
'{which('python3')}' "`readlink -f ${{SHARE_DIR_PATH}}/scripts/fasm2bels.py`" "${{BIT}}" \
|
||||||
--phy-db "`readlink -f ${{SHARE_DIR_PATH}}/arch/${{DEVICE}}_wlcsp/db_phy.pickle`" \
|
--phy-db "`readlink -f ${{SHARE_DIR_PATH}}/arch/${{DEVICE}}_wlcsp/db_phy.pickle`" \
|
||||||
--device-name "${{DEVICE/ql-/}}" \
|
--device-name "${{DEVICE/ql-/}}" \
|
||||||
|
|
Loading…
Reference in New Issue