33 lines
1.2 KiB
Systemverilog
33 lines
1.2 KiB
Systemverilog
// Generated by CIRCT firtool-1.151.0
|
|
module AMOALU(
|
|
input [7:0] io_mask,
|
|
input [4:0] io_cmd,
|
|
input [63:0] io_lhs,
|
|
io_rhs,
|
|
output [63:0] io_out_unmasked
|
|
);
|
|
|
|
wire _logic_xor_T_1 = io_cmd == 5'hA;
|
|
wire logic_and = _logic_xor_T_1 | io_cmd == 5'hB;
|
|
wire logic_xor = io_cmd == 5'h9 | _logic_xor_T_1;
|
|
wire [63:0] adder_out_mask = {32'hFFFFFFFF, io_mask[3], 31'h7FFFFFFF};
|
|
assign io_out_unmasked =
|
|
io_cmd == 5'h8
|
|
? (io_lhs & adder_out_mask) + (io_rhs & adder_out_mask)
|
|
: logic_and | logic_xor
|
|
? (logic_and ? io_lhs & io_rhs : 64'h0) | (logic_xor ? io_lhs ^ io_rhs : 64'h0)
|
|
: ((io_mask[4]
|
|
? (io_lhs[63] == io_rhs[63]
|
|
? io_lhs[63:32] < io_rhs[63:32] | io_lhs[63:32] == io_rhs[63:32]
|
|
& io_lhs[31:0] < io_rhs[31:0]
|
|
: io_cmd[1] ? io_rhs[63] : io_lhs[63])
|
|
: io_lhs[31] == io_rhs[31]
|
|
? io_lhs[31:0] < io_rhs[31:0]
|
|
: io_cmd[1] ? io_rhs[31] : io_lhs[31])
|
|
? io_cmd == 5'hC | io_cmd == 5'hE
|
|
: io_cmd == 5'hD | io_cmd == 5'hF)
|
|
? io_lhs
|
|
: io_rhs;
|
|
endmodule
|
|
|