Code Generation¶
Code generation using the B-ASIC toolbox.
One code printer is currently available:
VhdlPrinter— generates a VHDL implementation of an architecture.
VhdlPrinter¶
- class b_asic.code_printer.vhdl.vhdl_printer.VhdlPrinter(dt: DataType, vhdl_2008: bool = False)¶
Generate VHDL source files for an
Architecture.- Parameters:
- dt
DataType Data type configuration used for generated VHDL.
- vhdl_2008bool, default: False
Enable VHDL-2008 specific output where applicable.
- dt
- get_compile_order(arch: Architecture) list[str]¶
Return the file names for the VHDL code describing the provided architecture.
- Parameters:
- arch
Architecture instance used to determine the compile order of the generated VHDL files.
- print(arch: Architecture, *, path: str | Path = PosixPath('.'), vhdl_ls: bool = False, **kwargs) None¶
Write VHDL files for an
Architecture.- Parameters:
- arch
Architecture Architecture instance to generate code for.
- pathstr | Path, optional
Output directory. Defaults to the current directory.
- vhdl_lsbool, default
False Also write a
vhdl_ls.tomlconfiguration file for the VHDL Language Server alongside the generated VHDL files.- **kwargs
Optional VHDL code-generation settings. For info, see Notes.
- arch
Notes
Recognised keyword arguments, grouped by the component they affect:
Top-level / architecture
Processing elements
- fp_backend
strordict[str,str] Floating-point IP backend to use. Pass a string to apply the same backend to every PE, or a
{entity_name: backend}dict to select on a per-PE basis.- pe_registers
dict[str,tuple[int,int]] Register split
(pre, post)inserted around the operator of a PE. Keys are either the PE entity name or the PE type name.- control_cycle
dict Clock cycle inside an operation at which each control signal becomes available.
- pipeline_pe_control
bool, defaultFalse Register PE control signals after generation.
Memories (RAM)
- output_sync
bool, defaultTrue Place output registers after memory read.
- external_schedule_counter
bool, defaultTrue Use an external schedule counter signal.
- std_logic_vector
bool, defaultFalse Use
std_logic_vectordata instead ofsigned/unsigned.- pipeline_mem_control
bool, defaultFalse Register memory control signals after generation.
Memories (register-based)