1 \documentclass[12pt,fleqn,a4paper]{article}
2 \usepackage[latin1]{inputenc}
3 %\usepackage[cyr]{aeguill}
7 \usepackage[english]{babel}
11 \renewcommand{\url}[1]{%
12 \begin{otherlanguage}{english}\urlorig{#1}\end{otherlanguage}%
15 %\usepackage{pstricks,pst-node,pst-text,pst-3d}
21 \usepackage{subfigure}
26 \usepackage[ruled,lined,linesnumbered]{algorithm2e}
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
29 \newcommand{\noun}[1]{\textsc{#1}}
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%% my own LaTeX commands.
32 %\newcommand{\bibpath}[1]
33 % {/home/sdomas/rapport/eigenjace/ipdps/#1}
35 \newcommand{\tab}{\ \ \ }
36 \newcommand{\ot}[1]{{\tt #1}}
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%% my bib path.
40 \title{BLAST: classes and xml files for blocks (models, implementations and view)}
42 \author{St\'ephane Domas\\
43 Laboratoire d'Informatique
44 de l'Universit\'e de Franche-Comt\'e, \\
46 90016~Belfort CEDEX, France\\}
55 \section{What are blocks and items ?}
56 A block is the main unit to build a design in Blast. From the user
57 point of view, a block represents a process with inputs to consume
58 data, outputs to produce results. It may have some parameters
59 (e.g. the input/output data size). Thus, the user is not concerned
60 about how the block is really implemented in VHDL, just about the
61 "function" of the block. Some blocks are predefined, but the user can
62 also build them by composing predefined ones.
64 For the first type, the user has to choose the predefined blocks from
65 a library of "reference blocks" that do a particular processing
66 (i.e. a multiplication, a filter, ...), with default interface names
67 and parameter values. To add such a block to the design, a reference
68 block is cloned to obtain a "functional" block. It is similar to the
69 instanciation in object oriented programming: reference block
70 corresponds to the class, and functional block to the instance of that
71 class. Thus, a design may contain several functional blocks that
72 correspond to the same reference block. A reference block is
73 associated to one or several implementations that are in fact patterns
74 of VHDL code. One of them will be chosen more or less automatically by
75 Blast to produce the final VHDL code. The representation of an
76 implementation as a class and the structure of the files that contain
77 patterns are discussed in details in Section \ref{Implementations}.
79 The second type is named a "group" block. It is created empty or with
80 a set of existing functional blocks. For example, when a void design
81 is created, a group block is also created, that will represent the top
82 component in the VHDL code. User can add predefined blocks or even
83 other group blocks within a group very easily. There main purpose is
84 to make the design clearer and the VHDL more readable. Indeed, each
85 group will be translated into a VHDL component. Thus, instead of
86 having a single top component with a bunch of predefined blocks
87 within, they can be spread within groups to build a design
90 These three types of block are represented by a hierarchy of classes
91 that is described in details in Section \ref{sec:blocks_class}.\\
93 Reference, functional and group blocks are just containers of data,
94 i.e. they are part of the Model in MVC paradigm). The two latter have
95 a graphical counter part, named items, so that they can be represented
96 in the graphical interface. The hierarchy of classes
97 that represents the items is described in details in Section \ref{sec:items_class}.\\
99 \section{Class hierarchy for blocks}
100 \label{sec:blocks_class}
102 \subsection{the top class}
103 \label{sec:abstract_block_class}
105 The top class for describing block is {\tt AbstractBlock}, derived in
106 three subclasses: {\tt ReferenceBlock}, {\tt FunctionalBlock}, {\tt
109 Some attributes are common to every types, and defined in {\tt AbstractBlock}:
113 \item input/output/bidirectional interfaces.
116 Parameters and interfaces are complex to represent and thus, are also
117 described by a hierarchy of classes in Section
118 \ref{sec:parameters_class} and \ref{sec:interfaces_class}.
120 \subsection{reference blocks}
121 \label{sec:reference_block_class}
123 A reference block is created taking informations in an XML file that
124 describes it, providing its parameters and interfaces. The structure
125 of that file is described in details in Section
126 \ref{sec:references_xml}.
128 A reference block also contains a list of {\tt
129 BlockImplementation}. Each of them represents a pattern of VHDL code
130 that implements the function of the block.
132 \subsection{functional blocks}
133 \label{sec:functional_block_class}
135 A functional block has two attributes {\tt reference} and {\tt group}
136 that respectively refer to the reference block that has been cloned to
137 create that functional block, and the group block that contains it.
140 \subsection{group blocks}
141 \label{sec:group_block_class}
143 A group block has mainly two attributes {\tt parent} and {\tt
144 blocks}. The first one is a pointer to the group that contains that
145 group (or {\tt NULL} if it is the top group). The second one is the
146 list of the functional or group blocks that are within this group.
148 {\bf Important: } a group block has no interface by itself. In fact,
149 they are created when the user wants to connect an interface of a
150 inner block to the outside of the block. Note that there is a 1:1
151 relation between a group interface and an interface of an inner
152 block. Nevertheless, an output group interface can still be connected
153 to several input interfaces.
155 {\bf Important: } a group block has no parameters by itself, except
156 if it contains blocks that may be configured via a wishbone. In this
157 case, the generic parameters to manage the wishbone are atuomaticcaly
160 \subsection{interfaces classes}
161 \label{sec:interfaces_class}
163 As for blocks, a top class {\tt AbstractInterface} represents the
164 common features of all interfaces and it is derived in three
165 subclasses: {\tt ReferenceInterface}, {\tt FunctionalInterface} and
166 {\tt GroupInterface}.
168 \subsection{parameters classes}
169 \label{sec:parameters_class}
172 There are four types of parameters for a block:
180 These are represented by the top class {\tt BlockParameter} and four
181 subclasses: ({\tt BlockParameterUSer}, {\tt BlockParameterGeneric},
182 {\tt BlockParameterPort}, {\tt BlockParameterWishbone}.
184 Four attributes are common to all, and defined in {\tt BlockParameter}:
186 \item \ot{owner}: a pointer to the block instance (reference/functional) that ``owns'' this parameter,
187 \item \ot{name}: the name of the parameter (NB: cannot be changed by the user of BLAST),
188 \item \ot{type}: the type of the value,
189 \item \ot{value}: the default value of the parameter, given as a \ot{QString} but stored as a \ot{QVariant}.
192 \ot{type} value (int) must be set with one of those in \ot{ParamType} enum (cf. \ot{BlockParameter.h}):
195 enum ParamType { Undefined = -1, Expression = 1, Character,
196 String, Bit, BitVector, Boolean,
197 Integer, Natural, Positive, Real, Time};
199 Except the two first, these values correspond to predefined types in
200 VHDL. \ot{Expression} correspond to an arithmetic expression and must
201 be used only for port and wishbone parameters. Thus, its syntax will
202 be presented in the associated sections (\ref{sec:parameters_port} and
203 \ref{parameters_wb}).\\
205 Whatever the case, parameters will be used during VHDL generation but at different phases, depending on the class.
207 \subsubsection{user parameters}
208 \label{sec:parameters_user}
209 User parameters have a type equals to \ot{String}. A default value
210 must be given at construction but a \ot{userValue} can be defined via
213 A user parameter is only used when generating the VHDL code of the
214 architecture section of a block (cf. section
215 \ref{sec:impls_xml}). Each time the generator encounters an escape
216 sequence: \ot{@val\{user\_parameter\_name\}}, it replaces it with
217 \ot{userValue} if defined, or with the default value.\\
219 {\bf CAUTION:} No validity check are done by BLAST on default and user
220 value strings. Thus, they can be anything and can lead to incorrect
223 \subsubsection{generic parameters}
224 \label{sec:parameters_generic}
226 Generic parameters have a type equals to any predefined VHDL type (i.e. all
227 defined above except \ot{Undefined} and \ot{Expression}). A default
228 value must be given at construction but a \ot{userValue} can be
229 defined via setters.\\
231 A generic parameter is used during the generation of:
233 \item the entity section,
234 \item the component section when the owner block is used within another block,
235 \item the generic map of when instanciating owner block is used within another block,
236 \item the architecture section.
239 In the two first cases, it leads to lines like
241 \ot{d\_width : integer := 16;}, using the \ot{name}, \ot{type} and default value.
243 In the third case, it leads to lines like
245 \ot{d\_width => 10,}, using the \ot{name} and \ot{userValue},
246 or default value if not defined.
248 \ot{d\_width => d\_width,}, using only the
249 \ot{name}. This case occurs when the owner is instanciated within a
250 block that has a generic parameter with the same name.
252 In the last case, each time the generator encounters an escape
253 sequence: \ot{@val\{generic\_parameter\_name\}}, it replaces it with
254 \ot{userValue} if defined, or with the default value.\\
256 {\bf IMPORTANT:} a block that defines wishbone parameters will be
257 generated with 2 generic parameters with predefined names:
258 \ot{wb\_data\_width} and \ot{wb\_addr\_width}. They correspond to the
259 width of the address and data buses of the wishbone and are used
260 during the generation of the controller of the block
261 (cf. \ref{sec:parameters_wb}).
263 \subsubsection{port parameters}
264 \label{sec:parameters_port}
265 A port parameter can be used to obtain a value associated to an
266 interface of the block. Indeed, it is possible to create several
267 instances of the same interface, when its multiplicity given in the
268 reference model is greater than 1. For example, it is used for block
269 that may have a variable number of inputs/outputs, like a
270 multiplexer. Instead fo creating a bunch of multiplexers with 2, 3, 4,
271 $\ldots$ data inputs, it is possible to generate one for any
272 amount. In BLAST, this amount is given by the number of instances of
273 the data input the user has created. It implies that the selector
274 input has a variable range and thus needs a variable number of bits to
275 be expressed. If $N$ is the number of instances of the data input,
276 then the selector size is $log_2(N)$. A port parameter is used to
277 express such a value.\\
279 A port parameters have a supplementary attribute \ot{ifaceName} that
280 must correspond to an existing interface of the block. \ot{type} is
281 equal to \ot{Expression} and \ot{value} contains this expression,
282 using variables with a predefined name \ot{\$if\_nb} and
283 \ot{\$if\_width} that will be respectively replace during VHDL
284 generation by the number of instances of \ot{ifaceName}, and its
287 A port parameter is used during the generation of:
289 \item the entity section,
290 \item the component section when the owner block is used within another block,
291 \item the architecture section.
294 In every case, each time the generator encounters an escape sequence:
295 \ot{@val\{port\_parameter\_name\}}, it replaces it with the computed
296 value of the parameter using the expression and the interface name.
299 \subsubsection{wishbone parameters}
300 \label{sec:parameters_wb}
302 A wishbone parameter corresponds to a register that can be read/write
303 via the wishbone bus. Nevertheless, the GUI allows the user to disable
304 the wishbone access and replace it by a fixed value or a port that is
305 assign to the register.
307 Since a register has a width, \ot{type} gives its type. Valid types are:
309 \item \ot{boolean} if the register is an \ot{std\_logic},
310 \item \ot{natural} if the register has a fixed width and is a \ot{std\_logic\_vector},
311 \item \ot{expression} if the register has a variable width and is a \ot{std\_logic\_vector},
313 The width is given in a supplementary attribute \ot{width}. Note that:
315 \item if the type is boolean, width should be equal to 1 but in fact is not used.
317 \item if the type is natural and width is equal to 1, it leads to
318 \ot{std\_logic\_vector(0 downto 0)}, which is sometimes usefull for
321 \item if the type is an expression, width must contains an expression
322 using only +,-,*, numbers and generic parameter references
323 (i.e. parameter name prepend with a $). No check is done thus, the
324 model must be correct so that valid VHDL will be produced.
327 In the second case, the expression may use predefined names
328 \ot{wb\_data\_width} and \ot{wb\_addr\_width}.
330 Whatever the case, during VHDL generation, the final width will be
331 compared to the wishbone data bus width. If the bus width is lesser
332 than the register width, then several wishbone accesses are needed to
333 read/write the register. For example, if wishbone width is 16 and a
334 register has a width of 20, we need to define two addresses, one to
335 access to bits 0 to 15, and one for bits 16 to 19. The total number of
336 needed addresses gives the minimal width of the address bus (i.e. log2(nb addr)).\\
338 The value is a initialization value. If not provided, it is 0 by
341 Three other attributes are declared:
343 \item \ot{wbAccess}: indicates if the register is written or read by
344 the wishbone bus. Thus, if it is written, the register is an input
345 of the block and if it is read, the block provides its value.
346 \item \ot{wbValue}: it may be a natural, a boolean, or the word
347 data. In the two first cases, the given value is affected to the
348 register as soon as the register is accessed in writing. In the
349 third case, the register is affected with the value that is provided
350 on the wishbone data bus.
351 \item \ot{wbDuration} : indicates if the affectation is permanent or
352 just a trigger. In the second case, the value is set for just one
353 clock cycle and then reset to the initialization value given by the
354 \ot{value} attribute.\\
357 A wishbone parameter is used during the generation of:
359 \item the controller of the block (NB: this generation is done at the block level),
360 \item the entity section, because register values are in fact read/write by the block via input/output ports,
361 \item the component section when the owner block is used within another block.
364 \section{Implementations XML description}
365 \label{sec:impls_xml}
367 \section{Implementations class hierarchy}
368 \label{sec:impls_class}