Adder constructor

Adder(
  1. Logic a,
  2. Logic b, {
  3. String name = 'unnamed_module',
})

Takes in input a and input b and return the sum of the addition result. The width of input a and b must be the same.

Implementation

Adder(Logic a, Logic b, {super.name}) {
  if (a.width != b.width) {
    throw RohdHclException('inputs of a and b should have same width.');
  }
  addInput('a', a, width: a.width);
  addInput('b', b, width: b.width);
  addOutput('sum', width: a.width + 1);
}