2014-07-23 22:39:29 +02:00
|
|
|
#ifndef IVL_netdarray_H
|
|
|
|
|
#define IVL_netdarray_H
|
2012-07-14 03:41:41 +02:00
|
|
|
/*
|
2025-10-21 07:45:05 +02:00
|
|
|
* Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
|
2012-07-14 03:41:41 +02:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2012-07-14 03:41:41 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "nettypes.h"
|
|
|
|
|
# include "ivl_target.h"
|
|
|
|
|
|
2012-09-30 19:34:09 +02:00
|
|
|
class netdarray_t : public netarray_t {
|
2012-07-14 03:41:41 +02:00
|
|
|
|
|
|
|
|
public:
|
2012-09-30 19:34:09 +02:00
|
|
|
explicit netdarray_t(ivl_type_t vec);
|
2025-10-21 07:45:05 +02:00
|
|
|
~netdarray_t() override;
|
2012-07-14 03:41:41 +02:00
|
|
|
|
2012-09-23 18:28:49 +02:00
|
|
|
// This is the "base_type()" virtual method of the
|
|
|
|
|
// nettype_base_t. The ivl_target api expects this to return
|
|
|
|
|
// IVL_VT_DARRAY for dynamic arrays?
|
2025-10-21 07:45:05 +02:00
|
|
|
ivl_variable_type_t base_type() const override;
|
2012-09-23 18:28:49 +02:00
|
|
|
|
2015-03-02 23:39:21 +01:00
|
|
|
// A dynamic array may have a type that is signed.
|
2025-10-21 07:45:05 +02:00
|
|
|
inline bool get_signed() const override { return element_type()->get_signed(); }
|
2015-03-02 23:39:21 +01:00
|
|
|
|
2012-09-30 19:34:09 +02:00
|
|
|
// This is the base_type() of the element of the array. We
|
|
|
|
|
// need this in some cases in order to get the base type of
|
|
|
|
|
// the element, and not the IVL_VT_DARRAY of the array itself.
|
|
|
|
|
inline ivl_variable_type_t element_base_type() const { return element_type()->base_type(); }
|
2012-09-23 18:28:49 +02:00
|
|
|
|
2012-09-30 19:34:09 +02:00
|
|
|
// This is a convenience function for getting the width of an
|
|
|
|
|
// element. Strictly speaking it's not necessary.
|
|
|
|
|
inline unsigned long element_width(void) const { return element_type()->packed_width(); }
|
2012-07-14 03:41:41 +02:00
|
|
|
|
2025-10-21 07:45:05 +02:00
|
|
|
std::ostream& debug_dump(std::ostream&) const override;
|
2012-09-16 02:16:05 +02:00
|
|
|
|
2012-07-14 03:41:41 +02:00
|
|
|
private:
|
2025-10-21 07:45:05 +02:00
|
|
|
bool test_compatibility(ivl_type_t that) const override;
|
|
|
|
|
bool test_equivalence(ivl_type_t that) const override;
|
2012-07-14 03:41:41 +02:00
|
|
|
};
|
|
|
|
|
|
2014-07-23 22:39:29 +02:00
|
|
|
#endif /* IVL_netdarray_H */
|