Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # ========================================
- #
- # Author : William Liao
- # Date : 2017.05.21
- #
- # Find GTECH in final netlist
- #
- # Put this file in this path:
- # PROJECT/trunk/asic/SYN/net
- #
- # It will generate the output file:
- # search_GTECH_result
- #
- # There is no need to check "*.elab.vg"
- # since the 'elab' files are temp files!
- #
- # This script will search GTECH in
- # every 'final' netlist.
- #
- # ========================================
- Search() {
- # Detect the command 'rg' exist or not
- if hash rg 2> /dev/null; then
- printf "$ rg '%s' ${RED}%s${NC} :\n" "$1" "$2"
- printf "%s\n" -----------------------------------------
- rg --color=always -n "$@"
- printf "%s\n\n" -----------------------------------------
- else
- printf "$ grep --color=always -n '%s' ${RED}%s${NC} :\n" "$1" "$2"
- printf "%s\n" -----------------------------------------
- grep --color=always -n "$@"
- printf "%s\n\n" -----------------------------------------
- fi
- }
- # Files
- TEMP='temp_file'
- RESULT='search_GTECH_result'
- # Find all netlist but remove the temp files and shell netlists
- # in the current directory
- ALL_NETLIST='*.vg'
- TMP_NETLIST='elab'
- SHELL_NETLIST='shell'
- # Store all output from command 'find' to an array
- NETLIST=( $(find . -maxdepth 1 -name "${ALL_NETLIST}" | sed "/${TMP_NETLIST}/d;/${SHELL_NETLIST}/d") )
- # Check whether array is empty or not
- if [ ${#NETLIST[@]} -eq 0 ]; then
- echo 'There are no files to be checked!'
- exit
- else
- echo -e 'Start checking...\n'
- fi
- # Create a new temporary file
- true > ${TEMP}
- # Search 'GTECH' in those report
- for ((index=0; index<${#NETLIST[@]}; index++)); do
- # Print this line for debugging
- # --------------------------------------------
- # echo "NETLIST[$index] => ${NETLIST[$index]}"
- # --------------------------------------------
- # Search 'GTECH' in every 'final' netlist
- {
- Search 'GTECH' "${NETLIST[$index]}"
- } >> ${TEMP}
- done
- # Show info. in terminal
- cat ${TEMP}
- # Remove color
- sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" ${TEMP} > ${RESULT}
- # Change mode to add readbility
- chmod +x ${RESULT}
- # Remove temporary file
- rm ${TEMP}
- : << Comment
- The script will not search the temporary file and shell netlist.
- ex:
- miu_XXX.elab.vg (temporary file)
- miu_XXX_shell.vg (shell netlist)
- Comment
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement