Derive Macro substrate::layout::Layout

source ·
#[derive(Layout)]
{
    // Attributes available to this derive:
    #[substrate]
}
Expand description

Derives substrate::layout::Layout for any Substrate block.

This turns the block into a layout hard macro. You must add a #[substrate(layout(...))] attribute to configure this macro; see the examples below. Using multiple #[substrate(layout(...))] attributes allows you to generate Layout implementations for multiple PDKs.

This macro only works on Substrate blocks, so you must also add a #[derive(Block)] attribute or implement Block manually.

§Arguments

This macro requires the following arguments (see Supported formats for more details):

  • source: The source from which to read the contents of this block’s layout.
  • name: The name of the block’s contents in source. For example, if source is a GDS library file, name should be set to the name of the desired cell in that file.
  • fmt: The layout source format.
  • pdk: The PDK to which source corresponds.

§Supported formats

The following formats are supported:

  • gds: Source should be an expression that evaluates to the file path of a GDSII library.

Note that expressions can be arbitrary Rust expressions. Here are some examples:

  • fmt = "\"/path/to/layout.gds\"" (note that you need the escaped quotes to make this a string literal).
  • fmt = "function_that_returns_path()"
  • fmt = "function_with_arguments_that_returns_path(\"my_argument\")"