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 |
61 |
csantifort |
awk '{ if (NR<=64) { printf " .SRAM0_INIT_" NR-1 " ( 256%ch", 39 } \
|
46 |
|
|
else if (NR<=128) { printf " .SRAM4_INIT_" NR-65 " ( 256%ch", 39 }} \
|
47 |
|
|
$32=="" {printf "00"} \
|
48 |
2 |
csantifort |
$31=="" {printf "00"} \
|
49 |
|
|
$30=="" {printf "00"} \
|
50 |
|
|
$29=="" {printf "00"} \
|
51 |
|
|
$28=="" {printf "00"} \
|
52 |
|
|
$27=="" {printf "00"} \
|
53 |
|
|
$26=="" {printf "00"} \
|
54 |
|
|
$25=="" {printf "00"} \
|
55 |
|
|
$24=="" {printf "00"} \
|
56 |
|
|
$23=="" {printf "00"} \
|
57 |
|
|
$22=="" {printf "00"} \
|
58 |
|
|
$21=="" {printf "00"} \
|
59 |
|
|
$20=="" {printf "00"} \
|
60 |
|
|
$19=="" {printf "00"} \
|
61 |
|
|
$18=="" {printf "00"} \
|
62 |
|
|
$17=="" {printf "00"} \
|
63 |
|
|
$16=="" {printf "00"} \
|
64 |
|
|
$15=="" {printf "00"} \
|
65 |
|
|
$14=="" {printf "00"} \
|
66 |
|
|
$13=="" {printf "00"} \
|
67 |
|
|
$12=="" {printf "00"} \
|
68 |
|
|
$11=="" {printf "00"} \
|
69 |
|
|
$10=="" {printf "00"} \
|
70 |
|
|
$9=="" {printf "00"} \
|
71 |
|
|
$8=="" {printf "00"} \
|
72 |
|
|
$7=="" {printf "00"} \
|
73 |
|
|
$6=="" {printf "00"} \
|
74 |
|
|
$5=="" {printf "00"} \
|
75 |
|
|
$4=="" {printf "00"} \
|
76 |
|
|
$3=="" {printf "00"} \
|
77 |
|
|
$2=="" {printf "00"} \
|
78 |
|
|
{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 " )," } ' \
|
79 |
|
|
> $2
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $3 $4}' |\
|
83 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
84 |
61 |
csantifort |
awk '{ if (NR<=64) { printf " .SRAM1_INIT_" NR-1 " ( 256%ch", 39 } \
|
85 |
|
|
else if (NR<=128) { printf " .SRAM5_INIT_" NR-65 " ( 256%ch", 39 }} \
|
86 |
|
|
$32=="" {printf "00"} \
|
87 |
2 |
csantifort |
$31=="" {printf "00"} \
|
88 |
|
|
$30=="" {printf "00"} \
|
89 |
|
|
$29=="" {printf "00"} \
|
90 |
|
|
$28=="" {printf "00"} \
|
91 |
|
|
$27=="" {printf "00"} \
|
92 |
|
|
$26=="" {printf "00"} \
|
93 |
|
|
$25=="" {printf "00"} \
|
94 |
|
|
$24=="" {printf "00"} \
|
95 |
|
|
$23=="" {printf "00"} \
|
96 |
|
|
$22=="" {printf "00"} \
|
97 |
|
|
$21=="" {printf "00"} \
|
98 |
|
|
$20=="" {printf "00"} \
|
99 |
|
|
$19=="" {printf "00"} \
|
100 |
|
|
$18=="" {printf "00"} \
|
101 |
|
|
$17=="" {printf "00"} \
|
102 |
|
|
$16=="" {printf "00"} \
|
103 |
|
|
$15=="" {printf "00"} \
|
104 |
|
|
$14=="" {printf "00"} \
|
105 |
|
|
$13=="" {printf "00"} \
|
106 |
|
|
$12=="" {printf "00"} \
|
107 |
|
|
$11=="" {printf "00"} \
|
108 |
|
|
$10=="" {printf "00"} \
|
109 |
|
|
$9=="" {printf "00"} \
|
110 |
|
|
$8=="" {printf "00"} \
|
111 |
|
|
$7=="" {printf "00"} \
|
112 |
|
|
$6=="" {printf "00"} \
|
113 |
|
|
$5=="" {printf "00"} \
|
114 |
|
|
$4=="" {printf "00"} \
|
115 |
|
|
$3=="" {printf "00"} \
|
116 |
|
|
$2=="" {printf "00"} \
|
117 |
|
|
{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 " )," } ' \
|
118 |
|
|
>> $2
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $5 $6}' |\
|
122 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
123 |
61 |
csantifort |
awk '{ if (NR<=64) { printf " .SRAM2_INIT_" NR-1 " ( 256%ch", 39 } \
|
124 |
|
|
else if (NR<=128) { printf " .SRAM6_INIT_" NR-65 " ( 256%ch", 39 }} \
|
125 |
|
|
$32=="" {printf "00"} \
|
126 |
2 |
csantifort |
$31=="" {printf "00"} \
|
127 |
|
|
$30=="" {printf "00"} \
|
128 |
|
|
$29=="" {printf "00"} \
|
129 |
|
|
$28=="" {printf "00"} \
|
130 |
|
|
$27=="" {printf "00"} \
|
131 |
|
|
$26=="" {printf "00"} \
|
132 |
|
|
$25=="" {printf "00"} \
|
133 |
|
|
$24=="" {printf "00"} \
|
134 |
|
|
$23=="" {printf "00"} \
|
135 |
|
|
$22=="" {printf "00"} \
|
136 |
|
|
$21=="" {printf "00"} \
|
137 |
|
|
$20=="" {printf "00"} \
|
138 |
|
|
$19=="" {printf "00"} \
|
139 |
|
|
$18=="" {printf "00"} \
|
140 |
|
|
$17=="" {printf "00"} \
|
141 |
|
|
$16=="" {printf "00"} \
|
142 |
|
|
$15=="" {printf "00"} \
|
143 |
|
|
$14=="" {printf "00"} \
|
144 |
|
|
$13=="" {printf "00"} \
|
145 |
|
|
$12=="" {printf "00"} \
|
146 |
|
|
$11=="" {printf "00"} \
|
147 |
|
|
$10=="" {printf "00"} \
|
148 |
|
|
$9=="" {printf "00"} \
|
149 |
|
|
$8=="" {printf "00"} \
|
150 |
|
|
$7=="" {printf "00"} \
|
151 |
|
|
$6=="" {printf "00"} \
|
152 |
|
|
$5=="" {printf "00"} \
|
153 |
|
|
$4=="" {printf "00"} \
|
154 |
|
|
$3=="" {printf "00"} \
|
155 |
|
|
$2=="" {printf "00"} \
|
156 |
|
|
{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 " )," } ' \
|
157 |
|
|
>> $2
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
grep '@' $1 | awk '{print $2}' | awk -F '' '{print $7 $8}' |\
|
161 |
|
|
paste -d" " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | \
|
162 |
61 |
csantifort |
awk '{ if (NR<=64) { printf " .SRAM3_INIT_" NR-1 " ( 256%ch", 39 } \
|
163 |
|
|
else if (NR<=128) { printf " .SRAM7_INIT_" NR-65 " ( 256%ch", 39 }} \
|
164 |
|
|
$32=="" {printf "00"} \
|
165 |
2 |
csantifort |
$31=="" {printf "00"} \
|
166 |
|
|
$30=="" {printf "00"} \
|
167 |
|
|
$29=="" {printf "00"} \
|
168 |
|
|
$28=="" {printf "00"} \
|
169 |
|
|
$27=="" {printf "00"} \
|
170 |
|
|
$26=="" {printf "00"} \
|
171 |
|
|
$25=="" {printf "00"} \
|
172 |
|
|
$24=="" {printf "00"} \
|
173 |
|
|
$23=="" {printf "00"} \
|
174 |
|
|
$22=="" {printf "00"} \
|
175 |
|
|
$21=="" {printf "00"} \
|
176 |
|
|
$20=="" {printf "00"} \
|
177 |
|
|
$19=="" {printf "00"} \
|
178 |
|
|
$18=="" {printf "00"} \
|
179 |
|
|
$17=="" {printf "00"} \
|
180 |
|
|
$16=="" {printf "00"} \
|
181 |
|
|
$15=="" {printf "00"} \
|
182 |
|
|
$14=="" {printf "00"} \
|
183 |
|
|
$13=="" {printf "00"} \
|
184 |
|
|
$12=="" {printf "00"} \
|
185 |
|
|
$11=="" {printf "00"} \
|
186 |
|
|
$10=="" {printf "00"} \
|
187 |
|
|
$9=="" {printf "00"} \
|
188 |
|
|
$8=="" {printf "00"} \
|
189 |
|
|
$7=="" {printf "00"} \
|
190 |
|
|
$6=="" {printf "00"} \
|
191 |
|
|
$5=="" {printf "00"} \
|
192 |
|
|
$4=="" {printf "00"} \
|
193 |
|
|
$3=="" {printf "00"} \
|
194 |
|
|
$2=="" {printf "00"} \
|
195 |
|
|
{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 " )," } ' \
|
196 |
|
|
>> $2
|
197 |
|
|
|
198 |
|
|
echo " .UNUSED ( 1'd0 ) " >> $2
|