Import more std:: stuff into Yosys namespace
authorClifford Wolf <clifford@clifford.at>
Sun, 25 Oct 2015 18:30:49 +0000 (19:30 +0100)
committerClifford Wolf <clifford@clifford.at>
Sun, 25 Oct 2015 18:30:49 +0000 (19:30 +0100)
39 files changed:
backends/smt2/smt2.cc
backends/smv/smv.cc
frontends/ast/genrtlil.cc
frontends/ast/simplify.cc
frontends/ilang/ilang_parser.y
frontends/verific/verific.cc
kernel/calc.cc
kernel/cellaigs.cc
kernel/driver.cc
kernel/macc.h
kernel/rtlil.cc
kernel/satgen.h
kernel/yosys.h
passes/cmds/edgetypes.cc
passes/cmds/plugin.cc
passes/cmds/qwp.cc
passes/cmds/scc.cc
passes/cmds/splitnets.cc
passes/cmds/stat.cc
passes/equiv/equiv_add.cc
passes/fsm/fsmdata.h
passes/hierarchy/hierarchy.cc
passes/memory/memory_bram.cc
passes/memory/memory_collect.cc
passes/memory/memory_share.cc
passes/opt/opt_const.cc
passes/opt/share.cc
passes/opt/wreduce.cc
passes/sat/eval.cc
passes/sat/freduce.cc
passes/sat/sat.cc
passes/techmap/abc.cc
passes/techmap/alumacc.cc
passes/techmap/dffinit.cc
passes/techmap/extract.cc
passes/techmap/maccmap.cc
passes/techmap/muxcover.cc
passes/techmap/simplemap.cc
passes/tests/test_cell.cc

index fa1c284dc4eaba2f204946b26efdf8422203ee01..c852921eed498fe800b4234fb49cd7db0b5cc344 100644 (file)
@@ -244,8 +244,8 @@ struct Smt2Worker
                int width = GetSize(sig_y);
 
                if (type == 's' || type == 'd' || type == 'b') {
-                       width = std::max(width, GetSize(cell->getPort("\\A")));
-                       width = std::max(width, GetSize(cell->getPort("\\B")));
+                       width = max(width, GetSize(cell->getPort("\\A")));
+                       width = max(width, GetSize(cell->getPort("\\B")));
                }
 
                if (cell->hasPort("\\A")) {
index fdf022c5aac67c3d57a034a06f56ba0adbde9229..b29a88ac26e95c7ee17affd4f696d80add6b4292 100644 (file)
@@ -244,13 +244,13 @@ struct SmvWorker
 
                                int width_y = GetSize(cell->getPort("\\Y"));
                                int shift_b_width = GetSize(sig_b);
-                               int width_ay = std::max(GetSize(sig_a), width_y);
+                               int width_ay = max(GetSize(sig_a), width_y);
                                int width = width_ay;
 
                                for (int i = 1, j = 0;; i <<= 1, j++)
                                        if (width_ay < i) {
                                                width = i-1;
-                                               shift_b_width = std::min(shift_b_width, j);
+                                               shift_b_width = min(shift_b_width, j);
                                                break;
                                        }
 
@@ -361,8 +361,8 @@ struct SmvWorker
                        if (cell->type.in("$div", "$mod"))
                        {
                                int width_y = GetSize(cell->getPort("\\Y"));
-                               int width = std::max(width_y, GetSize(cell->getPort("\\A")));
-                               width = std::max(width, GetSize(cell->getPort("\\B")));
+                               int width = max(width_y, GetSize(cell->getPort("\\A")));
+                               width = max(width, GetSize(cell->getPort("\\B")));
                                string expr_a, expr_b, op;
 
                                if (cell->type == "$div")  op = "/";
@@ -384,7 +384,7 @@ struct SmvWorker
 
                        if (cell->type.in("$eq", "$ne", "$eqx", "$nex", "$lt", "$le", "$ge", "$gt"))
                        {
-                               int width = std::max(GetSize(cell->getPort("\\A")), GetSize(cell->getPort("\\B")));
+                               int width = max(GetSize(cell->getPort("\\A")), GetSize(cell->getPort("\\B")));
                                string expr_a, expr_b, op;
 
                                if (cell->type == "$eq")  op = "=";
index c322faf7bcf3432762241fce55b0409242e3215e..fd242fe2ee6487078c6b88d86e759446fe552709 100644 (file)
@@ -547,14 +547,14 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
        switch (type)
        {
        case AST_CONSTANT:
-               width_hint = std::max(width_hint, int(bits.size()));
+               width_hint = max(width_hint, int(bits.size()));
                if (!is_signed)
                        sign_hint = false;
                break;
 
        case AST_REALVALUE:
                *found_real = true;
-               width_hint = std::max(width_hint, 32);
+               width_hint = max(width_hint, 32);
                break;
 
        case AST_IDENTIFIER:
@@ -617,7 +617,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
                                this_width = range->range_left - range->range_right + 1;
                        sign_hint = false;
                }
-               width_hint = std::max(width_hint, this_width);
+               width_hint = max(width_hint, this_width);
                if (!id_ast->is_signed)
                        sign_hint = false;
                break;
@@ -627,7 +627,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
                if (children[0]->type != AST_CONSTANT)
                        log_error("Left operand of tobits expression is not constant at %s:%d!\n", filename.c_str(), linenum);
                children[1]->detectSignWidthWorker(sub_width_hint, sign_hint);
-               width_hint = std::max(width_hint, children[0]->bitsAsConst().as_int());
+               width_hint = max(width_hint, children[0]->bitsAsConst().as_int());
                break;
 
        case AST_TO_SIGNED:
@@ -646,7 +646,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
                        child->detectSignWidthWorker(sub_width_hint, sub_sign_hint);
                        this_width += sub_width_hint;
                }
-               width_hint = std::max(width_hint, this_width);
+               width_hint = max(width_hint, this_width);
                sign_hint = false;
                break;
 
@@ -655,7 +655,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
                if (children[0]->type != AST_CONSTANT)
                        log_error("Left operand of replicate expression is not constant at %s:%d!\n", filename.c_str(), linenum);
                children[1]->detectSignWidthWorker(sub_width_hint, sub_sign_hint);
-               width_hint = std::max(width_hint, children[0]->bitsAsConst().as_int() * sub_width_hint);
+               width_hint = max(width_hint, children[0]->bitsAsConst().as_int() * sub_width_hint);
                sign_hint = false;
                break;
 
@@ -678,7 +678,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
        case AST_REDUCE_XOR:
        case AST_REDUCE_XNOR:
        case AST_REDUCE_BOOL:
-               width_hint = std::max(width_hint, 1);
+               width_hint = max(width_hint, 1);
                sign_hint = false;
                break;
 
@@ -698,7 +698,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
        case AST_NEX:
        case AST_GE:
        case AST_GT:
-               width_hint = std::max(width_hint, 1);
+               width_hint = max(width_hint, 1);
                sign_hint = false;
                break;
 
@@ -714,7 +714,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
        case AST_LOGIC_AND:
        case AST_LOGIC_OR:
        case AST_LOGIC_NOT:
-               width_hint = std::max(width_hint, 1);
+               width_hint = max(width_hint, 1);
                sign_hint = false;
                break;
 
@@ -729,7 +729,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
                if (!id2ast->children[0]->range_valid)
                        log_error("Failed to detect with of memory access `%s' at %s:%d!\n", str.c_str(), filename.c_str(), linenum);
                this_width = id2ast->children[0]->range_left - id2ast->children[0]->range_right + 1;
-               width_hint = std::max(width_hint, this_width);
+               width_hint = max(width_hint, this_width);
                break;
 
        // everything should have been handled above -> print error if not.
@@ -1054,7 +1054,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                                detectSignWidth(width_hint, sign_hint);
                        RTLIL::SigSpec left = children[0]->genRTLIL(width_hint, sign_hint);
                        RTLIL::SigSpec right = children[1]->genRTLIL(width_hint, sign_hint);
-                       int width = std::max(left.size(), right.size());
+                       int width = max(left.size(), right.size());
                        if (width_hint > 0)
                                width = width_hint;
                        is_signed = children[0]->is_signed && children[1]->is_signed;
@@ -1068,7 +1068,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
        if (0) { case AST_REDUCE_XNOR: type_name = "$reduce_xnor"; }
                {
                        RTLIL::SigSpec arg = children[0]->genRTLIL();
-                       RTLIL::SigSpec sig = uniop2rtlil(this, type_name, std::max(width_hint, 1), arg);
+                       RTLIL::SigSpec sig = uniop2rtlil(this, type_name, max(width_hint, 1), arg);
                        return sig;
                }
 
@@ -1077,7 +1077,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
        if (0) { case AST_REDUCE_BOOL:  type_name = "$reduce_bool"; }
                {
                        RTLIL::SigSpec arg = children[0]->genRTLIL();
-                       RTLIL::SigSpec sig = arg.size() > 1 ? uniop2rtlil(this, type_name, std::max(width_hint, 1), arg) : arg;
+                       RTLIL::SigSpec sig = arg.size() > 1 ? uniop2rtlil(this, type_name, max(width_hint, 1), arg) : arg;
                        return sig;
                }
 
@@ -1123,7 +1123,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
        if (0) { case AST_GE:  type_name = "$ge"; }
        if (0) { case AST_GT:  type_name = "$gt"; }
                {
-                       int width = std::max(width_hint, 1);
+                       int width = max(width_hint, 1);
                        width_hint = -1, sign_hint = true;
                        children[0]->detectSignWidthWorker(width_hint, sign_hint);
                        children[1]->detectSignWidthWorker(width_hint, sign_hint);
@@ -1145,7 +1145,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                        RTLIL::SigSpec left = children[0]->genRTLIL(width_hint, sign_hint);
                        RTLIL::SigSpec right = children[1]->genRTLIL(width_hint, sign_hint);
                #if 0
-                       int width = std::max(left.size(), right.size());
+                       int width = max(left.size(), right.size());
                        if (width > width_hint && width_hint > 0)
                                width = width_hint;
                        if (width < width_hint) {
@@ -1154,10 +1154,10 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                                if (type == AST_SUB && (!children[0]->is_signed || !children[1]->is_signed))
                                        width = width_hint;
                                if (type == AST_MUL)
-                                       width = std::min(left.size() + right.size(), width_hint);
+                                       width = min(left.size() + right.size(), width_hint);
                        }
                #else
-                       int width = std::max(std::max(left.size(), right.size()), width_hint);
+                       int width = max(max(left.size(), right.size()), width_hint);
                #endif
                        is_signed = children[0]->is_signed && children[1]->is_signed;
                        return binop2rtlil(this, type_name, width, left, right);
@@ -1169,14 +1169,14 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                {
                        RTLIL::SigSpec left = children[0]->genRTLIL();
                        RTLIL::SigSpec right = children[1]->genRTLIL();
-                       return binop2rtlil(this, type_name, std::max(width_hint, 1), left, right);
+                       return binop2rtlil(this, type_name, max(width_hint, 1), left, right);
                }
 
        // generate cells for unary operations: $logic_not
        case AST_LOGIC_NOT:
                {
                        RTLIL::SigSpec arg = children[0]->genRTLIL();
-                       return uniop2rtlil(this, "$logic_not", std::max(width_hint, 1), arg);
+                       return uniop2rtlil(this, "$logic_not", max(width_hint, 1), arg);
                }
 
        // generate multiplexer for ternary operator (aka ?:-operator)
@@ -1192,7 +1192,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                        if (cond.size() > 1)
                                cond = uniop2rtlil(this, "$reduce_bool", 1, cond, false);
 
-                       int width = std::max(val1.size(), val2.size());
+                       int width = max(val1.size(), val2.size());
                        is_signed = children[1]->is_signed && children[2]->is_signed;
                        widthExtend(this, val1, width, is_signed);
                        widthExtend(this, val2, width, is_signed);
index 861c3bcc0805a3423357741c7162468ef6f35d83..6cda7235e11b6e9fc1c5d1870c840d12dae8bc44 100644 (file)
@@ -398,7 +398,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                        did_something = true;
                children[0]->detectSignWidth(backup_width_hint, backup_sign_hint);
                children[1]->detectSignWidth(width_hint, sign_hint);
-               width_hint = std::max(width_hint, backup_width_hint);
+               width_hint = max(width_hint, backup_width_hint);
                child_0_is_self_determined = true;
                break;
 
@@ -412,7 +412,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                                did_something = true;
                        if (!children[1]->range_valid)
                                log_error("Non-constant width range on parameter decl at %s:%d.\n", filename.c_str(), linenum);
-                       width_hint = std::max(width_hint, children[1]->range_left - children[1]->range_right + 1);
+                       width_hint = max(width_hint, children[1]->range_left - children[1]->range_right + 1);
                }
                break;
 
@@ -733,8 +733,8 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                for (auto range : children[1]->children) {
                        if (!range->range_valid)
                                log_error("Non-constant range on memory decl at %s:%d.\n", filename.c_str(), linenum);
-                       multirange_dimensions.push_back(std::min(range->range_left, range->range_right));
-                       multirange_dimensions.push_back(std::max(range->range_left, range->range_right) - std::min(range->range_left, range->range_right) + 1);
+                       multirange_dimensions.push_back(min(range->range_left, range->range_right));
+                       multirange_dimensions.push_back(max(range->range_left, range->range_right) - min(range->range_left, range->range_right) + 1);
                        total_size *= multirange_dimensions.back();
                }
                delete children[1];
@@ -1169,7 +1169,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                        log_error("Non-constant array range on cell array at %s:%d.\n", filename.c_str(), linenum);
 
                newNode = new AstNode(AST_GENBLOCK);
-               int num = std::max(children.at(0)->range_left, children.at(0)->range_right) - std::min(children.at(0)->range_left, children.at(0)->range_right) + 1;
+               int num = max(children.at(0)->range_left, children.at(0)->range_right) - min(children.at(0)->range_left, children.at(0)->range_right) + 1;
 
                for (int i = 0; i < num; i++) {
                        int idx = children.at(0)->range_left > children.at(0)->range_right ? children.at(0)->range_right + i : children.at(0)->range_right - i;
@@ -2043,7 +2043,7 @@ skip_dynamic_range_lvalue_expansion:;
                if (0) { case AST_GE:  const_func = RTLIL::const_ge; }
                if (0) { case AST_GT:  const_func = RTLIL::const_gt; }
                        if (children[0]->type == AST_CONSTANT && children[1]->type == AST_CONSTANT) {
-                               int cmp_width = std::max(children[0]->bits.size(), children[1]->bits.size());
+                               int cmp_width = max(children[0]->bits.size(), children[1]->bits.size());
                                bool cmp_signed = children[0]->is_signed && children[1]->is_signed;
                                RTLIL::Const y = const_func(children[0]->bitsAsConst(cmp_width, cmp_signed),
                                                children[1]->bitsAsConst(cmp_width, cmp_signed), cmp_signed, cmp_signed, 1);
@@ -2236,7 +2236,7 @@ AstNode *AstNode::readmem(bool is_readmemh, std::string mem_filename, AstNode *m
 
        log_assert(GetSize(memory->children) == 2 && memory->children[1]->type == AST_RANGE && memory->children[1]->range_valid);
        int range_left =  memory->children[1]->range_left, range_right =  memory->children[1]->range_right;
-       int range_min = std::min(range_left, range_right), range_max = std::max(range_left, range_right);
+       int range_min = min(range_left, range_right), range_max = max(range_left, range_right);
 
        if (start_addr < 0)
                start_addr = range_min;
@@ -2720,7 +2720,7 @@ void AstNode::meminfo(int &mem_width, int &mem_size, int &addr_bits)
 
        if (mem_size < 0)
                mem_size *= -1;
-       mem_size += std::min(children[1]->range_left, children[1]->range_right) + 1;
+       mem_size += min(children[1]->range_left, children[1]->range_right) + 1;
 
        addr_bits = 1;
        while ((1 << addr_bits) < mem_size)
@@ -2756,8 +2756,8 @@ void AstNode::replace_variables(std::map<std::string, AstNode::varinfo_t> &varia
                        if (!children.at(0)->range_valid)
                                log_error("Non-constant range in %s:%d (called from %s:%d).\n",
                                                filename.c_str(), linenum, fcall->filename.c_str(), fcall->linenum);
-                       offset = std::min(children.at(0)->range_left, children.at(0)->range_right);
-                       width = std::min(std::abs(children.at(0)->range_left - children.at(0)->range_right) + 1, width);
+                       offset = min(children.at(0)->range_left, children.at(0)->range_right);
+                       width = min(std::abs(children.at(0)->range_left - children.at(0)->range_right) + 1, width);
                }
                offset -= variables.at(str).offset;
                std::vector<RTLIL::State> &var_bits = variables.at(str).val.bits;
@@ -2797,7 +2797,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall)
                                log_error("Can't determine size of variable %s in %s:%d (called from %s:%d).\n",
                                                child->str.c_str(), child->filename.c_str(), child->linenum, fcall->filename.c_str(), fcall->linenum);
                        variables[child->str].val = RTLIL::Const(RTLIL::State::Sx, abs(child->range_left - child->range_right)+1);
-                       variables[child->str].offset = std::min(child->range_left, child->range_right);
+                       variables[child->str].offset = min(child->range_left, child->range_right);
                        variables[child->str].is_signed = child->is_signed;
                        if (child->is_input && argidx < fcall->children.size())
                                variables[child->str].val = fcall->children.at(argidx++)->bitsAsConst(variables[child->str].val.bits.size());
@@ -2856,7 +2856,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall)
                                if (!range->range_valid)
                                        log_error("Non-constant range in %s:%d (called from %s:%d).\n",
                                                        range->filename.c_str(), range->linenum, fcall->filename.c_str(), fcall->linenum);
-                               int offset = std::min(range->range_left, range->range_right);
+                               int offset = min(range->range_left, range->range_right);
                                int width = std::abs(range->range_left - range->range_right) + 1;
                                varinfo_t &v = variables[stmt->children.at(0)->str];
                                RTLIL::Const r = stmt->children.at(1)->bitsAsConst(v.val.bits.size());
index 6090fabe578efe618d8b079effab270c3b48d3d2..b49fd6740194fe4c6ae1fef2827dfeb609669584 100644 (file)
@@ -121,7 +121,7 @@ attr_stmt:
 
 autoidx_stmt:
        TOK_AUTOIDX TOK_INT EOL {
-               autoidx = std::max(autoidx, $2);
+               autoidx = max(autoidx, $2);
        };
 
 wire_stmt:
index 793c068444e963e4498ec24bd2720c8e6fb33bb8..9212cc0ffca91700e275de269a94b661c8212595 100644 (file)
@@ -541,7 +541,7 @@ static void import_netlist(RTLIL::Design *design, Netlist *nl, std::set<Netlist*
                // log("  importing portbus %s.\n", portbus->Name());
 
                RTLIL::Wire *wire = module->addWire(RTLIL::escape_id(portbus->Name()), portbus->Size());
-               wire->start_offset = std::min(portbus->LeftIndex(), portbus->RightIndex());
+               wire->start_offset = min(portbus->LeftIndex(), portbus->RightIndex());
                import_attributes(wire->attributes, portbus);
 
                if (portbus->GetDir() == DIR_INOUT || portbus->GetDir() == DIR_IN)
@@ -580,11 +580,11 @@ static void import_netlist(RTLIL::Design *design, Netlist *nl, std::set<Netlist*
                        int bits_in_word = number_of_bits;
                        FOREACH_PORTREF_OF_NET(net, si, pr) {
                                if (pr->GetInst()->Type() == OPER_READ_PORT) {
-                                       bits_in_word = std::min<int>(bits_in_word, pr->GetInst()->OutputSize());
+                                       bits_in_word = min<int>(bits_in_word, pr->GetInst()->OutputSize());
                                        continue;
                                }
                                if (pr->GetInst()->Type() == OPER_WRITE_PORT || pr->GetInst()->Type() == OPER_CLOCKED_WRITE_PORT) {
-                                       bits_in_word = std::min<int>(bits_in_word, pr->GetInst()->Input2Size());
+                                       bits_in_word = min<int>(bits_in_word, pr->GetInst()->Input2Size());
                                        continue;
                                }
                                log_error("Verific RamNet %s is connected to unsupported instance type %s (%s).\n",
@@ -630,7 +630,7 @@ static void import_netlist(RTLIL::Design *design, Netlist *nl, std::set<Netlist*
 
                        RTLIL::IdString wire_name = module->uniquify(RTLIL::escape_id(netbus->Name()));
                        RTLIL::Wire *wire = module->addWire(wire_name, netbus->Size());
-                       wire->start_offset = std::min(netbus->LeftIndex(), netbus->RightIndex());
+                       wire->start_offset = min(netbus->LeftIndex(), netbus->RightIndex());
                        import_attributes(wire->attributes, netbus);
 
                        for (int i = netbus->LeftIndex();; i += netbus->IsUp() ? +1 : -1) {
@@ -752,7 +752,7 @@ static void import_netlist(RTLIL::Design *design, Netlist *nl, std::set<Netlist*
                        if (pr->GetPort()->Bus()) {
                                port_name = pr->GetPort()->Bus()->Name();
                                port_offset = pr->GetPort()->Bus()->IndexOf(pr->GetPort()) -
-                                               std::min(pr->GetPort()->Bus()->LeftIndex(), pr->GetPort()->Bus()->RightIndex());
+                                               min(pr->GetPort()->Bus()->LeftIndex(), pr->GetPort()->Bus()->RightIndex());
                        }
                        RTLIL::SigSpec conn;
                        if (cell->hasPort(RTLIL::escape_id(port_name)))
index 32c06c189d4bdb84798663db62c0ce21fe6fd719..a24fa2abf85fab0893afcc96ec2d0c088e52ef9c 100644 (file)
@@ -154,7 +154,7 @@ static RTLIL::Const logic_wrapper(RTLIL::State(*logic_func)(RTLIL::State, RTLIL:
                RTLIL::Const arg1, RTLIL::Const arg2, bool signed1, bool signed2, int result_len = -1)
 {
        if (result_len < 0)
-               result_len = std::max(arg1.bits.size(), arg2.bits.size());
+               result_len = max(arg1.bits.size(), arg2.bits.size());
 
        extend_u0(arg1, result_len, signed1);
        extend_u0(arg2, result_len, signed2);
@@ -310,7 +310,7 @@ RTLIL::Const RTLIL::const_shl(const RTLIL::Const &arg1, const RTLIL::Const &arg2
 RTLIL::Const RTLIL::const_shr(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool, int result_len)
 {
        RTLIL::Const arg1_ext = arg1;
-       extend_u0(arg1_ext, std::max(result_len, GetSize(arg1)), signed1);
+       extend_u0(arg1_ext, max(result_len, GetSize(arg1)), signed1);
        return const_shift_worker(arg1_ext, arg2, false, +1, result_len);
 }
 
@@ -389,7 +389,7 @@ RTLIL::Const RTLIL::const_eq(const RTLIL::Const &arg1, const RTLIL::Const &arg2,
        RTLIL::Const arg2_ext = arg2;
        RTLIL::Const result(RTLIL::State::S0, result_len);
 
-       int width = std::max(arg1_ext.bits.size(), arg2_ext.bits.size());
+       int width = max(arg1_ext.bits.size(), arg2_ext.bits.size());
        extend_u0(arg1_ext, width, signed1 && signed2);
        extend_u0(arg2_ext, width, signed1 && signed2);
 
@@ -423,7 +423,7 @@ RTLIL::Const RTLIL::const_eqx(const RTLIL::Const &arg1, const RTLIL::Const &arg2
        RTLIL::Const arg2_ext = arg2;
        RTLIL::Const result(RTLIL::State::S0, result_len);
 
-       int width = std::max(arg1_ext.bits.size(), arg2_ext.bits.size());
+       int width = max(arg1_ext.bits.size(), arg2_ext.bits.size());
        extend_u0(arg1_ext, width, signed1 && signed2);
        extend_u0(arg2_ext, width, signed1 && signed2);
 
@@ -472,21 +472,21 @@ RTLIL::Const RTLIL::const_add(const RTLIL::Const &arg1, const RTLIL::Const &arg2
 {
        int undef_bit_pos = -1;
        BigInteger y = const2big(arg1, signed1, undef_bit_pos) + const2big(arg2, signed2, undef_bit_pos);
-       return big2const(y, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), undef_bit_pos);
+       return big2const(y, result_len >= 0 ? result_len : max(arg1.bits.size(), arg2.bits.size()), undef_bit_pos);
 }
 
 RTLIL::Const RTLIL::const_sub(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
 {
        int undef_bit_pos = -1;
        BigInteger y = const2big(arg1, signed1, undef_bit_pos) - const2big(arg2, signed2, undef_bit_pos);
-       return big2const(y, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), undef_bit_pos);
+       return big2const(y, result_len >= 0 ? result_len : max(arg1.bits.size(), arg2.bits.size()), undef_bit_pos);
 }
 
 RTLIL::Const RTLIL::const_mul(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
 {
        int undef_bit_pos = -1;
        BigInteger y = const2big(arg1, signed1, undef_bit_pos) * const2big(arg2, signed2, undef_bit_pos);
-       return big2const(y, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0));
+       return big2const(y, result_len >= 0 ? result_len : max(arg1.bits.size(), arg2.bits.size()), min(undef_bit_pos, 0));
 }
 
 RTLIL::Const RTLIL::const_div(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
@@ -499,7 +499,7 @@ RTLIL::Const RTLIL::const_div(const RTLIL::Const &arg1, const RTLIL::Const &arg2
        bool result_neg = (a.getSign() == BigInteger::negative) != (b.getSign() == BigInteger::negative);
        a = a.getSign() == BigInteger::negative ? -a : a;
        b = b.getSign() == BigInteger::negative ? -b : b;
-       return big2const(result_neg ? -(a / b) : (a / b), result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0));
+       return big2const(result_neg ? -(a / b) : (a / b), result_len >= 0 ? result_len : max(arg1.bits.size(), arg2.bits.size()), min(undef_bit_pos, 0));
 }
 
 RTLIL::Const RTLIL::const_mod(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
@@ -512,7 +512,7 @@ RTLIL::Const RTLIL::const_mod(const RTLIL::Const &arg1, const RTLIL::Const &arg2
        bool result_neg = a.getSign() == BigInteger::negative;
        a = a.getSign() == BigInteger::negative ? -a : a;
        b = b.getSign() == BigInteger::negative ? -b : b;
-       return big2const(result_neg ? -(a % b) : (a % b), result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0));
+       return big2const(result_neg ? -(a % b) : (a % b), result_len >= 0 ? result_len : max(arg1.bits.size(), arg2.bits.size()), min(undef_bit_pos, 0));
 }
 
 RTLIL::Const RTLIL::const_pow(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
@@ -563,7 +563,7 @@ RTLIL::Const RTLIL::const_pow(const RTLIL::Const &arg1, const RTLIL::Const &arg2
                        y *= -1;
        }
 
-       return big2const(y, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0));
+       return big2const(y, result_len >= 0 ? result_len : max(arg1.bits.size(), arg2.bits.size()), min(undef_bit_pos, 0));
 }
 
 RTLIL::Const RTLIL::const_pos(const RTLIL::Const &arg1, const RTLIL::Const&, bool signed1, bool, int result_len)
index be2e7bbb8c45698db31695abb914dd0f764c811e..41f81355d258ecad6da46dcdc09475d38f5e9629 100644 (file)
@@ -392,7 +392,7 @@ Aig::Aig(Cell *cell)
 
        if (cell->type.in("$eq", "$ne"))
        {
-               int width = std::max(GetSize(cell->getPort("\\A")), GetSize(cell->getPort("\\B")));
+               int width = max(GetSize(cell->getPort("\\A")), GetSize(cell->getPort("\\B")));
                vector<int> A = mk.inport_vec("\\A", width);
                vector<int> B = mk.inport_vec("\\B", width);
                int Y = mk.bool_node(false);
index 95835951ec8ca1b31cdd7d4fb17f4881fea14b9f..02e332f901df856e490f2efbab5f2420ac64b3a8 100644 (file)
@@ -404,7 +404,7 @@ int main(int argc, char **argv)
                log("%s\n", yosys_version_str);
 
                int64_t total_ns = 0;
-               std::set<std::tuple<int64_t, int, std::string>> timedat;
+               std::set<tuple<int64_t, int, std::string>> timedat;
 
                for (auto &it : pass_register)
                        if (it.second->call_counter) {
index 7efd022816e6f922fb46889920f589c85450777e..286ce567faa2297cf1b21c146527c276aac06f06 100644 (file)
@@ -158,8 +158,8 @@ struct Macc
                int max_size = 0, num_bits = 0;
 
                for (auto &port : ports) {
-                       max_size = std::max(max_size, GetSize(port.in_a));
-                       max_size = std::max(max_size, GetSize(port.in_b));
+                       max_size = max(max_size, GetSize(port.in_a));
+                       max_size = max(max_size, GetSize(port.in_b));
                }
 
                while (max_size)
index 5f056f89ceac1f548603a5abe99d838e5b6f5f35..4403bcfdcd03d117aea8ed31bcc7ba585c101f78 100644 (file)
@@ -981,11 +981,11 @@ namespace {
                                param("\\SIZE");
                                param("\\OFFSET");
                                param("\\INIT");
-                               param_bits("\\RD_CLK_ENABLE", std::max(1, param("\\RD_PORTS")));
-                               param_bits("\\RD_CLK_POLARITY", std::max(1, param("\\RD_PORTS")));
-                               param_bits("\\RD_TRANSPARENT", std::max(1, param("\\RD_PORTS")));
-                               param_bits("\\WR_CLK_ENABLE", std::max(1, param("\\WR_PORTS")));
-                               param_bits("\\WR_CLK_POLARITY", std::max(1, param("\\WR_PORTS")));
+                               param_bits("\\RD_CLK_ENABLE", max(1, param("\\RD_PORTS")));
+                               param_bits("\\RD_CLK_POLARITY", max(1, param("\\RD_PORTS")));
+                               param_bits("\\RD_TRANSPARENT", max(1, param("\\RD_PORTS")));
+                               param_bits("\\WR_CLK_ENABLE", max(1, param("\\WR_PORTS")));
+                               param_bits("\\WR_CLK_POLARITY", max(1, param("\\WR_PORTS")));
                                port("\\RD_CLK", param("\\RD_PORTS"));
                                port("\\RD_EN", param("\\RD_PORTS"));
                                port("\\RD_ADDR", param("\\RD_PORTS") * param("\\ABITS"));
@@ -1601,10 +1601,10 @@ DEF_METHOD(LogicNot,   1, "$logic_not")
                add ## _func(name, sig_a, sig_b, sig_y, is_signed); \
                return sig_y;                                       \
        }
-DEF_METHOD(And,      std::max(sig_a.size(), sig_b.size()), "$and")
-DEF_METHOD(Or,       std::max(sig_a.size(), sig_b.size()), "$or")
-DEF_METHOD(Xor,      std::max(sig_a.size(), sig_b.size()), "$xor")
-DEF_METHOD(Xnor,     std::max(sig_a.size(), sig_b.size()), "$xnor")
+DEF_METHOD(And,      max(sig_a.size(), sig_b.size()), "$and")
+DEF_METHOD(Or,       max(sig_a.size(), sig_b.size()), "$or")
+DEF_METHOD(Xor,      max(sig_a.size(), sig_b.size()), "$xor")
+DEF_METHOD(Xnor,     max(sig_a.size(), sig_b.size()), "$xnor")
 DEF_METHOD(Shl,      sig_a.size(), "$shl")
 DEF_METHOD(Shr,      sig_a.size(), "$shr")
 DEF_METHOD(Sshl,     sig_a.size(), "$sshl")
@@ -1619,11 +1619,11 @@ DEF_METHOD(Eqx,      1, "$eqx")
 DEF_METHOD(Nex,      1, "$nex")
 DEF_METHOD(Ge,       1, "$ge")
 DEF_METHOD(Gt,       1, "$gt")
-DEF_METHOD(Add,      std::max(sig_a.size(), sig_b.size()), "$add")
-DEF_METHOD(Sub,      std::max(sig_a.size(), sig_b.size()), "$sub")
-DEF_METHOD(Mul,      std::max(sig_a.size(), sig_b.size()), "$mul")
-DEF_METHOD(Div,      std::max(sig_a.size(), sig_b.size()), "$div")
-DEF_METHOD(Mod,      std::max(sig_a.size(), sig_b.size()), "$mod")
+DEF_METHOD(Add,      max(sig_a.size(), sig_b.size()), "$add")
+DEF_METHOD(Sub,      max(sig_a.size(), sig_b.size()), "$sub")
+DEF_METHOD(Mul,      max(sig_a.size(), sig_b.size()), "$mul")
+DEF_METHOD(Div,      max(sig_a.size(), sig_b.size()), "$div")
+DEF_METHOD(Mod,      max(sig_a.size(), sig_b.size()), "$mod")
 DEF_METHOD(LogicAnd, 1, "$logic_and")
 DEF_METHOD(LogicOr,  1, "$logic_or")
 #undef DEF_METHOD
index 7b0994441a8d9b0c70e6241474da60f4f702fccf..d44d61f160a8be1d66331084fd19c1486c124a2f 100644 (file)
@@ -980,7 +980,7 @@ struct SatGen
                                                div_zero_result.insert(div_zero_result.end(), y.size() - div_zero_result.size(), ez->CONST_FALSE);
                                        }
                                } else {
-                                       int copy_a_bits = std::min(cell->getPort("\\A").size(), cell->getPort("\\B").size());
+                                       int copy_a_bits = min(cell->getPort("\\A").size(), cell->getPort("\\B").size());
                                        div_zero_result.insert(div_zero_result.end(), a.begin(), a.begin() + copy_a_bits);
                                        if (cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool())
                                                div_zero_result.insert(div_zero_result.end(), y.size() - div_zero_result.size(), div_zero_result.back());
index 80346a47cf2ab41fa785239ad1d204620034c11a..89a4f6084642796166a27662445e0c312b0b1969 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <map>
 #include <set>
+#include <tuple>
 #include <vector>
 #include <string>
 #include <algorithm>
@@ -138,8 +139,14 @@ YOSYS_NAMESPACE_BEGIN
 
 using std::vector;
 using std::string;
+using std::tuple;
 using std::pair;
 
+using std::make_tuple;
+using std::make_pair;
+using std::min;
+using std::max;
+
 // A primitive shared string implementation that does not
 // move its .c_str() when the object is copied or moved.
 struct shared_str {
index 5f062c6e810e0b0082d411b1bf5bfc256962142b..7b75a009f026ac14499352f193ca904efd531fe3 100644 (file)
@@ -52,7 +52,7 @@ struct EdgetypePass : public Pass {
                for (auto module : design->selected_modules())
                {
                        SigMap sigmap(module);
-                       dict<SigBit, pool<std::tuple<IdString, IdString, int>>> bit_sources, bit_sinks;
+                       dict<SigBit, pool<tuple<IdString, IdString, int>>> bit_sources, bit_sinks;
                        pool<std::pair<IdString, IdString>> multibit_ports;
 
                        for (auto cell : module->selected_cells())
@@ -67,9 +67,9 @@ struct EdgetypePass : public Pass {
 
                                for (int i = 0; i < GetSize(sig); i++) {
                                        if (cell->output(port_name))
-                                               bit_sources[sig[i]].insert(std::tuple<IdString, IdString, int>(cell_type, port_name, i));
+                                               bit_sources[sig[i]].insert(tuple<IdString, IdString, int>(cell_type, port_name, i));
                                        if (cell->input(port_name))
-                                               bit_sinks[sig[i]].insert(std::tuple<IdString, IdString, int>(cell_type, port_name, i));
+                                               bit_sinks[sig[i]].insert(tuple<IdString, IdString, int>(cell_type, port_name, i));
                                }
                        }
 
index f7c65bbdeefd1f17444b8a8e74d72b64196d2b46..e2d80d9bf575eac6907429c304d8a6b74e4e6855 100644 (file)
@@ -115,7 +115,7 @@ struct PluginPass : public Pass {
                                log("\n");
                                int max_alias_len = 1;
                                for (auto &it : loaded_plugin_aliases)
-                                       max_alias_len = std::max(max_alias_len, GetSize(it.first));
+                                       max_alias_len = max(max_alias_len, GetSize(it.first));
                                for (auto &it : loaded_plugin_aliases)
                                        log("Alias: %-*s %s\n", max_alias_len, it.first.c_str(), it.second.c_str());
                        }
index 784076c372453141b1f0a3705639b64435ad935c..8ec815a72c390ed25fde9e47dc39690b327461b1 100644 (file)
@@ -342,8 +342,8 @@ struct QwpWorker
                        double r = alt_mode ? alt_radius : radius;
 
                        if (std::isfinite(v)) {
-                               v = std::min(v, c+r);
-                               v = std::max(v, c-r);
+                               v = min(v, c+r);
+                               v = max(v, c-r);
                        } else {
                                v = c;
                        }
@@ -524,15 +524,15 @@ struct QwpWorker
                        if (rel_pos < 0) {
                                node.pos = midpos + left_scale*rel_pos;
                                if (std::isfinite(node.pos)) {
-                                       node.pos = std::min(node.pos, midpos);
-                                       node.pos = std::max(node.pos, midpos - radius);
+                                       node.pos = min(node.pos, midpos);
+                                       node.pos = max(node.pos, midpos - radius);
                                } else
                                        node.pos = midpos - radius/2;
                        } else {
                                node.pos = midpos + right_scale*rel_pos;
                                if (std::isfinite(node.pos)) {
-                                       node.pos = std::max(node.pos, midpos);
-                                       node.pos = std::min(node.pos, midpos + radius);
+                                       node.pos = max(node.pos, midpos);
+                                       node.pos = min(node.pos, midpos + radius);
                                } else
                                        node.pos = midpos + radius/2;
                        }
@@ -666,8 +666,8 @@ struct QwpWorker
                double max_value = values.front();
 
                for (auto &v : values) {
-                       min_value = std::min(min_value, v);
-                       max_value = std::max(max_value, v);
+                       min_value = min(min_value, v);
+                       max_value = max(max_value, v);
                }
 
                if (fabs(max_value - min_value) < 0.001) {
@@ -679,8 +679,8 @@ struct QwpWorker
                int max_bucket_val = 0;
 
                for (auto &v : values) {
-                       int idx = std::min(int(GetSize(buckets) * (v - min_value) / (max_value - min_value)), GetSize(buckets)-1);
-                       max_bucket_val = std::max(max_bucket_val, ++buckets.at(idx));
+                       int idx = min(int(GetSize(buckets) * (v - min_value) / (max_value - min_value)), GetSize(buckets)-1);
+                       max_bucket_val = max(max_bucket_val, ++buckets.at(idx));
                }
 
                for (int i = 4; i >= 0; i--) {
index 43a43b4fc7bbdbd3fcc10c255483ce293258c44b..532026f26a7423fe5e1110188f041d14aca758d7 100644 (file)
@@ -69,10 +69,10 @@ struct SccWorker
                for (auto nextCell : cellToNextCell[cell])
                        if (cellLabels.count(nextCell) == 0) {
                                run(nextCell, depth+1, maxDepth);
-                               cellLabels[cell].second = std::min(cellLabels[cell].second, cellLabels[nextCell].second);
+                               cellLabels[cell].second = min(cellLabels[cell].second, cellLabels[nextCell].second);
                        } else
                        if (cellsOnStack.count(nextCell) > 0 && (maxDepth < 0 || cellDepth[nextCell] + maxDepth > depth)) {
-                                       cellLabels[cell].second = std::min(cellLabels[cell].second, cellLabels[nextCell].second);
+                                       cellLabels[cell].second = min(cellLabels[cell].second, cellLabels[nextCell].second);
                        }
 
                if (cellLabels[cell].first == cellLabels[cell].second)
index 3b6ad014fdf458222fbf456b1a44d339d6382f54..a64c48791b8c4d17c41ab19fb38c79714e4cb4c7 100644 (file)
@@ -140,8 +140,8 @@ struct SplitnetsPass : public Pass {
 
                                for (auto wire : module->wires())
                                        if (wire->port_id != 0) {
-                                               normalized_port_factor = std::max(normalized_port_factor, wire->port_id+1);
-                                               normalized_port_factor = std::max(normalized_port_factor, GetSize(wire)+1);
+                                               normalized_port_factor = max(normalized_port_factor, wire->port_id+1);
+                                               normalized_port_factor = max(normalized_port_factor, GetSize(wire)+1);
                                        }
 
                                for (auto wire : module->wires())
index ed4a040649d058522960b8753fbd819e2234956b..af56a9e202870fd31652bb0b957e3dbabef5e79b 100644 (file)
@@ -110,7 +110,7 @@ struct statdata_t
                                        int width_a = it.second->hasPort("\\A") ? GetSize(it.second->getPort("\\A")) : 0;
                                        int width_b = it.second->hasPort("\\B") ? GetSize(it.second->getPort("\\B")) : 0;
                                        int width_y = it.second->hasPort("\\Y") ? GetSize(it.second->getPort("\\Y")) : 0;
-                                       cell_type = stringf("%s_%d", cell_type.c_str(), std::max<int>({width_a, width_b, width_y}));
+                                       cell_type = stringf("%s_%d", cell_type.c_str(), max<int>({width_a, width_b, width_y}));
                                }
                                else if (cell_type.in("$mux", "$pmux"))
                                        cell_type = stringf("%s_%d", cell_type.c_str(), GetSize(it.second->getPort("\\Y")));
index 7b8ba9058bca9e135e2d5f19a3dd11a056bc4770..9ae490fe7e081e103996c5a5c9a4f920f48a1a2e 100644 (file)
@@ -63,7 +63,7 @@ struct EquivAddPass : public Pass {
                                auto port = conn.first;
                                SigSpec gold_sig = gold_cell->getPort(port);
                                SigSpec gate_sig = gate_cell->getPort(port);
-                               int width = std::min(GetSize(gold_sig), GetSize(gate_sig));
+                               int width = min(GetSize(gold_sig), GetSize(gate_sig));
 
                                if (gold_cell->input(port) && gate_cell->input(port))
                                {
index 1b98ccbac30f0445f8c9c80ed0cf3e9404307ac6..68222769a524301bf3165f82e8a05b69e5c3ea36 100644 (file)
@@ -39,7 +39,7 @@ struct FsmData
                int state_num_log2 = 0;
                for (int i = state_table.size(); i > 0; i = i >> 1)
                        state_num_log2++;
-               state_num_log2 = std::max(state_num_log2, 1);
+               state_num_log2 = max(state_num_log2, 1);
 
                cell->parameters["\\STATE_BITS"] = RTLIL::Const(state_bits);
                cell->parameters["\\STATE_NUM"] = RTLIL::Const(state_table.size());
index 598fe9396dd2746e62ef1e331f2c377d0ac004a4..fcc30d1756ceaaaafb4d4790ed00bba45b86fbcc 100644 (file)
@@ -66,7 +66,7 @@ void generate(RTLIL::Design *design, const std::vector<std::string> &celltypes,
                                for (auto &conn : i2.second->connections()) {
                                        if (conn.first[0] != '$')
                                                portnames.insert(conn.first);
-                                       portwidths[conn.first] = std::max(portwidths[conn.first], conn.second.size());
+                                       portwidths[conn.first] = max(portwidths[conn.first], conn.second.size());
                                }
                                for (auto &para : i2.second->parameters)
                                        parameters.insert(para.first);
@@ -84,8 +84,8 @@ void generate(RTLIL::Design *design, const std::vector<std::string> &celltypes,
 
                for (auto &decl : portdecls)
                        if (decl.index > 0) {
-                               portwidths[decl.portname] = std::max(portwidths[decl.portname], 1);
-                               portwidths[decl.portname] = std::max(portwidths[decl.portname], portwidths[stringf("$%d", decl.index)]);
+                               portwidths[decl.portname] = max(portwidths[decl.portname], 1);
+                               portwidths[decl.portname] = max(portwidths[decl.portname], portwidths[stringf("$%d", decl.index)]);
                                log("  port %d: %s [%d:0] %s\n", decl.index, decl.input ? decl.output ? "inout" : "input" : "output", portwidths[decl.portname]-1, RTLIL::id2cstr(decl.portname));
                                if (indices.count(decl.index) > ports.size())
                                        log_error("Port index (%d) exceeds number of found ports (%d).\n", decl.index, int(ports.size()));
@@ -106,7 +106,7 @@ void generate(RTLIL::Design *design, const std::vector<std::string> &celltypes,
                                        log_assert(!indices.empty());
                                        indices.erase(d.index);
                                        ports[d.index-1] = d;
-                                       portwidths[d.portname] = std::max(portwidths[d.portname], 1);
+                                       portwidths[d.portname] = max(portwidths[d.portname], 1);
                                        log("  port %d: %s [%d:0] %s\n", d.index, d.input ? d.output ? "inout" : "input" : "output", portwidths[d.portname]-1, RTLIL::id2cstr(d.portname));
                                        goto found_matching_decl;
                                }
@@ -327,7 +327,7 @@ int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)
                db[module] = 0;
                for (auto cell : module->cells())
                        if (design->module(cell->type))
-                               db[module] = std::max(db[module], find_top_mod_score(design, design->module(cell->type), db) + 1);
+                               db[module] = max(db[module], find_top_mod_score(design, design->module(cell->type), db) + 1);
        }
        return db.at(module);
 }
index b371578d466cc4937db003d0f794e54f21534437..f2d9b5847ee226e1fc9bf82db8098b5bd5bbdcdc 100644 (file)
@@ -387,9 +387,9 @@ bool replace_cell(Cell *cell, const rules_t &rules, const rules_t::bram_t &bram,
                        if (pi.clkpol > 1)
                                clkpol_wr_ports.insert(pi.clkpol);
                }
-               clocks_max = std::max(clocks_max, pi.clocks);
-               clkpol_max = std::max(clkpol_max, pi.clkpol);
-               transp_max = std::max(transp_max, pi.transp);
+               clocks_max = max(clocks_max, pi.clocks);
+               clkpol_max = max(clkpol_max, pi.clkpol);
+               transp_max = max(transp_max, pi.transp);
        }
 
        log("    Mapping to bram type %s (variant %d):\n", log_id(bram.name), bram.variant);
@@ -977,7 +977,7 @@ void handle_cell(Cell *cell, const rules_t &rules)
        log("\n");
 
        pool<pair<IdString, int>> failed_brams;
-       dict<pair<int, int>, std::tuple<int, int, int>> best_rule_cache;
+       dict<pair<int, int>, tuple<int, int, int>> best_rule_cache;
 
        for (int i = 0; i < GetSize(rules.matches); i++)
        {
@@ -1078,7 +1078,7 @@ void handle_cell(Cell *cell, const rules_t &rules)
                                }
 
                                log("      Storing for later selection.\n");
-                               best_rule_cache[pair<int, int>(i, vi)] = std::tuple<int, int, int>(match_properties["efficiency"], -match_properties["cells"], -match_properties["acells"]);
+                               best_rule_cache[pair<int, int>(i, vi)] = tuple<int, int, int>(match_properties["efficiency"], -match_properties["cells"], -match_properties["acells"]);
 
                next_match_rule:
                                if (or_next_if_better || best_rule_cache.empty())
index abd4b1242cfa32d50165f3130d21870a4643ae9a..5c0acb3e5a9cfdb75ac051965facb9a71ee91d40 100644 (file)
@@ -64,7 +64,7 @@ Cell *handle_memory(Module *module, RTLIL::Memory *memory)
        for (auto &cell_it : module->cells_) {
                Cell *cell = cell_it.second;
                if (cell->type.in("$memrd", "$memwr", "$meminit") && memory->name == cell->parameters["\\MEMID"].decode_string()) {
-                       addr_bits = std::max(addr_bits, cell->getParam("\\ABITS").as_int());
+                       addr_bits = max(addr_bits, cell->getParam("\\ABITS").as_int());
                        memcells.push_back(cell);
                }
        }
index b8f27025ac3d8f9ad5ca8837058c77457e248433..3a6fd0b44d99c4046eaaf5c10db5fb26441244cf 100644 (file)
@@ -210,7 +210,7 @@ struct MemoryShareWorker
                                if (non_feedback_nets.count(sig_data[i]))
                                        goto not_pure_feedback_port;
 
-                       async_rd_bits[sig_addr].resize(std::max(async_rd_bits.size(), sig_data.size()));
+                       async_rd_bits[sig_addr].resize(max(async_rd_bits.size(), sig_data.size()));
                        for (int i = 0; i < int(sig_data.size()); i++)
                                async_rd_bits[sig_addr][i].insert(sig_data[i]);
 
index 85e4c4c189a5d3f19e559b5c4db300e5345f700f..0fcacf0a83267f5082be5f3256ec5ffbabb950c0 100644 (file)
@@ -589,7 +589,7 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
                        RTLIL::SigSpec b = cell->getPort("\\B");
 
                        if (cell->parameters["\\A_WIDTH"].as_int() != cell->parameters["\\B_WIDTH"].as_int()) {
-                               int width = std::max(cell->parameters["\\A_WIDTH"].as_int(), cell->parameters["\\B_WIDTH"].as_int());
+                               int width = max(cell->parameters["\\A_WIDTH"].as_int(), cell->parameters["\\B_WIDTH"].as_int());
                                a.extend_u0(width, cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool());
                                b.extend_u0(width, cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool());
                        }
index 9dd0dc0a34ec46b38bf65b2ed29355431a8ebebc..1d9b1006ed4e31de5d98a8497e46010a890ef369 100644 (file)
@@ -113,8 +113,8 @@ struct ShareWorker
        static int bits_macc_port(const Macc::port_t &p, int width)
        {
                if (GetSize(p.in_a) == 0 || GetSize(p.in_b) == 0)
-                       return std::min(std::max(GetSize(p.in_a), GetSize(p.in_b)), width);
-               return std::min(GetSize(p.in_a), width) * std::min(GetSize(p.in_b), width) / 2;
+                       return min(max(GetSize(p.in_a), GetSize(p.in_b)), width);
+               return min(GetSize(p.in_a), width) * min(GetSize(p.in_b), width) / 2;
        }
 
        static int bits_macc(const Macc &m, int width)
@@ -224,13 +224,13 @@ struct ShareWorker
                        supermacc->ports.push_back(p);
                }
 
-               int score = 1000 + abs(GetSize(p1.in_a) - GetSize(p2.in_a)) * std::max(abs(GetSize(p1.in_b) - GetSize(p2.in_b)), 1);
+               int score = 1000 + abs(GetSize(p1.in_a) - GetSize(p2.in_a)) * max(abs(GetSize(p1.in_b) - GetSize(p2.in_b)), 1);
 
-               for (int i = 0; i < std::min(GetSize(p1.in_a), GetSize(p2.in_a)); i++)
+               for (int i = 0; i < min(GetSize(p1.in_a), GetSize(p2.in_a)); i++)
                        if (p1.in_a[i] == p2.in_a[i] && score > 0)
                                score--;
 
-               for (int i = 0; i < std::min(GetSize(p1.in_b), GetSize(p2.in_b)); i++)
+               for (int i = 0; i < min(GetSize(p1.in_b), GetSize(p2.in_b)); i++)
                        if (p1.in_b[i] == p2.in_b[i] && score > 0)
                                score--;
 
@@ -243,7 +243,7 @@ struct ShareWorker
                Macc m1(c1), m2(c2), supermacc;
 
                int w1 = GetSize(c1->getPort("\\Y")), w2 = GetSize(c2->getPort("\\Y"));
-               int width = std::max(w1, w2);
+               int width = max(w1, w2);
 
                m1.optimize(w1);
                m2.optimize(w2);
@@ -419,8 +419,8 @@ struct ShareWorker
                                int a2_width = c2->parameters.at("\\A_WIDTH").as_int();
                                int y2_width = c2->parameters.at("\\Y_WIDTH").as_int();
 
-                               if (std::max(a1_width, a2_width) > 2 * std::min(a1_width, a2_width)) return false;
-                               if (std::max(y1_width, y2_width) > 2 * std::min(y1_width, y2_width)) return false;
+                               if (max(a1_width, a2_width) > 2 * min(a1_width, a2_width)) return false;
+                               if (max(y1_width, y2_width) > 2 * min(y1_width, y2_width)) return false;
                        }
 
                        return true;
@@ -438,9 +438,9 @@ struct ShareWorker
                                int b2_width = c2->parameters.at("\\B_WIDTH").as_int();
                                int y2_width = c2->parameters.at("\\Y_WIDTH").as_int();
 
-                               if (std::max(a1_width, a2_width) > 2 * std::min(a1_width, a2_width)) return false;
-                               if (std::max(b1_width, b2_width) > 2 * std::min(b1_width, b2_width)) return false;
-                               if (std::max(y1_width, y2_width) > 2 * std::min(y1_width, y2_width)) return false;
+                               if (max(a1_width, a2_width) > 2 * min(a1_width, a2_width)) return false;
+                               if (max(b1_width, b2_width) > 2 * min(b1_width, b2_width)) return false;
+                               if (max(y1_width, y2_width) > 2 * min(y1_width, y2_width)) return false;
                        }
 
                        return true;
@@ -458,15 +458,15 @@ struct ShareWorker
                                int b2_width = c2->parameters.at("\\B_WIDTH").as_int();
                                int y2_width = c2->parameters.at("\\Y_WIDTH").as_int();
 
-                               int min1_width = std::min(a1_width, b1_width);
-                               int max1_width = std::max(a1_width, b1_width);
+                               int min1_width = min(a1_width, b1_width);
+                               int max1_width = max(a1_width, b1_width);
 
-                               int min2_width = std::min(a2_width, b2_width);
-                               int max2_width = std::max(a2_width, b2_width);
+                               int min2_width = min(a2_width, b2_width);
+                               int max2_width = max(a2_width, b2_width);
 
-                               if (std::max(min1_width, min2_width) > 2 * std::min(min1_width, min2_width)) return false;
-                               if (std::max(max1_width, max2_width) > 2 * std::min(max1_width, max2_width)) return false;
-                               if (std::max(y1_width, y2_width) > 2 * std::min(y1_width, y2_width)) return false;
+                               if (max(min1_width, min2_width) > 2 * min(min1_width, min2_width)) return false;
+                               if (max(max1_width, max2_width) > 2 * min(max1_width, max2_width)) return false;
+                               if (max(y1_width, y2_width) > 2 * min(y1_width, y2_width)) return false;
                        }
 
                        return true;
@@ -475,7 +475,7 @@ struct ShareWorker
                if (c1->type == "$macc")
                {
                        if (!config.opt_aggressive)
-                               if (share_macc(c1, c2) > 2 * std::min(bits_macc(c1), bits_macc(c2))) return false;
+                               if (share_macc(c1, c2) > 2 * min(bits_macc(c1), bits_macc(c2))) return false;
 
                        return true;
                }
@@ -532,8 +532,8 @@ struct ShareWorker
                        RTLIL::SigSpec a2 = c2->getPort("\\A");
                        RTLIL::SigSpec y2 = c2->getPort("\\Y");
 
-                       int a_width = std::max(a1.size(), a2.size());
-                       int y_width = std::max(y1.size(), y2.size());
+                       int a_width = max(a1.size(), a2.size());
+                       int y_width = max(y1.size(), y2.size());
 
                        a1.extend_u0(a_width, a_signed);
                        a2.extend_u0(a_width, a_signed);
@@ -563,11 +563,11 @@ struct ShareWorker
 
                        if (config.generic_cbin_ops.count(c1->type))
                        {
-                               int score_unflipped = std::max(c1->parameters.at("\\A_WIDTH").as_int(), c2->parameters.at("\\A_WIDTH").as_int()) +
-                                               std::max(c1->parameters.at("\\B_WIDTH").as_int(), c2->parameters.at("\\B_WIDTH").as_int());
+                               int score_unflipped = max(c1->parameters.at("\\A_WIDTH").as_int(), c2->parameters.at("\\A_WIDTH").as_int()) +
+                                               max(c1->parameters.at("\\B_WIDTH").as_int(), c2->parameters.at("\\B_WIDTH").as_int());
 
-                               int score_flipped = std::max(c1->parameters.at("\\A_WIDTH").as_int(), c2->parameters.at("\\B_WIDTH").as_int()) +
-                                               std::max(c1->parameters.at("\\B_WIDTH").as_int(), c2->parameters.at("\\A_WIDTH").as_int());
+                               int score_flipped = max(c1->parameters.at("\\A_WIDTH").as_int(), c2->parameters.at("\\B_WIDTH").as_int()) +
+                                               max(c1->parameters.at("\\B_WIDTH").as_int(), c2->parameters.at("\\A_WIDTH").as_int());
 
                                if (score_flipped < score_unflipped)
                                {
@@ -630,13 +630,13 @@ struct ShareWorker
                        RTLIL::SigSpec b2 = c2->getPort("\\B");
                        RTLIL::SigSpec y2 = c2->getPort("\\Y");
 
-                       int a_width = std::max(a1.size(), a2.size());
-                       int b_width = std::max(b1.size(), b2.size());
-                       int y_width = std::max(y1.size(), y2.size());
+                       int a_width = max(a1.size(), a2.size());
+                       int b_width = max(b1.size(), b2.size());
+                       int y_width = max(y1.size(), y2.size());
 
                        if (c1->type == "$shr" && a_signed)
                        {
-                               a_width = std::max(y_width, a_width);
+                               a_width = max(y_width, a_width);
 
                                if (a1.size() < y1.size()) a1.extend_u0(y1.size(), true);
                                if (a2.size() < y2.size()) a2.extend_u0(y2.size(), true);
index e2d9a2c4fc49bb723975373c0323527668c62461..df416e4c5dd95d73fe90289bc341f822cb38718e 100644 (file)
@@ -188,8 +188,8 @@ struct WreduceWorker
                int max_port_b_size = cell->hasPort("\\B") ? GetSize(cell->getPort("\\B")) : -1;
 
                if (cell->type.in("$not", "$pos", "$neg", "$and", "$or", "$xor", "$add", "$sub")) {
-                       max_port_a_size = std::min(max_port_a_size, GetSize(sig));
-                       max_port_b_size = std::min(max_port_b_size, GetSize(sig));
+                       max_port_a_size = min(max_port_a_size, GetSize(sig));
+                       max_port_b_size = min(max_port_b_size, GetSize(sig));
                }
 
                bool port_a_signed = false;
@@ -228,7 +228,7 @@ struct WreduceWorker
                        if (cell->hasPort("\\A")) a_size = GetSize(cell->getPort("\\A"));
                        if (cell->hasPort("\\B")) b_size = GetSize(cell->getPort("\\B"));
 
-                       int max_y_size = std::max(a_size, b_size);
+                       int max_y_size = max(a_size, b_size);
 
                        if (cell->type == "$add")
                                max_y_size++;
index 5226640324e11216e5e87bad6ef098f50d05339e..614a1bd3140662a081f1f313c1853f600eb0ef25 100644 (file)
@@ -568,7 +568,7 @@ struct EvalPass : public Pass {
                                if (tab_column_width.size() < row.size())
                                        tab_column_width.resize(row.size());
                                for (size_t i = 0; i < row.size(); i++)
-                                       tab_column_width[i] = std::max(tab_column_width[i], int(row[i].size()));
+                                       tab_column_width[i] = max(tab_column_width[i], int(row[i].size()));
                        }
 
                        log("\n");
index e0d11243b7230e87198fe15e249bca74ef934ff8..373b804882168b72333c354e19f5226101fcb70f 100644 (file)
@@ -265,7 +265,7 @@ struct PerformReduction
                        }
                        int max_child_depth = 0;
                        for (auto &bit : drv.second)
-                               max_child_depth = std::max(register_cone_worker(celldone, sigdepth, bit), max_child_depth);
+                               max_child_depth = max(register_cone_worker(celldone, sigdepth, bit), max_child_depth);
                        sigdepth[out] = max_child_depth + 1;
                } else {
                        pi_bits.push_back(out);
index e72eddf339475644291e70ce8ad10610a81add3d..2e9c6d2f96f1efcedf008eaf4b97e8d90a610d11 100644 (file)
@@ -606,8 +606,8 @@ struct SatHelper
                int maxModelWidth = 10;
 
                for (auto &info : modelInfo) {
-                       maxModelName = std::max(maxModelName, int(info.description.size()));
-                       maxModelWidth = std::max(maxModelWidth, info.width);
+                       maxModelName = max(maxModelName, int(info.description.size()));
+                       maxModelWidth = max(maxModelWidth, info.width);
                }
 
                log("\n");
@@ -781,9 +781,9 @@ struct SatHelper
 
                        wavedata[info.description].first = info.width;
                        wavedata[info.description].second[info.timestep] = value;
-                       mintime = std::min(mintime, info.timestep);
-                       maxtime = std::max(maxtime, info.timestep);
-                       maxwidth = std::max(maxwidth, info.width);
+                       mintime = min(mintime, info.timestep);
+                       maxtime = max(maxtime, info.timestep);
+                       maxwidth = max(maxwidth, info.width);
                }
 
                fprintf(f, "{ \"signal\": [");
@@ -1116,7 +1116,7 @@ struct SatPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-stepsize" && argidx+1 < args.size()) {
-                               stepsize = std::max(1, atoi(args[++argidx].c_str()));
+                               stepsize = max(1, atoi(args[++argidx].c_str()));
                                continue;
                        }
                        if (args[argidx] == "-ignore_div_by_zero") {
index 645869273193e61df2b678d054f7158abfc1adc3..706779885486ddda16f4f1dd5054ff7f8e629ec3 100644 (file)
@@ -1399,7 +1399,7 @@ struct AbcPass : public Pass {
                                std::set<RTLIL::Cell*> expand_queue_up, next_expand_queue_up;
                                std::set<RTLIL::Cell*> expand_queue_down, next_expand_queue_down;
 
-                               typedef std::tuple<bool, RTLIL::SigSpec, bool, RTLIL::SigSpec> clkdomain_t;
+                               typedef tuple<bool, RTLIL::SigSpec, bool, RTLIL::SigSpec> clkdomain_t;
                                std::map<clkdomain_t, std::vector<RTLIL::Cell*>> assigned_cells;
                                std::map<RTLIL::Cell*, clkdomain_t> assigned_cells_reverse;
 
index 90563c863738e0abd64488cc7c92dde3018d48e5..3c7ff4b92e738ba0dd2e3e895a6e31b4be80b062 100644 (file)
@@ -40,7 +40,7 @@ struct AlumaccWorker
        {
                std::vector<RTLIL::Cell*> cells;
                RTLIL::SigSpec a, b, c, y;
-               std::vector<std::tuple<bool, bool, bool, bool, RTLIL::SigSpec>> cmp;
+               std::vector<tuple<bool, bool, bool, bool, RTLIL::SigSpec>> cmp;
                bool is_signed, invert_b;
 
                RTLIL::Cell *alu_cell;
@@ -138,7 +138,7 @@ struct AlumaccWorker
                        n->users = 0;
 
                        for (auto bit : n->y)
-                               n->users = std::max(n->users, bit_users.at(bit) - 1);
+                               n->users = max(n->users, bit_users.at(bit) - 1);
 
                        if (cell->type.in("$pos", "$neg"))
                        {
@@ -409,7 +409,7 @@ struct AlumaccWorker
                                n->a = A;
                                n->b = B;
                                n->c = RTLIL::S1;
-                               n->y = module->addWire(NEW_ID, std::max(GetSize(A), GetSize(B)));
+                               n->y = module->addWire(NEW_ID, max(GetSize(A), GetSize(B)));
                                n->is_signed = is_signed;
                                n->invert_b = true;
                                sig_alu[RTLIL::SigSig(A, B)].insert(n);
index 84770ff3e7f1927897cb19966e0cd87d34cbab46..6a80f043b871454558ac5e924b6aea2b79bb8523 100644 (file)
@@ -68,7 +68,7 @@ struct DffinitPass : public Pass {
                        for (auto wire : module->selected_wires()) {
                                if (wire->attributes.count("\\init")) {
                                        Const value = wire->attributes.at("\\init");
-                                       for (int i = 0; i < std::min(GetSize(value), GetSize(wire)); i++)
+                                       for (int i = 0; i < min(GetSize(value), GetSize(wire)); i++)
                                                init_bits[sigmap(SigBit(wire, i))] = value[i];
                                }
                                if (wire->port_output)
@@ -116,7 +116,7 @@ struct DffinitPass : public Pass {
                                if (wire->attributes.count("\\init")) {
                                        Const &value = wire->attributes.at("\\init");
                                        bool do_cleanup = true;
-                                       for (int i = 0; i < std::min(GetSize(value), GetSize(wire)); i++) {
+                                       for (int i = 0; i < min(GetSize(value), GetSize(wire)); i++) {
                                                SigBit bit = sigmap(SigBit(wire, i));
                                                if (cleanup_bits.count(bit) || !used_bits.count(bit))
                                                        value[i] = State::Sx;
index d9ec4bc6a850eb3ef2f3c3df497e6e7ccf7d8b6f..fc73177ce18e7776775ca33cfff0a20f12845828 100644 (file)
@@ -130,7 +130,7 @@ public:
                                RTLIL::SigSpec needleSig = conn.second;
                                RTLIL::SigSpec haystackSig = haystackCell->getPort(portMapping.at(conn.first.str()));
 
-                               for (int i = 0; i < std::min(needleSig.size(), haystackSig.size()); i++) {
+                               for (int i = 0; i < min(needleSig.size(), haystackSig.size()); i++) {
                                        RTLIL::Wire *needleWire = needleSig[i].wire, *haystackWire = haystackSig[i].wire;
                                        if (needleWire != lastNeedleWire || haystackWire != lastHaystackWire)
                                                if (!compareAttributes(wire_attr, needleWire ? needleWire->attributes : emptyAttr, haystackWire ? haystackWire->attributes : emptyAttr))
index dad1c06ac3cdcbc867bacec0dfd545859c556089..d5b8fe804aa2c847286cc90dffe790023f24a98f 100644 (file)
@@ -134,7 +134,7 @@ struct MaccmapWorker
                }
                return retval;
        #else
-               return std::max(n - 1, 0);
+               return max(n - 1, 0);
        #endif
        }
 
index b250c5680d49bc6ddda8d1455b84c42f6df02b37..514c3365f3c115ca59bab1009c7e93e4590adf74 100644 (file)
@@ -49,8 +49,8 @@ struct MuxcoverWorker
 
        vector<tree_t> tree_list;
 
-       dict<std::tuple<SigBit, SigBit, SigBit>, std::tuple<SigBit, pool<SigBit>, bool>> decode_mux_cache;
-       dict<SigBit, std::tuple<SigBit, SigBit, SigBit>> decode_mux_reverse_cache;
+       dict<tuple<SigBit, SigBit, SigBit>, tuple<SigBit, pool<SigBit>, bool>> decode_mux_cache;
+       dict<SigBit, tuple<SigBit, SigBit, SigBit>> decode_mux_reverse_cache;
        int decode_mux_counter;
 
        bool use_mux4;
@@ -142,7 +142,7 @@ struct MuxcoverWorker
                if (A == B)
                        return 0;
 
-               std::tuple<SigBit, SigBit, SigBit> key(A, B, sel);
+               tuple<SigBit, SigBit, SigBit> key(A, B, sel);
                if (decode_mux_cache.count(key) == 0) {
                        auto &entry = decode_mux_cache[key];
                        std::get<0>(entry) = module->addWire(NEW_ID);
index 0fb5b374151719849e6f1cc7d6a647c48aac643f..956cd48fe9cf2c83fe94c162b1484079f90fdf85 100644 (file)
@@ -247,7 +247,7 @@ void simplemap_eqne(RTLIL::Module *module, RTLIL::Cell *cell)
        bool is_signed = cell->parameters.at("\\A_SIGNED").as_bool();
        bool is_ne = cell->type == "$ne" || cell->type == "$nex";
 
-       RTLIL::SigSpec xor_out = module->addWire(NEW_ID, std::max(GetSize(sig_a), GetSize(sig_b)));
+       RTLIL::SigSpec xor_out = module->addWire(NEW_ID, max(GetSize(sig_a), GetSize(sig_b)));
        RTLIL::Cell *xor_cell = module->addXor(NEW_ID, sig_a, sig_b, xor_out, is_signed);
        xor_cell->add_strpool_attribute("\\src", cell->get_strpool_attribute("\\src"));
        simplemap_bitop(module, xor_cell);
index fd5a32e4f406f39b97ca7ddea4a7c52b50542331..a8fcac9bcd7d6692c0159eacfe5f8d9ad5594ab2 100644 (file)
@@ -256,7 +256,7 @@ static void create_gold_module(RTLIL::Design *design, RTLIL::IdString cell_type,
                        case 2:
                                n = xorshift32(GetSize(sig));
                                m = xorshift32(GetSize(sig));
-                               for (int i = std::min(n, m); i < std::max(n, m); i++)
+                               for (int i = min(n, m); i < max(n, m); i++)
                                        sig[i] = xorshift32(2) == 1 ? RTLIL::S1 : RTLIL::S0;
                                break;
                        }