1 |
2 |
sandroamt |
#!/bin/sh
|
2 |
|
|
#
|
3 |
|
|
|
4 |
|
|
################################################################################
|
5 |
|
|
#### ####
|
6 |
|
|
#### This file is part of the yaVGA project ####
|
7 |
|
|
#### http://www.opencores.org/?do=project&who=yavga ####
|
8 |
|
|
#### ####
|
9 |
|
|
#### Description ####
|
10 |
|
|
#### Implementation of yaVGA IP core ####
|
11 |
|
|
#### ####
|
12 |
|
|
#### To Do: ####
|
13 |
|
|
#### ####
|
14 |
|
|
#### ####
|
15 |
|
|
#### Author(s): ####
|
16 |
|
|
#### Sandro Amato, sdroamt@netscape.net ####
|
17 |
|
|
#### ####
|
18 |
|
|
################################################################################
|
19 |
|
|
#### ####
|
20 |
|
|
#### Copyright (c) 2009, Sandro Amato ####
|
21 |
|
|
#### All rights reserved. ####
|
22 |
|
|
#### ####
|
23 |
|
|
#### Redistribution and use in source and binary forms, with or without ####
|
24 |
|
|
#### modification, are permitted provided that the following conditions ####
|
25 |
|
|
#### are met: ####
|
26 |
|
|
#### ####
|
27 |
|
|
#### * Redistributions of source code must retain the above ####
|
28 |
|
|
#### copyright notice, this list of conditions and the ####
|
29 |
|
|
#### following disclaimer. ####
|
30 |
|
|
#### * Redistributions in binary form must reproduce the above ####
|
31 |
|
|
#### copyright notice, this list of conditions and the ####
|
32 |
|
|
#### following disclaimer in the documentation and/or other ####
|
33 |
|
|
#### materials provided with the distribution. ####
|
34 |
|
|
#### * Neither the name of SANDRO AMATO nor the names of its ####
|
35 |
|
|
#### contributors may be used to endorse or promote products ####
|
36 |
|
|
#### derived from this software without specific prior written ####
|
37 |
|
|
#### permission. ####
|
38 |
|
|
#### ####
|
39 |
|
|
#### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ####
|
40 |
|
|
#### "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ####
|
41 |
|
|
#### LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ####
|
42 |
|
|
#### FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ####
|
43 |
|
|
#### COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ####
|
44 |
|
|
#### INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ####
|
45 |
|
|
#### BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ####
|
46 |
|
|
#### LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ####
|
47 |
|
|
#### CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ####
|
48 |
|
|
#### LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ####
|
49 |
|
|
#### ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ####
|
50 |
|
|
#### POSSIBILITY OF SUCH DAMAGE. ####
|
51 |
|
|
################################################################################
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
INIT_ELEM=32
|
55 |
|
|
|
56 |
|
|
CURR_ELEM=0
|
57 |
|
|
CURR_INIT=""
|
58 |
|
|
INIT_NUM=0
|
59 |
|
|
while read LINE ; do
|
60 |
|
|
case "${LINE}" in
|
61 |
7 |
sandroamt |
\#*) # skip
|
62 |
2 |
sandroamt |
;;
|
63 |
|
|
|
64 |
7 |
sandroamt |
*) HEX=`echo "obase=16; ibase=2; ${LINE}" | sed -e ' s/-/0/g ' | sed -e ' s/@/1/g ' | bc`
|
65 |
2 |
sandroamt |
|
66 |
|
|
CURR_ELEM=$((${CURR_ELEM} + 1))
|
67 |
|
|
# echo ${CURR_ELEM}
|
68 |
|
|
|
69 |
|
|
if [ ${#HEX} = 1 ] ; then
|
70 |
|
|
CURR_INIT="0${HEX}${CURR_INIT}"
|
71 |
|
|
else
|
72 |
|
|
CURR_INIT="${HEX}${CURR_INIT}"
|
73 |
|
|
fi
|
74 |
|
|
|
75 |
|
|
if [ ${CURR_ELEM} = ${INIT_ELEM} ] ; then
|
76 |
|
|
INIT_HEX=`echo "obase=16; ibase=10; ${INIT_NUM}" | bc`
|
77 |
|
|
echo "INIT_${INIT_HEX} => X\"${CURR_INIT}\","
|
78 |
|
|
CURR_ELEM=0
|
79 |
|
|
CURR_INIT=""
|
80 |
|
|
|
81 |
|
|
INIT_NUM=$((${INIT_NUM} + 1))
|
82 |
|
|
fi
|
83 |
|
|
|
84 |
|
|
;;
|
85 |
|
|
esac
|
86 |
|
|
done < chars.map
|
87 |
|
|
echo "INIT_${INIT_HEX} => X\"${CURR_INIT}\","
|
88 |
|
|
|
89 |
|
|
|