annotate doc/utils.rst @ 394:988f3fb861e4

c3 code generator rewrite
author Windel Bouwman
date Thu, 22 May 2014 08:14:12 +0200
parents 6df89163e114
children
rev   line source
310
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
1
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
2 Utilities
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
3 =========
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
4
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
5 Hexfile manipulation
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
6 --------------------
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
7
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
8
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
9 .. autoclass:: utils.HexFile
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
10
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
11
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
12 >>> from utils import HexFile
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
13 >>> h = HexFile()
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
14 >>> h.dump()
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
15 Hexfile containing 0 bytes
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
16 >>> h.addRegion(0, bytes([1,2,3]))
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
17 >>> h
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
18 Hexfile containing 3 bytes
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
19
e95e5572cd6d Added utils doc page
Windel Bouwman
parents:
diff changeset
20
319
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
21 Yacc
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
22 ----
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
23
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
24 .. automodule:: yacc
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
25
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
26
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
27 Burg
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
28 ----
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
29
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
30 .. automodule:: pyburg
8d07a4254f04 Work on burg
Windel Bouwman
parents: 310
diff changeset
31
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
32
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
33 Machine descriptions
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
34 --------------------
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
35
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
36 There are some attempts made already to describe machines in a Domain
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
37 Specific Language (DSL). Examples of these are:
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
38 - Tablegen (llvm)
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
39 - cgen (gnu)
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
40 - LISA (Aachen)
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
41 - nML (Berlin)
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
42 - SLED (Specifying representations of machine instructions (norman ramsey and Mary F. Fernandez))
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
43
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
44
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
45 The goal of a machine description file is to describe a file and generate
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
46 tools like assemblers, disassemblers, linkers, debuggers and simulators.
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
47
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
48 Advantage of using this approach is that porting these tools is a semi automated
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
49 process. Rewriting all of these tools from scratch is tedious and errorprone.
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
50
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
51 Concepts to use in this language:
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
52 - Single stream of instructions
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
53 - State stored in memory
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
54 - Pipelining
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
55 - Instruction semantics
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
56
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
57 Each instruction has the following properties:
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
58 - Bit representation
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
59 - Assembly language representation
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
60 - Semantic action
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
61
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
62 Optionally a description in terms of compiler code generation can be attached
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
63 to this. But perhaps this clutters the description too much and we need to put
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
64 it elsewhere.
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
65
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
66
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
67 The description language can help to expand these descriptions by expanding
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
68 the permutations.
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
69
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
70
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 319
diff changeset
71