svgb/rtl/cpu/alu16.sv

22 lines
465 B
Systemverilog
Raw Normal View History

`include "cpu_pkg.svh"
import cpu_pkg::*;
module alu16 (
input logic [15:0] operand_in_i,
output logic [15:0] operand_out_o,
input logic increment_i,
input logic decrement_i
);
logic [15:0] op_inc;
logic [15:0] op_dec;
assign op_inc = (operand_in_i + 16'h01);
assign op_dec = (operand_in_i - 16'h01);
assign operand_out_o = ({16{increment_i}} & op_inc) |
({16{decrement_i}} & op_dec);
endmodule : alu16