diff options
| author | Zachary Snow <zach@zachjs.com> | 2021-12-15 18:15:09 -0700 | 
|---|---|---|
| committer | Zachary Snow <zachary.j.snow@gmail.com> | 2021-12-17 21:22:08 -0700 | 
| commit | 7608985d2c6237b869a4774c6b1659282e7473ad (patch) | |
| tree | 129bc1352eca95a6f789ef601a7f7d15ef373566 /frontends | |
| parent | 60c3ea367c942459a95e610ed98f277ce46c0142 (diff) | |
| download | yosys-7608985d2c6237b869a4774c6b1659282e7473ad.tar.gz yosys-7608985d2c6237b869a4774c6b1659282e7473ad.tar.bz2 yosys-7608985d2c6237b869a4774c6b1659282e7473ad.zip | |
fix width detection of array querying function in case and case item expressions
I also removed the unnecessary shadowing of `width_hint` and `sign_hint`
in the corresponding case in `simplify()`.
Diffstat (limited to 'frontends')
| -rw-r--r-- | frontends/ast/genrtlil.cc | 5 | ||||
| -rw-r--r-- | frontends/ast/simplify.cc | 2 | 
2 files changed, 5 insertions, 2 deletions
| diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc index ed709aa33..1fe74bb72 100644 --- a/frontends/ast/genrtlil.cc +++ b/frontends/ast/genrtlil.cc @@ -1087,6 +1087,11 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun  			}  			break;  		} +		if (str == "\\$size" || str == "\\$bits" || str == "\\$high" || str == "\\$low" || str == "\\$left" || str == "\\$right") { +			width_hint = 32; +			sign_hint = true; +			break; +		}  		if (current_scope.count(str))  		{  			// This width detection is needed for function calls which are diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 777f46bd7..cb47e641a 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1389,8 +1389,6 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,  	if (const_fold && type == AST_CASE)  	{ -		int width_hint; -		bool sign_hint;  		detectSignWidth(width_hint, sign_hint);  		while (children[0]->simplify(const_fold, at_zero, in_lvalue, stage, width_hint, sign_hint, in_param)) { }  		if (children[0]->type == AST_CONSTANT && children[0]->bits_only_01()) { | 
