OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [doc/] [src/] [tex/] [tools.tex] - Blame information for rev 221

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 210 ja_rd
 
2
\chapter{Tools}
3
\label{tools}
4
 
5 221 ja_rd
    Directory '/tools' of the project includes a few tools -- small C or Python
6
    programs purpose-built for this project.
7
 
8
    What follows is a brief description of each of the tools. This document
9
    won't go into the implementation or usage details. The tools themselves have
10
    brief usage instructions and for any further details the user must read
11
    the source code.
12
 
13
 
14
 
15 210 ja_rd
\section{MIPS Software Simulator}
16
\label{sw_simulator}
17
 
18
    Plasma project includes a MIPS-I simulator made by Steve Rhoads, called
19
    'mlite.c'. According the the author, it was used as a golden model for the
20
    construction of the cpu, the same as I have done.\\
21
    I have made some modifications on Rhoads' code, mostly for logging, and
22
    called the new program 'slite' ('/tools/slite/src/slite.c').\\
23
 
24
    The most salient features are:
25
 
26
    \begin{itemize}
27
    \item Logs CPU state to a text file.
28
        The format is identical to that of the vhdl test bench log.
29
        You can select the code address that triggers the logging.
30
    \item Echoes CPU UART output to the host console or to a log file.
31
    \item Can be run in interactive mode (like a monitor).\\
32
        Step by step execution, breakpoints, that kind of thing.
33
    \item Can be run in batch (unattended) mode.\\
34
        So that you can easily run a program to compare logs with the
35
        vhdl test bench.
36
    \item Does not simulate the cache at all.
37
    \end{itemize}
38
 
39
    Each code sample includes a DOS batch file named 'swsim.bat' that runs the
40 221 ja_rd
    simulator in batch mode. Note that the BAT file invokes a windows binary
41
    which is included in the SVN repository and should be immediately useable
42
    after checkout.\\
43 210 ja_rd
 
44
    The program includes usage help (a short description of the command line
45 221 ja_rd
    parameters). The source code (very simple and straighforward) is included in
46 210 ja_rd
    the project. The BAT files provide an usage example. And anyone who is
47
    interested and finds trouble can always contact me.
48
 
49
    For all these reasons I think it is not necessary to explain the simulator
50
    in detail. Nothing to do with laziness, as you can see.\\
51
 
52
    Many system parameters are hardcoded, including the log file name, the
53
    simulated memory sizes and the code and data addresses.\\
54
 
55
    The hardcoded log file name is "sw\_sim\_log.txt" and it is generated in the
56
    same directory from which the simulator is run.\\
57
 
58 221 ja_rd
\section{Configuration Package Builder Script build\_pkg.py}
59
\label{python_script}
60
 
61
    This tools is used to build a simulation and synthesis configuration
62
    package.
63
 
64
    The generated package contains configuration constants used by the
65
    simulation test bench \emph{'mips\_tb.vhdl'} and by the hardware demo
66
    \emph{'c2sb\_demo.vhdl'}.
67
 
68
    It too includes memory initialization constants containing object code,
69
    used to initialize simulated and inferred memories, both in simulation
70
    and in synthesis.
71
 
72
    In the code samples, this script is used to generate two separate packages
73
    for simulation and synthesis. Please refer to the makefiles for detailed
74
    usage examples.
75
 
76
 
77 210 ja_rd
\section{Conversion Script bin2hdl.py}
78
\label{python_script}
79
 
80 221 ja_rd
 
81
    \begin{figure*}[ht]
82
    \begin{center}
83
    {\small
84
    \framebox[7in]{
85
    \begin{minipage}[t]{6.0in}
86
 
87
    NOTE: This script was used in previous versions of the project -- it came
88
    in handy to initialize byte-sliced memories when the caches were under
89
    development.
90
 
91
    It has been abandoned because it was far too complicated and no longer
92
    necessary. The VHDL
93
    templates it refers to and the script itself have been moved from the /src
94
    directory to their own subdirectory in /tools.
95
 
96
    It is being retained in case it becomes useful again but it is no longer
97
    used.
98
 
99
    \end{minipage}
100
    }
101
    }
102
    \end{center}
103
    \label{lb}
104
    \end{figure*}
105
 
106
 
107
 
108 210 ja_rd
    This Python script reads one or more binary files and 'inserts' them in a
109
    vhdl template. It makes the
110
    conversion from binary to vhdl strings and slices the data in byte columns,
111
    as required by the RAM implementation (in which each byte in a word is
112
    stored in a different RAM with a separate WE, 4 blocks in all).\\
113
 
114
    The 3 binary files the script can read are the object code image, the
115
    data image (initialized data sections) and a FLASH image.
116
 
117
    The script inserts a number of simulation parameters in the template file,
118
    as illustrated by the makefiles.\\
119
 
120
    The makefiles of the code samples can be used as an example. The script code
121
    is a bit convoluted but it is understandable if you do know Python,
122
    and includes some usage instructions.\\
123
 
124
    The vhdl templates (/src/*\_template.vhdl) have placeholder 'tags' that are
125
    replaced with real application data by this script.
126
 
127
    Some of the tags are these:
128
 
129
    \begin{tabular}{ l l }
130
    "@code0@"             & : Contents of RAM block for slice 0 (lsb) of code\\
131
       ...\\
132
    "@code3@"             & : Contents of RAM block for slice 3 (msb) of code\\
133
    "@code31@"            & : Contents of RAM block for slices 3 \& 1 (odd) of code\\
134
    "@code20@"            & : Contents of RAM block for slices 2 \& 0 (odd) of code\\
135
    "@data0@"             & : Contents of RAM block for slice 0 (lsb) of data\\
136
       ...\\
137
    "@data3@"             & : Contents of RAM block for slice 3 (msb) of data\\
138
    "@data31@"            & : Contents of RAM block for slices 3 \& 1 (odd) of data\\
139
    "@data20@"            & : Contents of RAM block for slices 2 \& 0 (odd) of data\\
140
    "@flash@"             & : Contents of simulated FLASH\\
141
    "@data-32bit@"        & : Contents of 32-bit-wide RAM block of data\\
142
    "@entity\_name@"      & : Name of entity in target vhdl file\\
143
    "@arch\_name@"        & : Name of architecture in target vhdl file\\
144
    "@code\_table\_size@" & : Size of RAM block to be used for code, in words\\
145
    "@code\_addr\_size@"  & : ceil(log2(@code\_table\_size@))\\
146
    "@data\_table\_size@" & : Size of RAM block to be used for data, in words\\
147
    "@data\_addr\_size@"  & : ceil(log2(@data\_table\_size@))\\
148
    \end{tabular}\\
149
 
150
    There's a few more tags; they are described in the script source and the
151
    usage help.\\
152
 
153
    These placeholders will be replaced with object code or with data values
154
    provided by the script command line (see makefiles).\\
155
 
156
    The script has been used with Python 2.6.2. It should work with earlier
157
    or later versions but I haven't tested.\\
158
 
159
    Note: all of the above info is in the script itself, and can be shown
160
    with command line option --h. Since it will be more up to date than this
161
    doc, you're advised to read the script.\\
162
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.