From 0570cb8d9fa35864e3a5c34b8233c70bdb814b4d Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 6 Oct 2022 19:19:34 +0100 Subject: [PATCH] DFG: Correctly set dtype when converting DfgCountOnes to Ast --- src/V3DfgDfgToAst.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/V3DfgDfgToAst.cpp b/src/V3DfgDfgToAst.cpp index 2cab9eaec..be47278a9 100644 --- a/src/V3DfgDfgToAst.cpp +++ b/src/V3DfgDfgToAst.cpp @@ -54,6 +54,16 @@ Node* makeNode(const Vertex* vtxp, Ops... ops) { //====================================================================== // Vertices needing special conversion +template <> +AstCountOnes* makeNode( // + 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( // const DfgExtend* vtxp, AstNodeMath* op1) {