mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #976 from YosysHQ/clifford/fix974
Fix width detection of memory access with bit slice
This commit is contained in:
commit
71ede7cb05
|
@ -645,6 +645,8 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
||||||
if (!id_ast->children[0]->range_valid)
|
if (!id_ast->children[0]->range_valid)
|
||||||
log_file_error(filename, linenum, "Failed to detect width of memory access `%s'!\n", str.c_str());
|
log_file_error(filename, linenum, "Failed to detect width of memory access `%s'!\n", str.c_str());
|
||||||
this_width = id_ast->children[0]->range_left - id_ast->children[0]->range_right + 1;
|
this_width = id_ast->children[0]->range_left - id_ast->children[0]->range_right + 1;
|
||||||
|
if (children.size() > 1)
|
||||||
|
range = children[1];
|
||||||
} else
|
} else
|
||||||
log_file_error(filename, linenum, "Failed to detect width for identifier %s!\n", str.c_str());
|
log_file_error(filename, linenum, "Failed to detect width for identifier %s!\n", str.c_str());
|
||||||
if (range) {
|
if (range) {
|
||||||
|
|
|
@ -1607,6 +1607,7 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
current_scope[wire_tmp->str] = wire_tmp;
|
current_scope[wire_tmp->str] = wire_tmp;
|
||||||
wire_tmp->attributes["\\nosync"] = AstNode::mkconst_int(1, false);
|
wire_tmp->attributes["\\nosync"] = AstNode::mkconst_int(1, false);
|
||||||
while (wire_tmp->simplify(true, false, false, 1, -1, false, false)) { }
|
while (wire_tmp->simplify(true, false, false, 1, -1, false, false)) { }
|
||||||
|
wire_tmp->is_logic = true;
|
||||||
|
|
||||||
AstNode *wire_tmp_id = new AstNode(AST_IDENTIFIER);
|
AstNode *wire_tmp_id = new AstNode(AST_IDENTIFIER);
|
||||||
wire_tmp_id->str = wire_tmp->str;
|
wire_tmp_id->str = wire_tmp->str;
|
||||||
|
|
|
@ -92,3 +92,25 @@ module mem2reg_test5(input ctrl, output out);
|
||||||
assign out = bar[foo[0]];
|
assign out = bar[foo[0]];
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
// ------------------------------------------------------
|
||||||
|
|
||||||
|
module mem2reg_test6 (din, dout);
|
||||||
|
input wire [3:0] din;
|
||||||
|
output reg [3:0] dout;
|
||||||
|
|
||||||
|
reg [1:0] din_array [1:0];
|
||||||
|
reg [1:0] dout_array [1:0];
|
||||||
|
|
||||||
|
always @* begin
|
||||||
|
din_array[0] = din[0 +: 2];
|
||||||
|
din_array[1] = din[2 +: 2];
|
||||||
|
|
||||||
|
dout_array[0] = din_array[0];
|
||||||
|
dout_array[1] = din_array[1];
|
||||||
|
|
||||||
|
{dout_array[0][1], dout_array[0][0]} = dout_array[0][0] + dout_array[1][0];
|
||||||
|
|
||||||
|
dout[0 +: 2] = dout_array[0];
|
||||||
|
dout[2 +: 2] = dout_array[1];
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
Loading…
Reference in New Issue