1 #ifndef IVL_netdarray_H 2 #define IVL_netdarray_H 3 /* 4 * Copyright (c) 2012-2015 Stephen Williams (steve@icarus.com) 5 * 6 * This source code is free software; you can redistribute it 7 * and/or modify it in source code form under the terms of the GNU 8 * General Public License as published by the Free Software 9 * Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 */ 21 22 # include "nettypes.h" 23 # include "ivl_target.h" 24 25 class netdarray_t : public netarray_t { 26 27 public: 28 explicit netdarray_t(ivl_type_t vec); 29 ~netdarray_t(); 30 31 // This is the "base_type()" virtual method of the 32 // nettype_base_t. The ivl_target api expects this to return 33 // IVL_VT_DARRAY for dynamic arrays? 34 ivl_variable_type_t base_type() const; 35 36 // A dynamic array may have a type that is signed. get_signed()37 inline bool get_signed() const { return element_type()->get_signed(); } 38 39 // This is the base_type() of the element of the array. We 40 // need this in some cases in order to get the base type of 41 // the element, and not the IVL_VT_DARRAY of the array itself. element_base_type()42 inline ivl_variable_type_t element_base_type() const { return element_type()->base_type(); } 43 44 // This is a convenience function for getting the width of an 45 // element. Strictly speaking it's not necessary. element_width(void)46 inline unsigned long element_width(void) const { return element_type()->packed_width(); } 47 48 std::ostream& debug_dump(std::ostream&) const; 49 50 private: 51 bool test_compatibility(ivl_type_t that) const; 52 }; 53 54 #endif /* IVL_netdarray_H */ 55