width = width_hint;
if (type == AST_MUL)
width = std::min(left.width + right.width, width_hint);
+ if (type == AST_POW)
+ width = width_hint;
}
is_signed = children[0]->is_signed && children[1]->is_signed;
+ if (!flag_noopt && type == AST_POW && left.is_fully_const() && left.as_int() == 2)
+ return binop2rtlil(this, "$shl", width, RTLIL::SigSpec(1, left.width), right);
return binop2rtlil(this, type_name, width, left, right);
}
58: y <= s1 % u2;
59: y <= s1 % s2;
- 60: y <= +u1;
- 61: y <= -u1;
- 62: y <= ~u1;
- 63: y <= !u1;
-
- 64: y <= +s1;
- 65: y <= -s1;
- 66: y <= ~s1;
- 67: y <= !s1;
-
- 68: y <= { &u1, ~&u1, |u1, ~|u1, ^u1, ~^u1, ^~u1 };
- 69: y <= { &s1, ~&s1, |s1, ~|s1, ^s1, ~^s1, ^~s1 };
- 70: y <= { &u1[1:0], ~&u1[1:0], |u1[1:0], ~|u1[1:0], ^u1[1:0], ~^u1[1:0], ^~u1[1:0] };
- 71: y <= { &s1[1:0], ~&s1[1:0], |s1[1:0], ~|s1[1:0], ^s1[1:0], ~^s1[1:0], ^~s1[1:0] };
-
- 72: y <= { u1[1:0] && u2[1:0], u1[1:0] && u2[1:0], !u1[1:0] };
- 73: y <= {4{u1[1:0]}};
- 74: y <= {u1, u2} ^ {s1, s2};
- 75: y <= {u1, u2} & {s1, s2};
-
- 76: y <= u1[0] ? u1 : u2;
- 77: y <= u1[0] ? u1 : s2;
- 78: y <= u1[0] ? s1 : u2;
- 79: y <= u1[0] ? s1 : s2;
+ 60: y <= 4'd2 ** u1;
+ 61: y <= 4'd2 ** s1;
+ 62: y <= 4'sd2 ** u1;
+ 63: y <= 4'sd2 ** s1;
+
+ 64: y <= +u1;
+ 65: y <= -u1;
+ 66: y <= ~u1;
+ 67: y <= !u1;
+
+ 68: y <= +s1;
+ 69: y <= -s1;
+ 70: y <= ~s1;
+ 71: y <= !s1;
+
+ 72: y <= { &u1, ~&u1, |u1, ~|u1, ^u1, ~^u1, ^~u1 };
+ 73: y <= { &s1, ~&s1, |s1, ~|s1, ^s1, ~^s1, ^~s1 };
+ 74: y <= { &u1[1:0], ~&u1[1:0], |u1[1:0], ~|u1[1:0], ^u1[1:0], ~^u1[1:0], ^~u1[1:0] };
+ 75: y <= { &s1[1:0], ~&s1[1:0], |s1[1:0], ~|s1[1:0], ^s1[1:0], ~^s1[1:0], ^~s1[1:0] };
+
+ 76: y <= { u1[1:0] && u2[1:0], u1[1:0] && u2[1:0], !u1[1:0] };
+ 77: y <= {4{u1[1:0]}};
+ 78: y <= {u1, u2} ^ {s1, s2};
+ 79: y <= {u1, u2} & {s1, s2};
+
+ 80: y <= u1[0] ? u1 : u2;
+ 81: y <= u1[0] ? u1 : s2;
+ 82: y <= u1[0] ? s1 : u2;
+ 83: y <= u1[0] ? s1 : s2;
endcase
end