Imported Upstream version 2.9.0
[debian/cc1111] / sim / ucsim / doc / memory.html
1 <html>
2 <head>
3 <title>Memory simulation in &micro;Csim</title>
4 </head>
5
6 <body>
7
8 <h1>Memory simulation in &micro;Csim</h1>
9
10 Typical microprocessor system can look like this:
11  
12 <p><img src="cpu-mem.gif" border="0" alt="[CPU-memory connection]">
13
14
15 <a name="address_space"><h3>Address space</h3></a>
16
17 In our terminilogy "<b>address space</b>" means a set of:
18
19 <ul><li>address bus lines
20
21 <li>data bus lines
22
23 <li>control (read/write) lines</ul>
24
25 Bus lines can be shared by address spaces, in this case number of
26 control line sets specifies the address spaces.
27
28 <p>Microcontrollers usually have more address spaces. Some is used
29 inside only, some can be used for external memories.
30
31 <p>Address space does not store any value. It just specifies range of
32 addresses by <i>start address</i> (which is not necessarily zero) and
33 <i>size</i> which the CPU can provide when it tries to access a memory
34 location.
35
36
37 <a name="chip"><h3>Memory chip</h3></a>
38
39 "<b>Memory chip</b>" is a circuit which can hold values in
40 cells. Cells are indexed from 0 up to size-1. Each cell stores some
41 (usually 8) bits.
42
43 <p><img src="chip.gif" border="0" alt="[Memory chip]">
44
45
46 <a name="address_decoder"><h3>Address decoder</h3></a>
47
48 Addresses coming from an address space via address bus must be routed
49 to memory and translated to cell indexes. This is done by the
50 "<b>address decoder</b>". It listens addresses on the bus and control
51 lines and enables exactly one memory chip. This way cells of the
52 memory chip appear in the address space.
53
54 <p><img src="decoded.gif" boder="0" alt="[Decoded addresses]">
55
56 <p>It is possible that some addresses are not decoded. Writing to such
57 an address results data to be lost. Reading of a non-decoded address
58 results random value. Pullup or pulldown resistors can be applied to
59 data bus lines to provide a specific value for read operations.
60
61 <p>As it shown above, it is also possible that some cells of a chip is
62 not mapped to any address.
63
64
65 <h3>Mixed address spaces (shared chips)</h3>
66
67 Decoder connects an address of an address space to a cell of a memory
68 chip. Only one cell can be connected to each addresses but same cell
69 can be connected to more than one address spaces. This is done by
70 routing different control lines to the same chip through logic <b>L</b>:
71
72 <p><img src="share-chip.gif" border="0" alt="[Sharing memchip]">
73
74 <p>Because each cell of a memory chip uses same read/write control, in
75 real world it is not possible to share individual cells of a chip
76 between address spaces. In &micro;Csim simulator we can define as many
77 address decoders as we want so it is possible to map any cell to any
78 address.
79
80 <hr>
81
82 </body>
83 </html>