Merge pull request #845 from wmlye/wmlye/assertion-issue823
Clean up assertions in #823 and #840
This commit is contained in:
commit
46a11f4b67
|
|
@ -6196,7 +6196,14 @@ NetExpr* PEIdent::elaborate_expr_net_bit_(Design*des, NetScope*scope,
|
||||||
unsigned long lwid;
|
unsigned long lwid;
|
||||||
long idx;
|
long idx;
|
||||||
rc = net->sig()->sb_to_slice(prefix_indices, msv, idx, lwid);
|
rc = net->sig()->sb_to_slice(prefix_indices, msv, idx, lwid);
|
||||||
ivl_assert(*this, rc);
|
|
||||||
|
if(!rc) {
|
||||||
|
cerr << get_fileline() << ": error: Index " << net->sig()->name()
|
||||||
|
<< "[" << msv << "] is out of range."
|
||||||
|
<< endl;
|
||||||
|
des->errors += 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Make an expression out of the index
|
// Make an expression out of the index
|
||||||
NetEConst*idx_c = new NetEConst(verinum(idx));
|
NetEConst*idx_c = new NetEConst(verinum(idx));
|
||||||
|
|
|
||||||
20
elab_net.cc
20
elab_net.cc
|
|
@ -465,9 +465,17 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig,
|
||||||
unsigned long tmp_lwid;
|
unsigned long tmp_lwid;
|
||||||
bool rcl = sig->sb_to_slice(prefix_indices, msb,
|
bool rcl = sig->sb_to_slice(prefix_indices, msb,
|
||||||
tmp_loff, tmp_lwid);
|
tmp_loff, tmp_lwid);
|
||||||
ivl_assert(*this, rcl);
|
if(rcl) {
|
||||||
midx = tmp_loff + tmp_lwid - 1;
|
midx = tmp_loff + tmp_lwid - 1;
|
||||||
lidx = tmp_loff;
|
lidx = tmp_loff;
|
||||||
|
} else {
|
||||||
|
cerr << get_fileline() << ": error: Index " << sig->name()
|
||||||
|
<< "[" << msb << "] is out of range."
|
||||||
|
<< endl;
|
||||||
|
des->errors += 1;
|
||||||
|
midx = 0;
|
||||||
|
lidx = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
midx = sig->sb_to_idx(prefix_indices, msb);
|
midx = sig->sb_to_idx(prefix_indices, msb);
|
||||||
if (midx >= (long)sig->vector_width()) {
|
if (midx >= (long)sig->vector_width()) {
|
||||||
|
|
@ -632,13 +640,21 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope,
|
||||||
// containing vector, and member y an offset and width within
|
// containing vector, and member y an offset and width within
|
||||||
// that.
|
// that.
|
||||||
pform_name_t use_path = member_path;
|
pform_name_t use_path = member_path;
|
||||||
|
|
||||||
while (! use_path.empty()) {
|
while (! use_path.empty()) {
|
||||||
const name_component_t member_comp = use_path.front();
|
const name_component_t member_comp = use_path.front();
|
||||||
const perm_string&member_name = member_comp.name;
|
const perm_string&member_name = member_comp.name;
|
||||||
|
|
||||||
unsigned long tmp_off;
|
unsigned long tmp_off;
|
||||||
|
|
||||||
const struct netstruct_t::member_t*member = struct_type->packed_member(member_name, tmp_off);
|
const struct netstruct_t::member_t*member = struct_type->packed_member(member_name, tmp_off);
|
||||||
ivl_assert(*this, member);
|
|
||||||
|
if(!member) {
|
||||||
|
cerr << get_fileline() << ": error: missing element " << path() << endl;
|
||||||
|
des->errors += 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
member_off += tmp_off;
|
member_off += tmp_off;
|
||||||
member_width = member->net_type->packed_width();
|
member_width = member->net_type->packed_width();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
// Testcase for Issue #823 on Github
|
||||||
|
|
||||||
|
module test;
|
||||||
|
struct packed {logic a;} s;
|
||||||
|
assign s.a = 1;
|
||||||
|
assign s.c = 1;
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
// Testcase for Issue #823 on Github
|
||||||
|
|
||||||
|
module test;
|
||||||
|
struct packed {struct packed {logic a;} t;} u;
|
||||||
|
assign u.t.a = 1;
|
||||||
|
assign u.t.c = 1;
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Testcase for Issue #840 on Github
|
||||||
|
|
||||||
|
module test;
|
||||||
|
logic [1:0][1:0] a;
|
||||||
|
logic [1:0][1:0] b;
|
||||||
|
generate
|
||||||
|
for(genvar i=0;i<3;i++)
|
||||||
|
assign b[i] = a[i];
|
||||||
|
endgenerate
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Testchase for #840 on Github
|
||||||
|
|
||||||
|
module test;
|
||||||
|
logic [1:0][1:0] a;
|
||||||
|
logic [2:0][1:0] b;
|
||||||
|
generate
|
||||||
|
for(genvar i=0;i<3;i++)
|
||||||
|
assign b[i] = a[i];
|
||||||
|
endgenerate
|
||||||
|
endmodule
|
||||||
|
|
@ -942,3 +942,7 @@ br_gh451 normal,-g2012,-Ptest.foo=4 ivltests gold=br_gh451.gold
|
||||||
br_gh453 normal,-g2012 ivltests
|
br_gh453 normal,-g2012 ivltests
|
||||||
br_gh460 normal,-g2012 ivltests
|
br_gh460 normal,-g2012 ivltests
|
||||||
issue576 normal,-g2012 ivltests
|
issue576 normal,-g2012 ivltests
|
||||||
|
br_gh823a CE,-g2012 ivltests
|
||||||
|
br_gh823b CE,-g2012 ivltests
|
||||||
|
br_gh840a CE,-g2012 ivltests
|
||||||
|
br_gh840b CE,-g2012 ivltests
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue