Skip to content

Commit

Permalink
Add the --notool option, to avoid errors when tools are not available
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomelo9 committed Sep 7, 2024
1 parent fcd51f6 commit 1a0ff91
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 32 deletions.
16 changes: 11 additions & 5 deletions examples/projects/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Diamond(odir=f'results/diamond/{args.source}/{args.board}')
Expand Down Expand Up @@ -43,8 +46,11 @@

prj.set_top('Top')

if args.action in ['make', 'all']:
prj.make()

if args.action in ['prog', 'all']:
prj.prog()
try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
16 changes: 11 additions & 5 deletions examples/projects/ise.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Ise(odir=f'results/ise/{args.source}/{args.board}')
Expand Down Expand Up @@ -45,8 +48,11 @@

prj.set_top('Top')

if args.action in ['make', 'all']:
prj.make()

if args.action in ['prog', 'all']:
prj.prog()
try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
16 changes: 11 additions & 5 deletions examples/projects/libero.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Libero(odir=f'results/libero/{args.source}/{args.board}')
Expand Down Expand Up @@ -43,8 +46,11 @@

prj.set_top('Top')

if args.action in ['make', 'all']:
prj.make()

if args.action in ['prog', 'all']:
prj.prog()
try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
16 changes: 11 additions & 5 deletions examples/projects/openflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Openflow(odir=f'results/openflow/{args.source}/{args.board}')
Expand Down Expand Up @@ -59,8 +62,11 @@

prj.set_top('Top')

if args.action in ['make', 'all']:
prj.make()

if args.action in ['prog', 'all']:
prj.prog()
try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
16 changes: 11 additions & 5 deletions examples/projects/quartus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Quartus(odir=f'results/quartus/{args.source}/{args.board}')
Expand Down Expand Up @@ -44,8 +47,11 @@

prj.set_top('Top')

if args.action in ['make', 'all']:
prj.make()

if args.action in ['prog', 'all']:
prj.prog()
try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
25 changes: 23 additions & 2 deletions examples/projects/regress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,24 @@ TOOLS["vivado"]="zybo arty"

SOURCES=("vlog" "vhdl" "slog")

SPECIFIED_TOOL=$1
SPECIFIED_TOOL=""
NOTOOL=false
while [[ "$#" -gt 0 ]]; do
case $1 in
--tool)
SPECIFIED_TOOL="$2"
shift 2
;;
--notool)
NOTOOL=true
shift
;;
*)
echo "Invalid option: $1"
exit 1
;;
esac
done

for TOOL in "${!TOOLS[@]}"; do
if [[ -n "$SPECIFIED_TOOL" && "$TOOL" != "$SPECIFIED_TOOL" ]]; then
Expand All @@ -26,7 +43,11 @@ for TOOL in "${!TOOLS[@]}"; do
continue
fi
echo "> $TOOL - $BOARD - $SOURCE"
python3 $TOOL.py --board $BOARD --source $SOURCE
if [[ "$NOTOOL" == true ]]; then
python3 $TOOL.py --board $BOARD --source $SOURCE --notool
else
python3 $TOOL.py --board $BOARD --source $SOURCE
fi
done
done
done
16 changes: 11 additions & 5 deletions examples/projects/vivado.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Vivado(odir=f'results/vivado/{args.source}/{args.board}')
Expand Down Expand Up @@ -50,8 +53,11 @@

prj.set_top('Top')

if args.action in ['make', 'all']:
prj.make()

if args.action in ['prog', 'all']:
prj.prog()
try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise

0 comments on commit 1a0ff91

Please sign in to comment.