Details of the implementation of the gEDA/gschem plugin


The plugin for parsing and printing schematic files in the gEDA/gschem format is at [1] Github branch.
Get it by cloning the git repo : git clone git@github.sksavant/gnucap.git –branch lang_gschem or get this zip file : zipfile

If you already have latest snapshot of gnucap installed you just need to get the following files: 'src/', 'src/', 'src/'. Also some change is need in to print verilog code correctly. Some examples are present in 'geda/examples/ '

After getting the files compile the plugin with the following command:

  g++ -DHAVE_GEDA -shared -fPIC -o  $(pkg-config --cflags gtk+-2.0 --libs libgeda)

And load it after running gnucap as follows:

  gnucap>load ./ 

This line can be added to '~/.gnucaprc' to load the plugin every time gnucap starts.
Switch the language to gEDA/gschem with the following command:

  gnucap>option lang=gschem OR

How parsing works in lang_geda

When the command 'gschem' is given, CMD_GSCHEM::do_it is called. After setting the language to gschem, parse_top_item is called, which will call new__instance after getting a line from the command stream.
Now depending on the type of the line parsed, which is found from find_type_in_string, corresponding parse_.. function is called. If a command or dev_comment is got, parse_command or parse_comment is called respectively.

If component is found, then CMD_C::do_it is called, which

  • creates a new empty placeholder model (MODEL_SUBCKT)
  • calls parse_componmod which will
    • get the symbol file name
    • parse the symbol file and set the ports by name
    • resets the cmd
    • returns NULL if the model is not needed i.e, it is graphical
  • If the model is not graphical ,push back into the CARD_LIST
  • set componentname as the label of the model and componentmod as false and call new__instance.

If net or place or any other is got, parse_instance is called which will call respective parse_ functions.
When parse_net is called it will :

  • Get the x y coordinates of the two ports
  • parse the symbol file
  • Call create_place which will create a CS with the place parameters and parse it through new__instance.
  • Check if there are any attributes after this line, parse them into set_param_by_name '{..}

If a component is got, call parse_component which will :

  • Get the position, angle, mirror flag and the symbol file name of the component
  • Parse the symbol file associated with the component to get the ports and get the ports' coordinates relative to the component.
  • Depending on the angle and mirror flag, get the absolute position of the ports of the component, create a new place with the position of nodes and call set_port_by_index to set the ports
  • Check if there are any attributes after this line, parse them into set_param_by_name '{..}
gnucap/user/details_of_geda_plugin.txt · Last modified: 2015/12/11 15:39 (external edit)
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki