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

13 lines
401 B
Bash
Raw Normal View History

2018-02-24 16:56:57 +01:00
#!/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