prga.renderer.renderer module

class prga.renderer.renderer.FileRenderer(*paths)

Bases: object

File renderer based on Jinja2.

_get_yosys_lib_task(script_file=None)

Get the specified or most recently added yosys lib script rending task.

_get_yosys_synth_task(script_file=None)

Get the specified or most recently added yosys synthesis script rending task.

classmethod _net2verilog(net)

str: Render net in verilog syntax.

classmethod _source2verilog(net)

str: Render in verilog syntax the concatenation for the nets driving net.

_yosys_lib_script_task
_yosys_synth_script_task
add_generic(file_, template, order=1.0, **kwargs)

Add a generic file rendering task.

Parameters:
  • file (str) – The output file
  • template (str) – The template to be used
  • order (float) – Rendering ordering when multiple template s are used to render file_. The higher this value is, the earlier it is rendered.
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_verilog(file_, module, template=None, order=1.0, **kwargs)

Add a Verilog rendering task.

Parameters:
  • file (str) – The output file
  • module (Module) – The module to be rendered
  • template (str) – The template to be used
  • order (float) – Rendering ordering when multiple template s are used to render file_. The higher this value is, the earlier it is rendered.
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_yosys_bram_rule(module, template, file_=None, order=1.0, **kwargs)

Add a yosys BRAM inferring rule rendering task to the currently active synthesis script.

Parameters:
  • module (Module) – The memory module
  • template (str) – The template to be used
Keyword Arguments:
 
  • file (str) – The output file. If add_yosys_bram_rule is called the first time after a new synthesis script is activated, this argument is required. Otherwise, this argument must either match the previously set value, or remain None.
  • order (float) – Rendering ordering when multiple template s are used to render file_. The higher this value is, the earlier it is rendered.
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_yosys_lib_cell(file_, module, template=None, order=1.0, dont_generate_verilog=False, **kwargs)

Add a yosys library cell rendering task and link it in the currently active library script.

Parameters:
  • file (str) – The output file
  • module (Module) – The blackbox module
Keyword Arguments:
 
  • template (str) – The template to be used
  • order (float) – Rendering ordering when multiple template s are used to render file_. The higher this value is, the earlier it is rendered.
  • dont_generate_verilog (bool) – If set, file_ is assumed to already exist and will not be overwritten
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_yosys_lib_script(file_, template=None, **kwargs)

Add a yosys library script rendering task.

Parameters:
  • file (str) – The output file
  • template (str) – The template to be used
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_yosys_memory_techmap(module, template, file_=None, premap_commands=None, order=1.0, **kwargs)

Add a yosys memory techmap rendering task to the currently active synthesis script.

Parameters:
  • file (str) – The output file
  • module (Module) – The memory module
  • template (str) – The template to be used
Keyword Arguments:
 
  • file (str) – The output file. If add_yosys_memory_techmap is called the first time after a new synthesis script is activated, this argument is required. Otherwise, this argument must either match the previously set value, or remain None.
  • premap_commands (str) – Commands to be run before running the techmap step
  • order (float) – Rendering ordering when multiple template s are used to render file_. The higher this value is, the earlier it is rendered.
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_yosys_synth_script(file_, lut_sizes, template=None, **kwargs)

Add a yosys synthesis script rendering task.

Parameters:
  • file (str) – The output file
  • lut_sizes (Sequence [int ]) – LUT sizes active in the FPGA
  • template (str) – The template to be used
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
add_yosys_techmap(file_, template, premap_commands=None, order=1.0, **kwargs)

Add a yosys techmap rendering task to the currently active synthesis script.

Parameters:
  • file (str) – The output file
  • template (str) – The template to be used
Keyword Arguments:
 
  • premap_commands (str) – Commands to be run before running the techmap step
  • order (float) – Rendering ordering when multiple template s are used to render file_. The higher this value is, the earlier it is rendered. In addition, order is used to sort techmap commands in the synthesis script. Techmaps are executed before lutmap if order is non-negative, and after lutmap if order is negative. The default order is 1.
  • **kwargs – Additional key-value parameters to be passed into the template when rendering
render()

Render all added files and clear the task queue.

tasks
template_search_paths