Cleaner netdarray_t implementation.

This commit is contained in:
Stephen Williams 2012-09-15 11:27:03 -07:00
parent 92313654ec
commit 997274b98f
3 changed files with 13 additions and 13 deletions

View File

@ -1098,9 +1098,10 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
// dimensions, then turn this into a dynamic array and
// put all the packed dimensions there.
if (use_lidx==0 && use_ridx==0) {
ivl_assert(*this, netarray==0);
netarray = new netdarray_t(packed_dimensions, data_type_, wid);
netvector_t*vec = new netvector_t(packed_dimensions, data_type_);
packed_dimensions.clear();
ivl_assert(*this, netarray==0);
netarray = new netdarray_t(vec);
continue;
}

View File

@ -21,12 +21,12 @@
using namespace std;
netdarray_t::netdarray_t(const std::list<netrange_t>&packed,
ivl_variable_type_t type, unsigned long wid)
: packed_dims_(packed), type_(type), width_(wid)
netdarray_t::netdarray_t(netvector_t*vec)
: elem_type_(vec)
{
}
netdarray_t::~netdarray_t()
{
delete elem_type_;
}

View File

@ -20,24 +20,23 @@
*/
# include "nettypes.h"
# include "netvector.h"
# include "ivl_target.h"
# include <list>
class netvector_t;
class netdarray_t : public nettype_base_t {
public:
explicit netdarray_t(const std::list<netrange_t>&packed,
ivl_variable_type_t type,
unsigned long wid);
explicit netdarray_t(netvector_t*vec);
~netdarray_t();
inline ivl_variable_type_t data_type() const { return type_; }
inline unsigned long vector_width(void) const { return width_; }
inline ivl_variable_type_t data_type() const { return elem_type_->base_type(); }
inline unsigned long vector_width(void) const { return elem_type_->packed_width(); }
private:
std::list<netrange_t> packed_dims_;
ivl_variable_type_t type_;
unsigned long width_;
netvector_t*elem_type_;
};
#endif