yosys/docs/source/code_examples/extensions/absval_ref.v

4 lines
94 B
Verilog

module absval_ref(input signed [3:0] a, output [3:0] y);
assign y = a[3] ? -a : a;
endmodule