Logic.from constructor

Logic.from(
  1. Logic source, {
  2. String? name,
  3. Naming? naming,
})

Creates an ordinary Logic alias driven by source.

The alias has a plain Logic representation even when source is a Const, LogicNet, or structured signal. Use this at the source boundary of an operation that materializes a driveable result, such as flop(clk, Logic.from(Const(1))).

The width is copied from source. If name is omitted, the source's name is reused. The naming is chosen by Naming.chooseCloneNaming.

The alias remains connected to source, so it cannot accept another hardware driver. A Const source remains immutable.

Implementation

factory Logic.from(Logic source, {String? name, Naming? naming}) => Logic(
      name: name ?? source.name,
      width: source.width,
      naming: Naming.chooseCloneNaming(
        originalName: source.name,
        newName: name,
        originalNaming: source.naming,
        newNaming: naming,
      ),
    )..gets(source);