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