RSSAmplifier

kate's lab notebook · Aug 18, 2021

Including non-Amaranth Instances in Amaranth [repost]

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

A common question in the #amaranth-lang Libera.Chat channel asks how one can include a non-Amaranth component—e.g. a library cell or a component from a Verilog design—so it seemed worth writing up a quick note we can link to answer that. 
 Invoking a Component 
 The key is to create an amaranth.Instance component, as in the following example: 
 m . submodules . my_component…

A common question in the #amaranth-lang Libera.Chat channel asks how one can include a non-Amaranth component—e.g. a library cell or a component from a Verilog design—so it seemed worth writing up a quick note we can link to answer that.

Invoking a Component

The key is to create an amaranth.Instance component, as in the following example:

m.submodules.my_component = Instance("CustomFlipFlop",
		# Attributes
		a_HasAsyncReset = False,
		
		# Parameters
		p_NumberInputs  = "1",
		p_NumberOutputs = "1",

		# Inputs
		i_D = my_input_signal,
		
		# Ouptuts
		o_Q = my_output_signal,
		
		# Bidirectional / inouts
		io_DZ = my_tristate_pin
)

The first parameter to the Instance constructor is the name of the component to be instantiated, which usually matches e.g. your library cell instance, or your Verilog module name. The remaining (keyword) arguments are the inputs and outputs to the Instance. As these inputs/outputs to this function currently lack type information, we’ll need to prefix each name with a short prefix, depending on its type:

Read on /post/amaranth-instance/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.