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

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [DE1/] [ROM/] [mif2coe.sh] - Blame information for rev 31

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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