HDL Generation¶
Generation of HDL code.
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
- io_registers
bool, defaultFalse Insert registers on all top-level I/O ports. Equivalent to setting both
input_registerandoutput_register.- input_register
bool, defaultFalse Insert registers on the top-level input ports only.
- output_register
bool, defaultFalse Insert registers on the top-level output ports only.
- multiplexer_control_registered
bool, defaultFalse Register multiplexer control signals in generated top-level.
- enable_pin
bool, defaultTrue Whether to include an enable pin on the top-level entity.
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)
- external_schedule_counter
bool, defaultTrue Use an external schedule counter signal.
- std_logic_vector
bool, defaultFalse Use
std_logic_vectordata.- pipeline_output_mux
bool, defaultFalse Register the output multiplexer select signal.
- pipeline_back_edge_mux
bool, defaultFalse Register the back-edge multiplexer select signal.
- print_vhdl_ls_toml(arch: Architecture, *, path: str | Path = PosixPath('.'), lib_name: str = 'lib') None¶
Write a
vhdl_ls.tomlconfiguration file for the VHDL Language Server.- Parameters:
- arch
Architecture Architecture instance used to determine the file list.
- pathstr | Path, optional
Output directory (same directory where VHDL files were written). Defaults to the current directory.
- lib_namestr, optional
Library name used in the toml file. Defaults to
"lib".
- arch