OpenCores
URL https://opencores.org/ocsvn/z80soc/z80soc/trunk

Subversion Repositories z80soc

[/] [z80soc/] [trunk/] [V0.7.3/] [Software/] [C/] [bin/] [mif2coe.sh] - Blame information for rev 46

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 rrred
#!/bin/sh
2
 
3
IN=$1
4
 
5
 
6
cat $IN | grep -i data_radix | grep -i hex >>trash.tmp 2>>trash.tmp
7
 
8
if [[ $? -eq 0  ]];then
9
    radix=16
10
else cat $IN | grep -i data_radix | grep -i oct >>trash.tmp 2>>trash.tmp
11
     if [[ $? -eq 0  ]];then
12
         radix=8
13
     else cat $IN | grep -i data_radix | grep -i bin >>trash.tmp 2>>trash.tmp
14
         if [[ $? -eq 0  ]];then
15
             radix=2
16
         fi
17
     fi
18
fi
19
cat $IN | grep -v % | grep ":" | cut -f2 -d':' | cut -f1 -d";" | tr -d ' ' > mif2coe.tmp
20
 
21
NROWS=`cat mif2coe.tmp | wc -l | tr -d " "`
22
 
23
echo "memory_initialization_radix=$radix;"
24
 
25
echo "memory_initialization_vector="
26
 
27
awk -v ROWS=$NROWS '{if (NR==ROWS) { print $0";" } else { print $0"," }}' mif2coe.tmp
28
 
29
rm mif2coe.tmp
30
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.