Module substrate::layout

source ·
Expand description

Substrate’s layout generator framework.

§Examples

§Simple

impl ExportsLayoutData for Inverter {
    type LayoutData = ();
}

impl Layout<ExamplePdk> for Inverter {
    fn layout(
        &self,
        io: &mut Builder<<Self as Block>::Io>,
        cell: &mut substrate::layout::CellBuilder<ExamplePdk>,
    ) -> substrate::error::Result<Self::LayoutData> {
        io.vss.push(IoShape::with_layers(
            cell.ctx.layers.met1,
            Rect::from_sides(25, 0, 75, 25),
        ));
        io.vdd.push(IoShape::with_layers(
            cell.ctx.layers.met1,
            Rect::from_sides(25, 175, 75, 200),
        ));
        io.din.push(IoShape::with_layers(
            cell.ctx.layers.met1,
            Rect::from_sides(0, 50, 25, 150),
        ));
        io.dout.push(IoShape::with_layers(
            cell.ctx.layers.met1,
            Rect::from_sides(75, 50, 100, 150),
        ));
        cell.draw(Shape::new(
            cell.ctx.layers.met1,
            Rect::from_sides(0, 0, 100, 200),
        ))?;
        Ok(())
    }
}

§With data

impl ExportsLayoutData for Buffer {
    type LayoutData = BufferData;
}

impl Layout<ExamplePdk> for Buffer {
    fn layout(
        &self,
        io: &mut Builder<<Self as Block>::Io>,
        cell: &mut CellBuilder<ExamplePdk>,
    ) -> substrate::error::Result<Self::LayoutData> {
        let inv1 = cell.generate(Inverter::new(self.strength));
        let inv2 = inv1.clone().align_bbox(AlignMode::ToTheRight, &inv1, 10);

        cell.draw(inv1.clone())?;
        cell.draw(inv2.clone())?;

        io.vdd.merge(inv1.io().vdd);
        io.vdd.merge(inv2.io().vdd);
        io.vss.merge(inv1.io().vss);
        io.vss.merge(inv2.io().vss);
        io.din.merge(inv1.io().din);
        io.dout.merge(inv2.io().dout);

        Ok(BufferData { inv1, inv2 })
    }
}

Modules§

  • Bounding box utilities.
  • Basic layout elements.
  • Layout result and error types.
  • Utilities for GDS conversion.
  • Tiling structures and helpers.
  • Routing track management.

Structs§

Traits§

Derive Macros§

  • Derives substrate::layout::Layout for any Substrate block.
  • Derives substrate::layout::Data for a struct.