summaryrefslogtreecommitdiff
path: root/sim/ucsim/docs/cmd_memory.html
blob: 21301d5d64a6b5bd52c4c441d1c856da8fd341a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-2">
    <title>Memory manipulation commands of &micro;Csim</title>
  </head>
  <body style="           background-color: white;">
    <h2>Memory manipulation commands of &micro;Csim</h2>
    Every command which changes content of ROM area such as <b><a href="#dl">dl</a></b>
    or <b><a href="cmd_general#set_memory">set memory</a></b> deletes result of
    <a href="analyzer.html">code analyser</a> and causes to re-analyse the code.
    <hr> <a name="file">
      <h3>file,load <i>"file"</i></h3>
    </a> Loads file named file into the simulated code memory. File must contain
    data in Intel HEX format.
    <pre>&gt; <font color="#118811">file "../../remo.hex"</font>
55470 words read from ../../remo.hex
&gt; 
</pre> Don't forget to enclose file name in quotes to make the parameter to be a
    string.
    <hr> <a name="dl">
      <h3>download,dl</h3>
    </a> Download command. It is same as <a href="#l">load</a> above but it
    reads information from command console which is standard input by default.
    This command stops read records when it detects an "END" record which is
    normally the last record. This command has two equivalent forms <b>download</b>
    and <b>dl</b>.
    <pre>$ <font color="#118811">ucsim_51 -V</font>
ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
&gt; <font color="#118811">do
:03000000020003F8
:1000030075812078207600D8FC900000AE83AF8203
:100013009000001200416005E4F0A380F690009F79
:1000230012004A9000A312004A9000A712006890A1
:1000330000AD12006875D0001200B50200B3EF6581
:10004300827003EE658322E493F8740193F97402DA
:1000530093FE740393F5828E83E869700122E4931F
:10006300F6A30880F4E493FC740193FD740293FEF9
:10007300740393FF740493F8740593F582888312D1
:100083000041700122E493A3A883A9828C838D820B
:10009300F0A3AC83AD828883898280E3212100B5FC
:1000A300212100B5000000B500B5000000B500B582
:0200B30080FECD
:1000B5007520117501AA850120750102850120228F
:00000001FF</font>
197 bytes loaded
&gt; </pre>
    <hr> <a name="fill">
      <h3>fill <i>memory_type start end data</i></h3>
    </a> Fill memory region with specified data. First parameter specifies
    memory. Name of the memory must be used, it can be checked using <a href="cmd_general.html#info_memory">info
      memory</a> command which lists size and name of all available memories.
    <p><b>start</b> and <b>end</b> parameters specify first and last address of
      the memory region to be filled. </p>
    <p><b>data</b> parameter specifies the data which is used to fill the memory
      region. </p>
    <pre>$ <font color="#118811">ucsim_51</font> 
ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
&gt; <font color="#118811">fill xram 12 0x12 0x56</font>
&gt; <font color="#118811">dump xram 0 0x20</font>
0x0000 00 00 00 00 00 00 00 00 ........
0x0008 00 00 00 00 56 56 56 56 ....VVVV
0x0010 56 56 56 00 00 00 00 00 VVV.....
0x0018 00 00 00 00 00 00 00 00 ........
0x0020 00                      .
&gt; </pre>
    <hr> <a name="where">
      <h3>where,Where <i>memory_type data...</i></h3>
    </a> Searching for some data in memory. First parameter specifies memory.
    Name of the memory must be used, it can be checked using <a href="cmd_general.html#info_memory">info
      memory</a> command which lists size and name of all available memories.
    <p>Other parameters can be mixed list of strings (characters between " and
      ") and numbers. Strings can contain escape sequences. &micro;Csim merges all
      parameters together and will search for merged list of values in specified
      memory. </p>
    <p><b>where</b> command do case unsensitive search while <b>Where</b>
      command is for case sensitive search. </p>
    <p>Search is done in whole memory and all matches are dumped out. </p>
    <pre>$ <font color="#118811">ucsim_51</font>
ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
&gt; <font color="#118811">set mem xram 20 "Dani d ani D ani dani Dani"</font>
0x0014 44 61 6e 69 20 64 20 61 Dani d a
0x001c 6e 69 20 44 20 61 6e 69 ni D ani
0x0024 20 64 61 6e 69 20 44 61  dani Da
0x002c 6e 69                   ni
&gt; <font color="#118811">where xram "dani"</font>
0x0014 44 61 6e 69             Dani
0x0025 64 61 6e 69             dani
0x002a 44 61 6e 69             Dani
&gt; <font color="#118811">Where xram "d ani"</font>
0x0019 64 20 61 6e 69          d ani
&gt; </pre>
    <hr> <a name="hole">
      <h3>hole <i>[memory [length [value]]]</i></h3>
    </a>
    <p>Searching for a memory area where all locations are filled with value. By
      default this command searches rom but any memory can be specified. Areas
      shorter than specified length (default is 100) will not be listed.
      Searched value is 0 (zero) by default but other can be specified as the
      last parameter. </p>
    <pre>$ <font color="#118811">ucsim_51</font>
uCsim 0.6-pre55, Copyright (C) 1997 Daniel Drotos.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
0&gt; hole
0x0000 65535
0&gt; <font color="#118811">hole xram</font>
0&gt; <font color="#118811">fill xram 0x100 0x1ff 11</font>
0&gt; <font color="#118811">hole xram 50 11</font>
0x0100 255
0&gt; <font color="#118811">fill xram 0x500 0x600 11</font>
0&amp;ht; <font color="#118811">hole xram 50 11</font>    
0x0100 255
0x0500 256
0&gt; <font color="#118811">rom[0x200]=1</font>
1
0&gt; <font color="#118811">hole</font>
0x0000 511
0x0201 65022
0&gt; </pre>
    <p> Data of found areas are listed in two columns. First column is the start
      address of the area in hexadecimal and the second column is area length
      (in decimal). </p>
    <hr> <a name="memory">
      <h3>memory</h3>
    </a> This set of commands can be used to manipulate <a href="memory.html">memory
      system</a> including <a href="memory.html#chip">chips</a>, <a href="memory.html#address_space">address
      spaces</a> and <a href="memory.html#address_decoder">address decoders</a>.
    <p>Subcommands are: </p>
    <p><a href="#memory_create">memory create</a><br>
      <a href="#memory_remove">memory remove</a><br>
      <a href="#memory_info">memory info</a><br>
      memory cell</p>
    <a name="memory_create">
      <h3>memory create</h3>
    </a>
    <p>This set of commands can be used to create new memory objects. It
      requires a subcommand, which can be:</p>
    <p><a href="#memory_create_chip">memory create chip</a><br>
      <a href="#memory_create_addressspace">memory create addressspace</a><br>
      <a href="#memory_create_addressdecoder">memory create addressdecoder</a><br>
      <a href="#memory_create_banker">memory create banker</a><br>
      <a href="#memory_create_bank">memory create bank</a><br>
      <a href="#memory_create_bander">memory create bander</a></p>
    <p><a name="memory_createchip"></a></p>
    <blockquote><a name="memory_createchip"> </a><a name="memory_create_chip">
        <h4>memory create chip <i>id size cellsize</i></h4>
      </a> This command creates a chip (array of storage elements). <b>id</b>
      must be a unique name which will be used to identify the chip in other
      commands. <b>size</b> is number of storage elements, <b>cellsize</b> is
      number of bits stored in one element.
      <hr> <a name="memory_create_addressspace">
        <h4>memory create as|addressspace|addr|addrs|addrspace|aspace <i>id
            startaddr size</i></h4>
      </a> This command should never be used. It defines an address space, names
      it as <b>id</b>, sets its starting address and size. Simulator programs (<b>ucsim_51</b>,
      <b>ucsim_avr</b>, etc.) define necessary address spaces for themself, so
      this command is not needed.
      <hr> <a name="memory_create_addressdecoder">
        <h4>memory create
          ad|addrdec|addrdecoder|addressdec|addressdecoder|adec|adecoder <i>addressspace
            begin end chip begin</i></h4>
      </a> Address decoder maps a part of the address space to a chip area. <b>addressspace</b>
      parameter is name of the address space, <b>begin</b> and <b>end</b>
      specify address range of the address space to be mapped. <b>chip</b>
      parameter is name of the memory chip and the second <b>begin</b>
      parameter is the (start of the) chip address where the area is mapped to.
      <p>Address space will be split if a "middle" area is mapped: </p>
      <pre>$ <font color="#118811">ucsim_51</font>
uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
0&gt; <font color="#118811">i m</font>
Memory chips:
  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
Address spaces:
  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
Address decoders:
 0 rom 0x0000 0xffff -&gt; rom_chip 0x0000 activated
 0 iram 0x00 0x7f -&gt; iram_chip 0x00 activated
 0 sfr 0x80 0xff -&gt; sfr_chip 0x00 activated
 0 xram 0x0000 0xffff -&gt; xram_chip 0x0000 activated
0&gt; <font color="#118811">mem cchip myram 0x1000 8</font>
0&gt; <font color="#118811">mem createaddressdecoder xram 1234 2000 myram 15</font>
0&gt; <font color="#118811">i m</font>
Memory chips:
  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
  0x000000-0x000fff     4096 myram (8,%02x,0x%03x)
Address spaces:
  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
Address decoders:
 0 rom 0x0000 0xffff -&gt; rom_chip 0x0000 activated
 0 iram 0x00 0x7f -&gt; iram_chip 0x00 activated
 0 sfr 0x80 0xff -&gt; sfr_chip 0x00 activated
 0 xram 0x0000 0x04d1 -&gt; xram_chip 0x0000 activated
 1 xram 0x04d2 0x07d0 -&gt; myram 0x00f activated
 2 xram 0x07d1 0xffff -&gt; xram_chip 0x07d1 activated
0&gt; 
</pre> It is easy to share chip area between address spaces:
      <pre>$ <font color="#118811">ucsim_51</font>
uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
0&gt; <font color="#118811">mem createaddressdecoder rom 0 0xfff xram_chip 0xf000</font>
0&gt; <font color="#118811">i m</font>
Memory chips:
  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
Address spaces:
  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
Address decoders:
 0 rom 0x0000 0x0fff -&gt; xram_chip 0xf000 activated
 1 rom 0x1000 0xffff -&gt; rom_chip 0x1000 activated
 0 iram 0x00 0x7f -&gt; iram_chip 0x00 activated
 0 sfr 0x80 0xff -&gt; sfr_chip 0x00 activated
 0 xram 0x0000 0xffff -&gt; xram_chip 0x0000 activated
0&gt; <font color="#118811">rom[0]=0xab</font>
171
0&gt; <font color="#118811">xram[0xf000]</font>
171
0&gt; 
</pre>
<hr>

<a name="memory_create_banker"><h4>memory create banker <i>switcher_addressspace
  switcher_address switcher_mask banked_addressspace start end</i></h4></a>

      This command creates a "banker", which is a controllable dynamic
      address decoder. This means that some part of an address space
      can be mapped to different chips and the actual map is
      controlled by a memory location.<br>
      
      This command specifies the range of the address space and the control.<br>
      Following parameters specify the controller:<br>
      
      <ul>
        <li><b>switcher_addressspace</b> address space where the controller
          memory location is.</li>
        <li><b>switcher_address</b> address of the controller.</li>
        <li><b>switcher_mask</b> mask of the bits which select a chip. This
          parameter specifies, how many banks will be used, so how many chips
          will be needed. </li>
      </ul>

      Following parameters specify the address space and range which
      is covered by this address decoder:<br>
      
      <ul>
        <li><b>banked_asddressspace</b> name of the address space which will be
          banked.</li>
        <li><b>start</b> start address of the area, and</li>
        <li><b>end</b> end address of the area which will be banked.</li>
      </ul>
      
      <hr>

      <a name="memory_create_bank">
        <h4>memory create bank <i>addressspace begin bank_nr chip begin</i></h4>
      </a>

      Define a bank. This command can be used to map a specified
      bank of a banked area to a specific storage (chip). <b>addressspace</b>
      parameter must be the name of the address space, <b>begin</b> must
      be the same start address what used in banked space creation. <b>bank_nr</b> specifies the number of the bank, <b>chip</b> and following <b>begin</b> defaines
      actual storage of the bank.

      <p>This command should be repeated several times to specify
      storage for all banks. Number of banks depends on <b>switcher_mask</b> parameter, used in <a href="#memory_create_banker">memory create banker</a> command.
      
      <hr>

      <a name="memory_create_bander">
        <h4>memory create bander <i>addressspace begin end chip begin
          bits_per_chip [distance]</i></h4>
	
      </a> Bander.

    </blockquote>

    <hr>

    <a name="memory_remove">
      <h3>memory remove|rm|del</h3>
    </a>

    This set of commands can be used to remove some memory object. It
    requires a subcommand, which can be:

    <p><a href="#memory_remove_chip">memory remove chip</a> </p>

    <blockquote>
      
      <a name="memory_remove_chip">
        <h4>memory remove chip <i>id</i></h4>
      </a>

      This command deletes the specified memory chip from the
      simulator. All address decoders that points to this chip will be
      deleted too.
      
    </blockquote>

    <hr>

    <a name="memory_info">
      <h3>memory info</h3>
    </a> This command is same as <a href="cmd_general.html#info_memory">info
      memory</a>.
    
    <hr>

    <a name="var">
      <h3>var name [memory addr]</h3>
    </a>

    This command assigns a name to a memory location. This name can be used
    in <a href="cmd_general.html#expression">expression</a>s as variable. If
    memory is not specified, next yet unnamed location will be used from a
    special address space, called <b>variables</b>. This address space have 256
    locations by default (32 bit each), but the size can be specified using <a
      href="invoke.html">-a option</a> of the simulator program.

    <pre>0&gt; <font color="#118811">var abc</font>
0&gt; <font color="#118811">i v abc</font>
abc variables[0x00] = 00000000
0&gt; <font color="#118811">abc=12</font>
12
0&gt; <font color="#118811">expr /b abc</font>
00000000000000000000000000001100
0&gt; 
    </pre>

    Memory location can be specified in two forms:

    <pre>0&gt; <font color="#118811">var vname rom 45</font>
0&gt; <font color="#118811">i var vname</font>
vname rom[0x002d] = 73d4d3c4
0&gt; <font color="#118811">var other rom[45]</font>
0&gt; <font color="#118811">i v other</font>
other rom[0x002d] = 73d4d3c4
0&gt;
    </pre>

    <hr> <a name="var">
      <h3>rmvar name</h3>
    </a> This command removes a variable.
    <pre>0&gt; <font color="#118811">rmvar abc</font>
No such variable
    </pre>
  </body>
</html>