Fix for br884 (packed array access problems)

This commit is contained in:
Cary R 2013-07-28 13:23:17 -07:00
parent 817a38494c
commit bb37b74f98
2 changed files with 5 additions and 3 deletions

View File

@ -3981,6 +3981,7 @@ NetExpr* PEIdent::elaborate_expr_net_part_(Design*des, NetScope*scope,
ivl_assert(*this, lrc);
lrc = net->sig()->sb_to_slice(prefix_indices, msv, moff, mwid);
ivl_assert(*this, lrc);
ivl_assert(*this, lwid == mwid);
if (moff > loff) {
sb_lsb = loff;
@ -3989,6 +3990,7 @@ NetExpr* PEIdent::elaborate_expr_net_part_(Design*des, NetScope*scope,
sb_lsb = moff;
sb_msb = loff + lwid - 1;
}
wid = sb_msb - sb_lsb + 1;
} else {
// This case, the prefix indices are enough to index
// down to a single bit/slice.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2012-2013 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -98,7 +98,7 @@ bool prefix_to_slice(const std::vector<netrange_t>&dims,
if (pcur->get_msb() >= pcur->get_lsb())
acc_off += (sb - pcur->get_lsb()) * acc_wid;
else
acc_off += (sb - pcur->get_msb()) * acc_wid;
acc_off += (pcur->get_lsb() - sb) * acc_wid;
if (prefix.empty()) {
loff = acc_off;
@ -115,7 +115,7 @@ bool prefix_to_slice(const std::vector<netrange_t>&dims,
if (pcur->get_msb() >= pcur->get_lsb())
acc_off += (*icur - pcur->get_lsb()) * acc_wid;
else
acc_off += (*icur - pcur->get_msb()) * acc_wid;
acc_off += (pcur->get_lsb() - *icur) * acc_wid;
} while (icur != prefix.begin());