mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #1021 from ucb-bar/fixfirrtl_shr,neg
Fix static shift operands, neg result type, minor formatting
This commit is contained in:
commit
84d91420e4
|
@ -449,8 +449,10 @@ struct FirrtlWorker
|
||||||
string primop;
|
string primop;
|
||||||
bool always_uint = false;
|
bool always_uint = false;
|
||||||
if (cell->type == "$not") primop = "not";
|
if (cell->type == "$not") primop = "not";
|
||||||
else if (cell->type == "$neg") primop = "neg";
|
else if (cell->type == "$neg") {
|
||||||
else if (cell->type == "$logic_not") {
|
primop = "neg";
|
||||||
|
is_signed = true; // Result of "neg" is signed (an SInt).
|
||||||
|
} else if (cell->type == "$logic_not") {
|
||||||
primop = "eq";
|
primop = "eq";
|
||||||
a_expr = stringf("%s, UInt(0)", a_expr.c_str());
|
a_expr = stringf("%s, UInt(0)", a_expr.c_str());
|
||||||
}
|
}
|
||||||
|
@ -562,6 +564,7 @@ struct FirrtlWorker
|
||||||
auto b_sig = cell->getPort("\\B");
|
auto b_sig = cell->getPort("\\B");
|
||||||
if (b_sig.is_fully_const()) {
|
if (b_sig.is_fully_const()) {
|
||||||
primop = "shl";
|
primop = "shl";
|
||||||
|
b_expr = std::to_string(b_sig.as_int());
|
||||||
} else {
|
} else {
|
||||||
primop = "dshl";
|
primop = "dshl";
|
||||||
// Convert from FIRRTL left shift semantics.
|
// Convert from FIRRTL left shift semantics.
|
||||||
|
@ -575,6 +578,7 @@ struct FirrtlWorker
|
||||||
auto b_sig = cell->getPort("\\B");
|
auto b_sig = cell->getPort("\\B");
|
||||||
if (b_sig.is_fully_const()) {
|
if (b_sig.is_fully_const()) {
|
||||||
primop = "shr";
|
primop = "shr";
|
||||||
|
b_expr = std::to_string(b_sig.as_int());
|
||||||
} else {
|
} else {
|
||||||
primop = "dshr";
|
primop = "dshr";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue