1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./style.css" />
6 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./design.css" />
7 <link rel=
"stylesheet" media=
"print" type=
"text/css" href=
"./print.css" />
9 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
13 <h1 class=
"sectionedit1" id=
"vams_netlister_readme">VAMS netlister README
</h1>
17 <!-- EDIT1 SECTION "VAMS netlister README" [1-36] -->
18 <h2 class=
"sectionedit2" id=
"vams_netlister">VAMS netlister
</h2>
20 <pre class=
"code">date:
10 october
2000
21 gEDA: gnetlist vams mode
22 first unrevised vams mode documentation
25 Written by: Martin Lehmann
26 -------------------------------------------------------------------------
29 VHDL-AMS support for the gEDA gnetlist tool
30 -------------------------------------------
35 1. ARCHITECTURE generation
37 3. automatisate gnetlist calls
40 1. the vams mode of gEDA gnetlist
42 1. settings and new definition
44 1. routines main structure
45 3. helpfully setting in gEDA gschem environment
51 2. automatic generating gnetlist calls in gEDA gschem
52 1. generated gEDA gnetlist calls
54 1. generate_netlist.scm
62 The purpose of our endevour, is that gEDA gnelist completly
63 supportted VHDL-AMS (VHDL Analog and Mixed-Signal) netlist
66 The VHDL-AMS netlist support mode is called vams.
71 gEDA gnetlist in vams mode allow it to generate a VHDL-AMS
72 ARCHITECTURE or an ENTIY declaration. Which of both tasks is
73 performed, dependends on the generate-mode variable. This variable
74 is defined in the gnetlist command or will be set default.
76 If generate-mode=
1 (default) gnetlist creates a netlist as an
77 VHDL-AMS ARCHITECTURE of the current schematic. Otherwise
78 (generate-mode=
2), it creates an VHDL-AMS ENTITY declaration of the
79 selected component (this task needs information from gEDA gschem,
82 Now follows a stepwise discription of the program run in both
85 We presuppose that you are familiar with the structure of gEDA
86 gnetlist usage (otherwise try gnetlist -help) and that you have
87 ever seen an VHDL-AMS ARCHITECTURE with its belonging ENTITY. If
88 you does not then the following distription will be seems very
89 strange to you. Maybe the syntax files (syntax_entity.txt,
90 syntax_architeture.txt) can helps you further.
92 ==================================================================
94 1.1. ARCHITECTURE GENERATION
97 We suppose generate-mode is equal to
1, from this it follows that
98 vams creates a netlist as an ARCHITECTURE (saved to
99 <value-of-toplevel-attribute-entity
>_arc.
<output-fileextension
>).
102 ARCHITECTURE
<architecture-identifier
> OF
<entity-identifier
> IS
104 The architecture-identifier we are getting from the toplevel
105 attribute architecture, which we have introduced. If it is not
106 defined, we are setting architecture-identifier default
107 (default_architecture). The same have we doing with the
108 entity-identifier (toplevel attribute entity, default_entity).
111 {
<subnet-object
> <subnet-name
> : subnet-kind;}
113 In the signal declaration part all subnets of the schematic will be
114 declarated. A subnet declaration consists of an net-object, a
115 net-name and a net-kind. All subnets are connected to various
116 components pins. If this pins have all the same port-object and the
117 same port-kind it is ok, but if one of them different, the net is
118 faulty, and will be not declarated. Moreover, if the subnet-object
119 a quantity, then it will be checked, whether the subnet consists
120 exactly one output pin (port-mode), else the subnet is faulty too.
121 The three net attributes (object, kind, mode) we are getting from
122 the pin attribs, port_kind, port_object and port_mode (which we
123 have introduced newly) of a component pin.
128 Ok. it
's only marks the start of the architecture body.
131 {
<label
> : ENTITY
<entity
> [(
<architecture
>)]
132 [GENERIC MAP (
<set generic
> =
> <generic-value
>
133 {;
<set-generic=
> <generic-value
>})]
134 PORT MAP (
<pin-name
> =
> <subnet-name
>{;
<.. =
> ..
>});}
136 We only support component instantiation statements, like this
137 above, because we generate simple VHDL-AMS netlists. The label of
138 an instance is defined from the uref of the instanciated
139 component. Watch out, this label must be unique,it is not checked
140 anywhere. The entity variable is not the same as the
141 entity-identifier, it is the value of the device attribute which on
142 its part identifies the precompiled ENTITY of this special
143 component. Similar is the architecture variable belonging to the
144 instanciated components ARCHITECTURE (note: one ENTITY can have more
145 ARCHITECTURES), hence we are getting it from the component
146 attribute ARCHITECTURE (newly introduced).
148 All generics of the generic-list are component parameters, which
149 are different from its default values (set in its ENTITY
150 declaration). How can we distinguish them? All defined generics
151 are attached to the component and looks like :
153 <attribute-name
>=?
<default-value
> <- default, not in
156 And if you want to change a parameter, you only must delete the
157 ?-character and replace the default-value with your wanted value,
160 <attribute-name
>=
<new-value
> <- element of generic list
162 If you do it this way, the new assigned value and its attribute-name
163 will be appear in the GENERIC MAP (set-generic=attribute-name and
164 generic-value=new-value).
166 The PORT MAP consists of all pins of a component and which nets
167 them connected to. The pin-name is getting from the pin# attribute
168 of the pin and the subnet-name means the value of the label
169 attribute of a net (mostly default named), which the pin is
170 connected to. If the pin directly wired to a PORT component (=
171 component, which device attribute =PORT), then we assign the uref
172 of this component to subnet-name.
175 END ARCHITECTURE
<architecture-identifier
>;
177 I think, this line needs no more explanation. The
178 architecture-identifier is the same like in the first line of
179 ARCHITECTURE declaration. Hence, the ARCHITECTURE part ends here.
181 ==================================================================
183 1.2. ENTITY GENERATION
186 Now, we suppose generate-mode is equal to
2, from this it follows
187 that vams creates an ENTITY declaration of a component (save to
188 <component-device
>.vhdl). If there no component selected (empty
189 top-attribs list) then it will be created an toplevel ENTITY of the
190 current schematic (save to
191 <value-of-toplevel-attribute-entity
>.vhdl).
194 LIBRARY
<library-identifier
>{,
<library-identifier
>};
195 USE
<package-identidier
>{,
<package-identifier
>};
197 Well, the context clause part is not very ingenious. All libraries
198 and packages you needs for your simulation you must insert staticly
199 (a library contents precompiled ENTITIES, ARCHITECTURES and
200 PACKAGES, which are needed from base components [base of the
201 hierachical netlist] of your schematic. a package contents
202 predefined types, constants, ...). We are searching for a better
203 usability of this part.
206 ENTITY
<entity-identifier
> IS
211 If you want generate a toplevel ENTITY of your current schematic
212 then the entity-identifier is defined from the toplevel attribute
213 entity of the schematic-file. Moreover, there are no generic_clause
216 In case of an component based ENTITY declaration, the
217 entity-identifier is getting from the device attribute of the
218 selected component (this attribute is included in top-attribs list,
219 which is defined in the automatic generated gnetlist command .. more
224 GENERIC (
<generic-identifier
> : REAL :=
<default-value
>
225 {;
<generic-identifier
> : REAL :=
<default-value
>});
227 All needed generic-identifiers and it default-values are getting
228 from the top-attribs list. Note: all attached attributes of a
229 component appears in the generic_clause, only special attributes,
230 like uref, source and architecture, are taked out. The values of
231 this attributes are taked from the top-attribs list, too, but it
232 does not matter whether the value starts with a ?-character or not
233 (?-character always will be deleted, if it exist in front of a
238 PORT (
<port-kind
> <port-identifier
> : [
<port-mode
>]
<port-type
>
239 {;
<port-kind
> <port-identifier
> : [
<port-mode
>]
<port-type
>});
241 All variables of this clause are grabbed from the symbol of the
242 selected component. Port-kind corresponds with the value of the
243 port_kind attribute of the pin, which pin# attribute value is equal
244 to port-identifier. Just as corresponds port-type with the the
245 value of the pin attribute port_type and port-mode with the value
248 ===================================================================
250 1.3. AUTOMATISATING gnetlist CALLS
252 Because it is very arduous to type the whole gnetlist command,
253 which all its parameters, per hand into the terminal, we are
254 implement an automatisation of this process in gEDA gschem. This
255 makes it possible to create a VHDL-AMS ARCHITECTURE or ENTITY
256 whitout any commandline actions. The only thing you must do, is to
257 use one of the following hotkeys:
259 <g e
> for generating an ENTITY
260 <g n
> for genarating an ARCHITECTURE.
262 NOTE to
<g e
> - hotkey : If one component of the schematic
263 selected then the ENTITY generation
264 will be applied to this component !!
266 ===================================================================
270 At this section it will be explained the basic concept of the
271 implementation, which is splited in two sections. The first one
272 aimed to the gnelist implementation and the second to the gschem
276 2.1. THE VAMS MODE OF gEDA gnetlist
278 To realize gnetlist VHDL-AMS support, it was necessary to create
279 new scheme and c stuff.
284 The scheme implementation contents two parts. On one hand the new
285 file gnet-vams.scm, which realize the VHDL-AMS-code generation, and
286 on the other hand some settings in rc-files.
289 2.1.1.1. SETTINGS AND NEW DEFINITIONS
291 The following lines insert in your gschemrc, or wherever you want,
292 but it must be loaded at gnetlist startup.
294 - load two modules, which we needs in our new implementation.
296 (define-module (ice-
9 ls) :use-module (ice-
9 common-list)
297 :use-module (ice-
9 string-fun))
299 - load main file for VHDL-AMS support, which contents the
300 startup procedure vams.
302 (load
"<path_of_gnet-vams.scm
>/gnet-vams.scm
")
305 2.1.1.2. gnet-vams.scm
307 This file contents all necessary scheme-functions to generate
308 VHDL-AMS-code. Especially, the main procedure vams, which can be
309 execute from the gnetlist command.
313 gnetlist -g vams schematic_filename.sch
318 2.1.2.1. ROUTINES MAIN STRUCTURE
320 the mainly functions structure looks like:
322 - (vams output-filename)
324 ARCHITECTURE generation
326 - (vams:write-secondary-unit architecture entity output-port)
328 - (vams:write-architecture-declarative-part output-port)
329 - (vams:write-signal-declarations output-port)
331 - (vams:write-architecture-statement-part packages output-port)
332 - (vams:write-generic-map output-port package)
333 - (vams:write-port-map package output-port)
337 - (vams:write-primary-unit entity port-list generic-list output-port)
339 - (vams:write-context-clause output-port)
341 - (vams:write-generic-clause generic-list output-port)
342 - (vams:write-generic-list generic-list output-port)
344 - (vams:write-port-clause port-list output-port)
345 - (vams:write-port-list port-list output-port)
348 2.1.1.3 HELPFULLY SETTING IN THE gEDA gschem ENVIRONMENT
350 This settings are not absolutly necessary, but they makes work
353 - set in .gEDA/gschemrc or wherever you want, but place it
356 (attribute-promotion
"enable
")
357 (promote-invisible
"enable
")
358 (enforce-hierarchy
"disabled
")
360 (attribute-name
"port_object
")
361 (attribute-name
"port_type
")
362 (attribute-name
"port_mode
")
363 (attribute-name
"entity
")
364 (attribute-name
"architecture
")
369 To got all informations, which we needed for currently netlist
370 generation, we must implemented two new c - functions.
373 2.1.2.1 NEW ROUTINES (saved in vams_misc.c)
376 SCM vams_get_package_attributes(SCM scm_uref)
378 The first function gets all attribute names (not its values) of a
379 component. This routine requires the name a component (package),
380 especially the uref of it, and returns a list of all attribute
381 names which are attached to this package.
383 We needs this functionality to produce a currectly
384 VHDL-AMS GENERIC MAP.
387 char* vams_get_attribs_list
388 (OBJECT *object, SCM *list, OBJECT **return_found)
390 It exists only for the support of the first function.
393 2.1.2.2. CODE ADAPTATION
395 To place this new functions at gnetlist scheme
's disposal, you must
396 perform the following actions.
398 (
1) gnetlist/src/g_register.c
401 (
"gnetlist:vams-get-package-attributes
",
402 vams_get_package_attributes);
405 (
2) gnetlist/include/prototype.h
407 SCM vams_get_package_attributes(SCM scm_uref);
410 (
3) edit gnetlist/src/Makefile.in or directly in Makefile
412 (if you have edited Makefile.in you must run make config of
415 - add
"vams_misc.c
" to gnetlist_SOURCES - variable
416 - add
"vams_misc.o
" to gnetlist_OBJECTS - variable
418 (
4) copy vams_misc.c to gEDA/gnetlist/src/
420 (
5) compile your code newly
422 ===================================================================
424 2.2. AUTOMATIC GENERATING gnetlist CALLS IN gEDA gschem
426 To realize this new feature it was necessary to put more
427 information from the schematic to the scheme world of gEDA gschem.
428 Concretly, we needs the filename of the current schematic, because
429 gEDA gnetlist required it, and the attached attributes of a
430 selected component for creating an VHDL-AMS ENTITY. Hence, the
431 gnetlist command is mutated to an unidirectional interface between
432 the world of gschem scheme and the world of gnetlist scheme.
434 There are three important things, which transfer through this
437 (
1) the source-file, which contents the complett filename
438 (with path) of the current schematic.
440 (
2) the top-attribs list, which contents all attached
441 attributes of the selected component.
443 (
3) the generate-mode, which is defined by the users actions.
446 2.2.1. STRUCTURE OF gEDA gnetlist CALLS FROM COMMANDLINE OR FROM gEDA
449 typical commandline call :
451 gnetlist [-o
<output-filename
>]
453 <schematic-file
>
455 There are nothing to explain. The top-attribs list and the
456 generate-mode variable are default defined (
'() and
1).
459 calls from gEDA gschem (
3 possible variations) :
462 Note: vhdl-path is a predefined variable, which is set in
463 generate_netlist.scm first times. You can it simple redefine
464 in your local gschemrc file, which is loading everytimes you
468 (
1) hot-key-stroke: - g n (generate netlist)
470 --
> generates a netlist of the current schematic.
473 gnetlist -o
<vhdl-path
>/
<target-file
>
477 The source-file variable is equate to the complett
478 path+filename of the current schematic, which we get with
479 help of a self coded c function. If you cut out the filename
480 of the source-file variable (source-file without path) then
481 you are getting the target-file.generate-mode and
482 top-attribs are default again.
484 (
2) hot-key-stroke: - g e (generate-entity)
485 and no component is selected.
487 --
> generates an toplevel ENTITY of the current
491 gnetlist -c
<scheme-comm
>
492 -o
<vhdl-path
>/
<target-file
>
496 scheme-comm=
"(define top-attribs
'<top-attribs
>)
497 (define generate-mode
'2)
"
500 Source-file needs no comment, because it is the same as in
501 (
1). To get all attributes of a selected component, we are
502 must write a new c function again. The values, which we get
503 from this new function are saved in top-attribs. The sense
504 of the scheme-comm command is to put top-attribs and
505 generate-mode from the gschem to the gnetlist environment.
506 At last, the target-file consists of the pure basefilename
507 of the source-file and an .vhdl extention.
509 (
3) hot-key-stroke: - g e (generate-entity)
510 and only one component is selected.
512 --
> generates an ENTITY of the selected schematic.
515 commandline is the same as in (
2).
518 Differences: The target-file is different, but it does not
519 matter, because gnetlist generate an new output-filename in
520 in this case (
<device-name-of-selected-component
>.vhdl,
521 normally).But one fact is very important: the top-attribs
522 variable includes all attached attributes of the selected
527 The gnetlist command is generating from two scheme functions, which
528 are saved in generate_netlist.scm. This functions starts if the
529 gschem user is typing one of the specified hot-keys ([g e] starts
530 generate-entity and [g n] starts generate-netlis). Both routines
531 puts the whole gnetlist command together and execute it. The syntax
535 2.2.2.1. generate_netlist.scm
540 If you want use the new feature then you must do some entries in one
541 of your gEDA gschem rc-files
547 (
"g
" . gnetlist-keymap)
549 Edit your global-keymap and if
"g
" always defined then find
550 out an other free hot-key-stroke.
552 Note: the documentation supports the
"g
" - key only.
555 - in one of the gschem startup files
557 (define gnetlist-keymap
558 '((
"n
" . generate-netlist)
559 (
"e
" . generate-entity)))
564 (load
"/home/fliser3/.gEDA/generate_netlist.scm
")
569 The c-code makes it possible to get directly informations from the
570 gschem tool, which is necessary for the online execution of
576 It exists two new c-functions. Both are put down in
580 SCM get_selected_filename(gpointer data,
581 guint callback_action,
584 This function returns the whole filename of the current schematic,
585 which is picked from the w_current-
>page_current-
>page_filename
589 SCM get_selected_component_attributes(gpointer data,
590 guint callback_action,
593 How the name is saying, this functions returns all attributes of
594 the selected component. It is realized with a simple while loop
595 over all objects of the schematic, which picked out all elements
596 where the selected flag is set.
599 2.2.3.2. CODE-ADAPTATION
601 Here are some actions you must conclude to makes the software
604 (
1) new lines in /gschem/src/g_register.c
606 gh_new_procedure0_0 (
"get-selected-filename
",g_get_selected_filename);
609 (
2) new lines in /gschem/include/prototype.h
611 SCM g_get_selected_filename();
614 (
3) copy the file misc_for_gnetlist.c to gschem/src
616 (
4) add in file /gschem/src/Makefile.in or directly in Makefile.
618 (if you have edited Makefile.in you must run make config of
621 - add
"misc_for_gnetlist.c
" to gschem_SOURCES - variable
622 - add
"misc_for_gnetlist.o
" to gschem_OBJECTS - variable
624 (
5) add new lines in /gschem/src/g_key.c
626 SCM g_get_selected_filename(void)
628 return (get_selected_filename(window_current,
0, NULL));
632 (
6) compile your changed c-code newly
</pre>
635 <!-- EDIT2 SECTION "VAMS netlister" [37-20220] -->
636 <h2 class=
"sectionedit3" id=
"vams_netlister_syntax_architecture">VAMS netlister syntax architecture
</h2>
638 <pre class=
"code">ARCHITECTURE
<architecture-identifier
> OF
<entity-identifier
> IS
640 {
<subnet-object
> <subnet-name
> : subnet-kind;}
644 {
<label
> : ENTITY
<entity
> [(
<architecture
>)]
645 [GENERIC MAP (
<set-generic
> =
> <generic-value
>
646 {;
<set-generic=
> <generic-value
>})]
647 PORT MAP (
<pin-name
> =
> <subnet-name
>{;
<.. =
> ..
>});}
649 END ARCHITECTURE
<architecture-identifier
>;
</pre>
652 <!-- EDIT3 SECTION "VAMS netlister syntax architecture" [20221-20667] -->
653 <h2 class=
"sectionedit4" id=
"vams_netlister_syntax_entity">VAMS netlister syntax entity
</h2>
655 <pre class=
"code">LIBRARY
<library-identifier
>{,
<library-identifier
>};
656 USE
<package-identidier
>{,
<package-identifier
>};
658 ENTITY
<entity-identifier
> IS
659 [GENERIC (
<generic-identifier
> : REAL :=
<default-value
>
660 {;
<generic-identifier
> : REAL :=
<default-value
>}); ]
661 [PORT (
<port-kind
> <port-identifier
> : [
<port-mode
>]
<port-type
>
662 {;
<port-kind
> <port-identifier
> : [
<port-mode
>]
<port-type
>});]
666 <!-- EDIT4 SECTION "VAMS netlister syntax entity" [20668-] --></body>