| 5624 | } |
| 5625 | |
| 5626 | void CompileHelper::reorderAssignmentPattern( |
| 5627 | DesignComponent *mod, const UHDM::any *lhs, UHDM::any *rhs, |
| 5628 | CompileDesign *compileDesign, ValuedComponentI *instance, uint32_t level) { |
| 5629 | if (rhs->UhdmType() != uhdmoperation) return; |
| 5630 | operation *op = (operation *)rhs; |
| 5631 | int32_t optype = op->VpiOpType(); |
| 5632 | if (optype == vpiConditionOp) { |
| 5633 | bool invalidValue = false; |
| 5634 | expr *tmp = reduceExpr(op, invalidValue, mod, compileDesign, instance, |
| 5635 | BadPathId, 0, nullptr, true); |
| 5636 | if (tmp && (tmp->UhdmType() == uhdmoperation) && (invalidValue == false)) { |
| 5637 | op = (operation *)tmp; |
| 5638 | optype = op->VpiOpType(); |
| 5639 | } |
| 5640 | } |
| 5641 | if (op->VpiReordered()) return; |
| 5642 | if ((optype != vpiAssignmentPatternOp) && (optype != vpiConcatOp)) return; |
| 5643 | VectorOfany *operands = op->Operands(); |
| 5644 | bool ordered = true; |
| 5645 | for (any *operand : *operands) { |
| 5646 | if (operand->UhdmType() == uhdmtagged_pattern) { |
| 5647 | ordered = false; |
| 5648 | break; |
| 5649 | } |
| 5650 | } |
| 5651 | if (ordered) { |
| 5652 | if (lhs->UhdmType() == uhdmparameter) { |
| 5653 | parameter *p = (parameter *)lhs; |
| 5654 | VectorOfrange *ranges = nullptr; |
| 5655 | if (p->Ranges()) { |
| 5656 | ranges = p->Ranges(); |
| 5657 | } else if (const ref_typespec *rt = p->Typespec()) { |
| 5658 | if (const typespec *tps = rt->Actual_typespec()) { |
| 5659 | UHDM_OBJECT_TYPE ttype = tps->UhdmType(); |
| 5660 | if (ttype == uhdmbit_typespec) { |
| 5661 | ranges = ((bit_typespec *)tps)->Ranges(); |
| 5662 | } else if (ttype == uhdmlogic_typespec) { |
| 5663 | ranges = ((logic_typespec *)tps)->Ranges(); |
| 5664 | } else if (ttype == uhdmarray_typespec) { |
| 5665 | ranges = ((array_typespec *)tps)->Ranges(); |
| 5666 | } else if (ttype == uhdmpacked_array_typespec) { |
| 5667 | ranges = ((packed_array_typespec *)tps)->Ranges(); |
| 5668 | } |
| 5669 | } |
| 5670 | } |
| 5671 | if (ranges) { |
| 5672 | if (level < ranges->size()) { |
| 5673 | range *r = ranges->at(level); |
| 5674 | expr *lr = r->Left_expr(); |
| 5675 | expr *rr = r->Right_expr(); |
| 5676 | bool invalidValue = false; |
| 5677 | UHDM::ExprEval eval; |
| 5678 | lr = reduceExpr(lr, invalidValue, mod, compileDesign, instance, |
| 5679 | BadPathId, 0, nullptr, true); |
| 5680 | int64_t lrv = eval.get_value(invalidValue, lr); |
| 5681 | rr = reduceExpr(rr, invalidValue, mod, compileDesign, instance, |
| 5682 | BadPathId, 0, nullptr, true); |
| 5683 | int64_t rrv = eval.get_value(invalidValue, rr); |
no test coverage detected