Fix handling of $shiftx in Verilog back-end
authorClifford Wolf <clifford@clifford.at>
Tue, 15 Jan 2019 09:55:27 +0000 (10:55 +0100)
committerClifford Wolf <clifford@clifford.at>
Tue, 15 Jan 2019 09:55:27 +0000 (10:55 +0100)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
backends/verilog/verilog_backend.cc

index 2537e18e515edeca8c39aa0368baf0951429c594..8da3c0627363b24c1736d9fada6166242253f794 100644 (file)
@@ -709,11 +709,14 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell)
 
        if (cell->type == "$shiftx")
        {
+               std::string temp_id = next_auto_id();
+               f << stringf("%s" "wire [%d:0] %s = ", indent.c_str(), GetSize(cell->getPort("\\A"))-1, temp_id.c_str());
+               dump_sigspec(f, cell->getPort("\\A"));
+               f << stringf(";\n");
+
                f << stringf("%s" "assign ", indent.c_str());
                dump_sigspec(f, cell->getPort("\\Y"));
-               f << stringf(" = ");
-               dump_sigspec(f, cell->getPort("\\A"));
-               f << stringf("[");
+               f << stringf(" = %s[", temp_id.c_str());
                if (cell->getParam("\\B_SIGNED").as_bool())
                        f << stringf("$signed(");
                dump_sigspec(f, cell->getPort("\\B"));