mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-15 13:28:59 +00:00
Merge pull request #1848 from YosysHQ/eddie/fix_dynslice
ast: simplify to fully populate dynamic slicing case transformation
This commit is contained in:
commit
926a010b49
|
@ -1727,7 +1727,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
|
||||||
}
|
}
|
||||||
did_something = true;
|
did_something = true;
|
||||||
newNode = new AstNode(AST_CASE, shift_expr);
|
newNode = new AstNode(AST_CASE, shift_expr);
|
||||||
for (int i = 0; i <= source_width-result_width; i++) {
|
for (int i = 0; i < source_width; i++) {
|
||||||
int start_bit = children[0]->id2ast->range_right + i;
|
int start_bit = children[0]->id2ast->range_right + i;
|
||||||
AstNode *cond = new AstNode(AST_COND, mkconst_int(start_bit, true));
|
AstNode *cond = new AstNode(AST_COND, mkconst_int(start_bit, true));
|
||||||
AstNode *lvalue = children[0]->clone();
|
AstNode *lvalue = children[0]->clone();
|
||||||
|
|
12
tests/simple/dynslice.v
Normal file
12
tests/simple/dynslice.v
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module dynslice (
|
||||||
|
input clk ,
|
||||||
|
input [9:0] ctrl ,
|
||||||
|
input [15:0] din ,
|
||||||
|
input [3:0] sel ,
|
||||||
|
output reg [127:0] dout
|
||||||
|
);
|
||||||
|
always @(posedge clk)
|
||||||
|
begin
|
||||||
|
dout[ctrl*sel+:16] <= din ;
|
||||||
|
end
|
||||||
|
endmodule
|
Loading…
Reference in a new issue