summaryrefslogtreecommitdiff
path: root/utils/regtools/desc/spec-2.0.txt
diff options
context:
space:
mode:
Diffstat (limited to 'utils/regtools/desc/spec-2.0.txt')
-rw-r--r--utils/regtools/desc/spec-2.0.txt373
1 files changed, 373 insertions, 0 deletions
diff --git a/utils/regtools/desc/spec-2.0.txt b/utils/regtools/desc/spec-2.0.txt
new file mode 100644
index 0000000000..79b9f6be44
--- /dev/null
+++ b/utils/regtools/desc/spec-2.0.txt
@@ -0,0 +1,373 @@
1This file describes the format of the register map based on XML, version 2.0.
2
31) Overview
4-----------
5
61.1) Nodes and instances
7------------------------
8
9This specification is based on the concept of "nodes". Nodes are containers
10which can contain other nodes and/or a register. Each node can have one or more
11addresses (addresses are always relative to the parent node). The idea is that
12this hierarchy of nodes generates a number of addresses recursively. The example
13below outlines this idea:
14
15<node>
16 <name>N</name>
17 <instance>
18 <name>A</name>
19 <address>X</address>
20 </instance>
21 <instance>
22 <name>B</name>
23 <address>Y</address>
24 </instance>
25 <!-- HERE -->
26</node>
27
28This example creates one node named N and two instances named A and B,
29at respective addresses X and Y. This means that all subnodes of this node will
30have two copies: one relative to X, which path will be prefixed by "A", and
31one relative to Y, which path will be prefixed by "B".
32This example below explores this idea in details:
33
34 <!-- HERE -->
35 <node>
36 <name>S_N</name>
37 <instance>
38 <name>C</name>
39 <address>U</address>
40 </instance>
41 <instance>
42 <name>D</name>
43 <address>V</address>
44 </instance>
45 </node>
46
47In this example, N generates two copies of the sub-node S_N.
48The sub-node S_N generates two instances C and D. The whole hierarchy thus generates
49four instances:
50- A.C at X+U
51- A.D at X+V
52- B.C at Y+U
53- B.D at Y+V
54
55As a note for later, notice that there really are two hierarchies in parallel:
56- the node hierarchy: it is composed of N and N.S_N
57- the instance hierarchy: it is made up of A, B, A.C, A.D, B.C and B.D
58
591.2) Ranges
60-----------
61
62To make things more useful, in particular in case of multiple copies of a register,
63we introduce the concept of range addresses with an example:
64
65<node>
66 <name>N</name>
67 <instance>
68 <name>A</name>
69 <range>
70 <first>1</first>
71 <count>5</count>
72 <base>0x1000</base>
73 <stride>0x100</stride>
74 </range>
75 </instance>
76 <node>
77 <name>NN</name>
78 <instance>
79 <name>E</name>
80 <address>0x4</address>
81 </instance>
82 </node>
83</node>
84
85A range describes a contiguous set of adresses, indexed by a number. One can
86specify the first number in the range, and the number of copies. In the case
87of a regular pattern (base + n * stride), we can specify a stride
88to compute the address of the next copy. In this example, the top-level
89nodes generates five copies which path is A[1], A[2], ..., A[5]
90and which addresses are 0x1000+1*0x100, 0x1000+2*0x100, ..., 0x1000+5*0x100.
91If we add the sub-node to the picture, for each copy we create a instance E
92we offset 0x4 from the parent. Overall this generates 5 instances:
93- A[1].E at 0x1000+1*0x100+0x4 = 0x1104
94- A[2].E at 0x1000+2*0x100+0x4 = 0x1204
95- A[3].E at 0x1000+3*0x100+0x4 = 0x1304
96- A[4].E at 0x1000+4*0x100+0x4 = 0x1404
97- A[5].E at 0x1000+5*0x100+0x4 = 0x1504
98Note that the intermediate path also define instances, so there are 5 additional
99instances in reality:
100- A[1] at 0x1100
101- A[2] at 0x1200
102- A[3] at 0x1300
103- A[4] at 0x1400
104- A[5] at 0x1500
105
106For the record, there is a more general way of specifying a range when it does
107not follow a nice regular pattern. One can specify a formula where the parameter
108is the index. There are no restrictions on the formula except that it must use
109usual arithmetic operators. The example below illustrate such a use:
110
111<node>
112 <name>N</name>
113 <instance>
114 <name>F</name>
115 <range>
116 <first>0</first>
117 <count>4</count>
118 <formula variable="n">0x50+(n/2)*0x100+(n%2)*0x10</formula>
119 </range>
120 </instance>
121</node>
122
123In this example we generate four nodes F[0], ..., F[3] with a formula. Here "/"
124is the euclidian division and "%" is the modulo operator. Note the use of an
125attribute to specify which variable represents the index. The generated addresses
126are:
127- F[0] at 0x50+(0/2)*0x100+(0%2)*0x10 = 0x50
128- F[1] at 0x50+(1/2)*0x100+(1%2)*0x10 = 0x50+0x10 = 0x60
129- F[2] at 0x50+(2/2)*0x100+(2%2)*0x10 = 0x50+0x100 = 0x150
130- F[3] at 0x50+(3/2)*0x100+(3%2)*0x10 = 0x50+0x100+0x10 = 0x160
131
1321.3) Node description
133---------------------
134
135For documentation purposes, node can of course carry some description, as well
136as instances. More precisely, nodes can have a title, that is a short description
137very much like a chapter title, and a description, this is a free form and potentially
138lengthy description of the node. Instances too can have a title and a description.
139The following example illustrates this:
140
141<node>
142 <name>icoll</name>
143 <title>DMA Controller</title>
144 <desc>The DMA controller provides uniform DMA facilities to transfer data from
145 and to peripherals. It uses memory-mapped tables and support chained
146 transfers.</desc>
147 <instance>
148 <name>AHB_DMAC</name>
149 <address>0x80000000</address>
150 <title>AHB DMA Controller</title>
151 <desc>The AHB DMA controller provides DMA facilities for the peripherals
152 on the AHB bus like the SSP and PIX engines.</desc>
153 </instance>
154 <instance>
155 <name>APB_DMAC</name>
156 <address>0x8001000</address>
157 <title>APB DMA Controller</title>
158 <desc>The APB DMA controller provides DMA facilities for the peripherals
159 on the APB bus like the I2C and PCM engines.</desc>
160 </instance>
161</node>
162
1631.4) Register description
164--------------------------
165
166The goal of the register description is of course to describe registers!
167To see how registers relate to the node hierarchy, see 1.5, this section focuses
168only the description only.
169
170A register carries a lot of information, which is organise logically. A register
171can have a width, in bits. By default registers are assumed to be 32-bit wide.
172The most useful feature of register description is to describe the fields of
173the registers. Each field has a name, a start position and a width. Fields
174can also carry a description. Finally, each field can specify enumerated values,
175that is named values, for convenience. Enumerated values have a name, a value
176and an optional description. The example below illustrates all these concepts:
177
178<register>
179 <width>8</width>
180 <field>
181 <name>MODE</name>
182 <desc>Interrupt mode</desc>
183 <position>0</position>
184 <width>2</width>
185 <enum>
186 <name>DISABLED</name>
187 <desc>Interrupt is disabled</desc>
188 <value>0</value>
189 </enum>
190 <enum>
191 <name>ENABLED</name>
192 <desc>Interrupt is enabled</desc>
193 <value>1</value>
194 </enum>
195 <enum>
196 <name>NMI</name>
197 <desc>Interrupt is non-maskable</desc>
198 <value>2</value>
199 </enum>
200 </field>
201 <field>
202 <name>PRIORITY</name>
203 <desc>Interrupt priority, lower values are more prioritized.</desc>
204 <position>2</position>
205 <width>2</width>
206 </field>
207 <field>
208 <name>ARM_MODE</name>
209 <desc>Select between ARM's FIQ and IRQ mode</desc>
210 <position>4</position>
211 <width>1</width>
212 <enum>
213 <name>IRQ</name>
214 <value>0</value>
215 </enum>
216 <enum>
217 <name>FIQ</name>
218 <value>1</value>
219 </enum>
220 </field>
221</register>
222
223In this example, the 8-bit registers has three fields:
224- MODE(1:0): it has three named values DISABLED(0), ENABLED(1) and NMI(2)
225- PRIORITY(2:1): it has no named values
226- ARM_MODE(3): it has two named values IRQ(0) and FIQ(1)
227
2281.5) Register inheritance
229-------------------------
230
231The node hierarchy specifies instances, that is pairs of (path,address),
232and the register description describes the internal of a register. The placement
233of the register descriptions in the node hierarchy will specify which registers
234can be found at each address. More precisely, if a node contains a register
235description, it means that this node's and all sub-nodes' instances are registers
236following the description. It is forbidden for a node to contain a register
237description if one of its parents already contains one. The example below
238will make this concept clearer (for readability, we omitted some of the tags):
239
240<node>
241 <name>dma</name>
242 <instance><name>DMAC</name><address>0x80000000</address></instance>
243 <node>
244 <instance><name>PCM_CHAN</name><address>0x0</address></instance>
245 <instance><name>I2C_CHAN</name><address>0x10</address></instance>
246 <register><!--- blabla --></register>
247 <node>
248 <name>sct</name>
249 <instance><name>SET</name><address>0x4</address></instance>
250 <instance><name>CLR</name><address>0x8</address></instance>
251 <instance><name>TOG</name><address>0xC</address></instance>
252 </node>
253 </node>
254</node>
255
256This example describes one register (let's call it blabla) and 9 instances:
257- DMAC at 0x80000000, no register
258- DMAC.PCM_CHAN at 0x80000000, register blabla
259- DMAC.PCM_CHAN.SET at 0x80000004, register blabla
260- DMAC.PCM_CHAN.CLR at 0x80000008, register blabla
261- DMAC.PCM_CHAN.TOG at 0x8000000C, register blabla
262- DMAC.I2C_CHAN at 0x80000010, register blabla
263- DMAC.I2C_CHAN.SET at 0x80000014, register blabla
264- DMAC.I2C_CHAN.CLR at 0x80000018, register blabla
265- DMAC.I2C_CHAN.TOG at 0x8000001C, register blabla
266
2671.6) Soc description
268--------------------
269
270The description file must also specify some information about the system-on-chip
271itself. The entire description, including nodes, is contained in a "soc" tag
272which must at least specify the soc name. It can optionally specify the title
273and description, as well as the author(s) of the description, the ISA and
274the version.
275
276<soc>
277 <name>vsoc</name>
278 <title>Virtual SOC</title>
279 <desc>Virtual SoC is a nice and powerful chip.</desc>
280 <author>Amaury Pouly</author>
281 <isa>ARM</isa>
282 <version>0.5</version>
283 <!-- put nodes below -->
284</soc>
285
2862) Specification
287----------------
288
289Root
290----
291As any XML document, the content of the file should be enclosed in a "xml" tag.
292The root element must be "soc" tag.
293
294Example:
295<?xml version="1.0"?>
296<!-- desc -->
297</xml>
298
299Element: soc
300------------
301It must contain the following tags:
302- name: name of soc, only made of alphanumerical characters
303It can contain at most one of each of the following tags:
304- title: one line description of the soc
305- desc: free form description of the soc
306- isa: instruction set assembly
307- version: version of the description
308It can contain any number of the following tags:
309- author: author of the description
310- node: node description
311
312Element: node
313-------------
314It must contain the following tags:
315- name: name of node, only made of alphanumerical characters
316It can contain at most one of each of the following tags:
317- title: one line description of the node
318- desc: free form description of the node
319- register: register description
320It can contain any number of the following tags:
321- instance: author of the description
322- node: node description
323
324Element: instance
325-----------------
326It must contain the following tags:
327- name: name of instance, only made of alphanumerical characters
328It can contain at most one of each of the following tags:
329- title: one line description of the instance
330- desc: free form description of the instance
331- address: address for a single instance (non-negative number)
332- range: address range for multiple instances
333Note that address and range are mutually exclusive, and at least one of them
334must exists.
335
336Element: range
337--------------
338It must contain the following tags:
339- first: index of the first instance (non-negative number)
340- count: number of instances (positive number)
341It can contain at most one of each of the following tags:
342- base: base address (non-negative number)
343- stride: stride (number)
344- formula: free-form formula, must have a "variable" attribute
345Note that stride and formula are mutually exclusive, and at least one of them
346must exists. If stride is specified and base is omitted, it is taken to be 0.
347
348Element: register
349-----------------
350It can contain at most one of each of the following tags:
351- width: width in bits (positive number)
352It can contain any number of the following tags:
353- field: field description
354
355Element: field
356--------------
357It must contain the following tags:
358- name: name of field, only made of alphanumerical characters
359- position: least significant bit
360It can contain at most one of each of the following tags:
361- desc: free form description of the instance
362- width: width in bits
363It can contain any number of the following tags:
364- enum: enumerated value
365If the width is not specified, it is assumed to be 1.
366
367Element: enum
368-------------
369It must contain the following tags:
370- name: name of field, only made of alphanumerical characters
371- value: value (non-negative, must fit into the field's width)
372It can contain at most one of each of the following tags:
373- desc: free form description of the instance \ No newline at end of file