1 |
2 |
csantifort |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
#--------------------------------------------------------------#
|
4 |
|
|
# #
|
5 |
36 |
csantifort |
# amber-memparams128.sh #
|
6 |
2 |
csantifort |
# #
|
7 |
|
|
# This file is part of the Amber project #
|
8 |
|
|
# http://www.opencores.org/project,amber #
|
9 |
|
|
# #
|
10 |
|
|
# Description #
|
11 |
|
|
# Create a memparams file. Used to seed the boot_mem SRAM #
|
12 |
|
|
# #
|
13 |
|
|
# Author(s): #
|
14 |
|
|
# - Conor Santifort, csantifort.amber@gmail.com #
|
15 |
|
|
# #
|
16 |
|
|
#//////////////////////////////////////////////////////////////#
|
17 |
|
|
# #
|
18 |
|
|
# Copyright (C) 2010 Authors and OPENCORES.ORG #
|
19 |
|
|
# #
|
20 |
|
|
# This source file may be used and distributed without #
|
21 |
|
|
# restriction provided that this copyright statement is not #
|
22 |
|
|
# removed from the file and that any derivative work contains #
|
23 |
|
|
# the original copyright notice and the associated disclaimer. #
|
24 |
|
|
# #
|
25 |
|
|
# This source file is free software; you can redistribute it #
|
26 |
|
|
# and/or modify it under the terms of the GNU Lesser General #
|
27 |
|
|
# Public License as published by the Free Software Foundation; #
|
28 |
|
|
# either version 2.1 of the License, or (at your option) any #
|
29 |
|
|
# later version. #
|
30 |
|
|
# #
|
31 |
|
|
# This source is distributed in the hope that it will be #
|
32 |
|
|
# useful, but WITHOUT ANY WARRANTY; without even the implied #
|
33 |
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR #
|
34 |
|
|
# PURPOSE. See the GNU Lesser General Public License for more #
|
35 |
|
|
# details. #
|
36 |
|
|
# #
|
37 |
|
|
# You should have received a copy of the GNU Lesser General #
|
38 |
|
|
# Public License along with this source; if not, download it #
|
39 |
|
|
# from http://www.opencores.org/lgpl.shtml #
|
40 |
|
|
# #
|
41 |
|
|
#--------------------------------------------------------------#
|
42 |
|
|
|
43 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $1 $2}' |\
|
44 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
45 |
|
|
awk '{printf " .SRAM0_INIT_" NR-1 " ( 256%ch", 39 } \
|
46 |
|
|
$31=="" {printf "00"} \
|
47 |
|
|
$30=="" {printf "00"} \
|
48 |
|
|
$29=="" {printf "00"} \
|
49 |
|
|
$28=="" {printf "00"} \
|
50 |
|
|
$27=="" {printf "00"} \
|
51 |
|
|
$26=="" {printf "00"} \
|
52 |
|
|
$25=="" {printf "00"} \
|
53 |
|
|
$24=="" {printf "00"} \
|
54 |
|
|
$23=="" {printf "00"} \
|
55 |
|
|
$22=="" {printf "00"} \
|
56 |
|
|
$21=="" {printf "00"} \
|
57 |
|
|
$20=="" {printf "00"} \
|
58 |
|
|
$19=="" {printf "00"} \
|
59 |
|
|
$18=="" {printf "00"} \
|
60 |
|
|
$17=="" {printf "00"} \
|
61 |
|
|
$16=="" {printf "00"} \
|
62 |
|
|
$15=="" {printf "00"} \
|
63 |
|
|
$14=="" {printf "00"} \
|
64 |
|
|
$13=="" {printf "00"} \
|
65 |
|
|
$12=="" {printf "00"} \
|
66 |
|
|
$11=="" {printf "00"} \
|
67 |
|
|
$10=="" {printf "00"} \
|
68 |
|
|
$9=="" {printf "00"} \
|
69 |
|
|
$8=="" {printf "00"} \
|
70 |
|
|
$7=="" {printf "00"} \
|
71 |
|
|
$6=="" {printf "00"} \
|
72 |
|
|
$5=="" {printf "00"} \
|
73 |
|
|
$4=="" {printf "00"} \
|
74 |
|
|
$3=="" {printf "00"} \
|
75 |
|
|
$2=="" {printf "00"} \
|
76 |
|
|
{print $32 $31 $30 $29 $28 $27 $26 $25 $24 $23 $22 $21 $20 $19 $18 $17 $16 $15 $14 $13 $12 $11 $10 $9 $8 $7 $6 $5 $4 $3 $2 $1 " )," } ' \
|
77 |
|
|
> $2
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $3 $4}' |\
|
81 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
82 |
|
|
awk '{printf " .SRAM1_INIT_" NR-1 " ( 256%ch", 39 } \
|
83 |
|
|
$31=="" {printf "00"} \
|
84 |
|
|
$30=="" {printf "00"} \
|
85 |
|
|
$29=="" {printf "00"} \
|
86 |
|
|
$28=="" {printf "00"} \
|
87 |
|
|
$27=="" {printf "00"} \
|
88 |
|
|
$26=="" {printf "00"} \
|
89 |
|
|
$25=="" {printf "00"} \
|
90 |
|
|
$24=="" {printf "00"} \
|
91 |
|
|
$23=="" {printf "00"} \
|
92 |
|
|
$22=="" {printf "00"} \
|
93 |
|
|
$21=="" {printf "00"} \
|
94 |
|
|
$20=="" {printf "00"} \
|
95 |
|
|
$19=="" {printf "00"} \
|
96 |
|
|
$18=="" {printf "00"} \
|
97 |
|
|
$17=="" {printf "00"} \
|
98 |
|
|
$16=="" {printf "00"} \
|
99 |
|
|
$15=="" {printf "00"} \
|
100 |
|
|
$14=="" {printf "00"} \
|
101 |
|
|
$13=="" {printf "00"} \
|
102 |
|
|
$12=="" {printf "00"} \
|
103 |
|
|
$11=="" {printf "00"} \
|
104 |
|
|
$10=="" {printf "00"} \
|
105 |
|
|
$9=="" {printf "00"} \
|
106 |
|
|
$8=="" {printf "00"} \
|
107 |
|
|
$7=="" {printf "00"} \
|
108 |
|
|
$6=="" {printf "00"} \
|
109 |
|
|
$5=="" {printf "00"} \
|
110 |
|
|
$4=="" {printf "00"} \
|
111 |
|
|
$3=="" {printf "00"} \
|
112 |
|
|
$2=="" {printf "00"} \
|
113 |
|
|
{print $32 $31 $30 $29 $28 $27 $26 $25 $24 $23 $22 $21 $20 $19 $18 $17 $16 $15 $14 $13 $12 $11 $10 $9 $8 $7 $6 $5 $4 $3 $2 $1 " )," } ' \
|
114 |
|
|
>> $2
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $5 $6}' |\
|
118 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
119 |
|
|
awk '{printf " .SRAM2_INIT_" NR-1 " ( 256%ch", 39 } \
|
120 |
|
|
$31=="" {printf "00"} \
|
121 |
|
|
$30=="" {printf "00"} \
|
122 |
|
|
$29=="" {printf "00"} \
|
123 |
|
|
$28=="" {printf "00"} \
|
124 |
|
|
$27=="" {printf "00"} \
|
125 |
|
|
$26=="" {printf "00"} \
|
126 |
|
|
$25=="" {printf "00"} \
|
127 |
|
|
$24=="" {printf "00"} \
|
128 |
|
|
$23=="" {printf "00"} \
|
129 |
|
|
$22=="" {printf "00"} \
|
130 |
|
|
$21=="" {printf "00"} \
|
131 |
|
|
$20=="" {printf "00"} \
|
132 |
|
|
$19=="" {printf "00"} \
|
133 |
|
|
$18=="" {printf "00"} \
|
134 |
|
|
$17=="" {printf "00"} \
|
135 |
|
|
$16=="" {printf "00"} \
|
136 |
|
|
$15=="" {printf "00"} \
|
137 |
|
|
$14=="" {printf "00"} \
|
138 |
|
|
$13=="" {printf "00"} \
|
139 |
|
|
$12=="" {printf "00"} \
|
140 |
|
|
$11=="" {printf "00"} \
|
141 |
|
|
$10=="" {printf "00"} \
|
142 |
|
|
$9=="" {printf "00"} \
|
143 |
|
|
$8=="" {printf "00"} \
|
144 |
|
|
$7=="" {printf "00"} \
|
145 |
|
|
$6=="" {printf "00"} \
|
146 |
|
|
$5=="" {printf "00"} \
|
147 |
|
|
$4=="" {printf "00"} \
|
148 |
|
|
$3=="" {printf "00"} \
|
149 |
|
|
$2=="" {printf "00"} \
|
150 |
|
|
{print $32 $31 $30 $29 $28 $27 $26 $25 $24 $23 $22 $21 $20 $19 $18 $17 $16 $15 $14 $13 $12 $11 $10 $9 $8 $7 $6 $5 $4 $3 $2 $1 " )," } ' \
|
151 |
|
|
>> $2
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $7 $8}' |\
|
155 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
156 |
|
|
awk '{printf " .SRAM3_INIT_" NR-1 " ( 256%ch", 39 } \
|
157 |
|
|
$31=="" {printf "00"} \
|
158 |
|
|
$30=="" {printf "00"} \
|
159 |
|
|
$29=="" {printf "00"} \
|
160 |
|
|
$28=="" {printf "00"} \
|
161 |
|
|
$27=="" {printf "00"} \
|
162 |
|
|
$26=="" {printf "00"} \
|
163 |
|
|
$25=="" {printf "00"} \
|
164 |
|
|
$24=="" {printf "00"} \
|
165 |
|
|
$23=="" {printf "00"} \
|
166 |
|
|
$22=="" {printf "00"} \
|
167 |
|
|
$21=="" {printf "00"} \
|
168 |
|
|
$20=="" {printf "00"} \
|
169 |
|
|
$19=="" {printf "00"} \
|
170 |
|
|
$18=="" {printf "00"} \
|
171 |
|
|
$17=="" {printf "00"} \
|
172 |
|
|
$16=="" {printf "00"} \
|
173 |
|
|
$15=="" {printf "00"} \
|
174 |
|
|
$14=="" {printf "00"} \
|
175 |
|
|
$13=="" {printf "00"} \
|
176 |
|
|
$12=="" {printf "00"} \
|
177 |
|
|
$11=="" {printf "00"} \
|
178 |
|
|
$10=="" {printf "00"} \
|
179 |
|
|
$9=="" {printf "00"} \
|
180 |
|
|
$8=="" {printf "00"} \
|
181 |
|
|
$7=="" {printf "00"} \
|
182 |
|
|
$6=="" {printf "00"} \
|
183 |
|
|
$5=="" {printf "00"} \
|
184 |
|
|
$4=="" {printf "00"} \
|
185 |
|
|
$3=="" {printf "00"} \
|
186 |
|
|
$2=="" {printf "00"} \
|
187 |
|
|
{print $32 $31 $30 $29 $28 $27 $26 $25 $24 $23 $22 $21 $20 $19 $18 $17 $16 $15 $14 $13 $12 $11 $10 $9 $8 $7 $6 $5 $4 $3 $2 $1 " )," } ' \
|
188 |
|
|
>> $2
|
189 |
|
|
|
190 |
|
|
echo " .UNUSED ( 1'd0 ) " >> $2
|