diff options
author | Peter Crozier <peter@crozier.com> | 2020-06-09 13:52:09 +0100 |
---|---|---|
committer | Peter Crozier <peter@crozier.com> | 2020-06-09 13:52:09 +0100 |
commit | f80b09fc5853da904dad902b3dfaa5fa44fc51af (patch) | |
tree | 5e4ad3a9c4d26908d337d93db6b2a5ba336ae75f /frontends | |
parent | 01ec6813730b0d4d83316b22352b5431456a8388 (diff) | |
download | yosys-f80b09fc5853da904dad902b3dfaa5fa44fc51af.tar.gz yosys-f80b09fc5853da904dad902b3dfaa5fa44fc51af.tar.bz2 yosys-f80b09fc5853da904dad902b3dfaa5fa44fc51af.zip |
Support 2D packed bit arrays in struct/union.
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/simplify.cc | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index c9da8ba48..f11383b96 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -383,43 +383,9 @@ static AstNode *node_int(int ival) return AstNode::mkconst_int(ival, true); } -static AstNode *node_uint(uint ival) -{ - return AstNode::mkconst_int(ival, false); -} - -static unsigned int power_of_two(int n) -{ - // iff n is a power of two then return the power, else return 0 - // caller must ensure n > 1 - log_assert(n > 1); - if (n & (n - 1)) { - // not a power of 2 - return 0; - } - // brute force the shift - for (unsigned int i = 1; i < 32; i++) { - n >>= 1; - if (n & 1) { - return i; - } - } - return 0; -} - static AstNode *multiply_by_const(AstNode *expr_node, int stride) { - // the stride is very likely a power of 2, e.g. 8 for bytes - // and so could be optimised with a shift - AstNode *node; - unsigned int shift; - if ((shift = power_of_two(stride)) > 0) { - node = new AstNode(AST_SHIFT_LEFT, expr_node, node_uint(shift)); - } - else { - node = new AstNode(AST_MUL, expr_node, node_int(stride)); - } - return node; + return new AstNode(AST_MUL, expr_node, node_int(stride)); } static AstNode *offset_indexed_range(int offset, int stride, AstNode *left_expr, AstNode *right_expr) |