addInput method
Registers a signal as an input to this Module and returns an input port that can be consumed.
The return value is the same as what is returned by input and should
only be used within this Module. The provided source
is accessible via
inputSource.
Implementation
Logic addInput(String name, Logic source, {int width = 1}) {
_checkForSafePortName(name);
if (source.width != width) {
throw PortWidthMismatchException(source, width);
}
if (source is LogicStructure) {
// ignore: parameter_assignments
source = source.packed;
}
final inPort = Logic(name: name, width: width, naming: Naming.reserved)
..gets(source)
// ignore: invalid_use_of_protected_member
..parentModule = this;
_inputs[name] = inPort;
_inputSources[name] = source;
return inPort;
}