abs method
Calculates the absolute value of a signal, assuming that the number is a two's complement.
Implementation
Logic abs() {
if (width == 0) {
return this;
}
return mux(this[-1], ~this + 1, this);
}
Calculates the absolute value of a signal, assuming that the number is a two's complement.
Logic abs() {
if (width == 0) {
return this;
}
return mux(this[-1], ~this + 1, this);
}