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 // dimensions, then turn this into a dynamic array and
// put all the packed dimensions there. // put all the packed dimensions there.
if (use_lidx==0 && use_ridx==0) { if (use_lidx==0 && use_ridx==0) {
ivl_assert(*this, netarray==0); netvector_t*vec = new netvector_t(packed_dimensions, data_type_);
netarray = new netdarray_t(packed_dimensions, data_type_, wid);
packed_dimensions.clear(); packed_dimensions.clear();
ivl_assert(*this, netarray==0);
netarray = new netdarray_t(vec);
continue; continue;
} }

View File

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

View File

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