1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-11-24 17:16:04 +01:00
cdf2018-principal/fpga/generateConstants.sh

13 lines
401 B
Bash
Executable file

#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
grep "#define [A-Z0-9_]\+ '[a-zA-Z]'" ../arduino/AFsignals.h | while read line
do
name="$(echo "$line" | cut -d ' ' -f 2)"
letter="$(echo "$line" | cut -d ' ' -f 3 | cut -d "'" -f 2)"
hex="$(python -c "print(hex(ord('$letter'))[2:])")"
echo " constant $name : std_logic_vector(7 downto 0) := x\"$hex\"; -- '$letter'"
done