Pad constructor

Pad(
  1. Logic inp, {
  2. required int atLeast,
  3. bool lsbs = true,
  4. bool fill = false,
  5. String name = 'pad',
  6. bool reserveName = false,
  7. bool reserveDefinitionName = false,
  8. String? definitionName,
})

Creates padding hardware for inp.

Implementation

Pad(
  Logic inp, {
  required int atLeast,
  bool lsbs = true,
  bool fill = false,
  super.name = 'pad',
  super.reserveName,
  super.reserveDefinitionName,
  String? definitionName,
}) : super(
          definitionName: definitionName ??
              'Pad_${lsbs ? 'Lsbs' : 'Msbs'}_F${fill ? 1 : 0}_'
                  'W${inp.width}_A$atLeast') {
  inp = addInput('inp', inp, width: inp.width);

  final padded = inp.pad(atLeast: atLeast, lsbs: lsbs, fill: fill);
  addOutput('result', width: padded.width) <= padded;
}