DFG: Correctly set dtype when converting DfgCountOnes to Ast

This commit is contained in:
Geza Lore 2022-10-06 19:19:34 +01:00
parent 6fa14bf029
commit 0570cb8d9f

View File

@ -54,6 +54,16 @@ Node* makeNode(const Vertex* vtxp, Ops... ops) {
//======================================================================
// Vertices needing special conversion
template <>
AstCountOnes* makeNode<AstCountOnes, DfgCountOnes, AstNodeMath*>( //
const DfgCountOnes* vtxp, AstNodeMath* op1) {
AstCountOnes* const nodep = new AstCountOnes{vtxp->fileline(), op1};
// Set dtype same as V3Width
const int selwidth = V3Number::log2b(nodep->lhsp()->width()) + 1;
nodep->dtypeSetLogicSized(selwidth, VSigning::UNSIGNED);
return nodep;
}
template <>
AstExtend* makeNode<AstExtend, DfgExtend, AstNodeMath*>( //
const DfgExtend* vtxp, AstNodeMath* op1) {