From e799a0960565aaffc73073529781b9cdb3b651c8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 17 Mar 2022 10:38:10 +0100 Subject: [PATCH] data_type_t: Remove figure_packed_base_type() method The figure_packed_base_type() method can be used to check whether a type is 2-state or 4-state at parse time. The parser no longer cares about the specific type of a data type. The figure_packed_base_type() function is no longer used, so remove it. Signed-off-by: Lars-Peter Clausen --- Makefile.in | 2 +- pform_struct_type.cc | 60 -------------------------------------------- pform_types.cc | 31 ----------------------- pform_types.h | 10 -------- 4 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 pform_struct_type.cc diff --git a/Makefile.in b/Makefile.in index b3af18d84..d648f66a4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -116,7 +116,7 @@ O = main.o async.o design_dump.o discipline.o dup_expr.o elaborate.o \ net_nex_input.o net_nex_output.o net_proc.o net_scope.o net_tran.o \ net_udp.o pad_to_width.o parse.o parse_misc.o pform.o pform_analog.o \ pform_disciplines.o pform_dump.o pform_package.o pform_pclass.o \ - pform_struct_type.o pform_types.o \ + pform_types.o \ symbol_search.o sync.o sys_funcs.o verinum.o verireal.o vpi_modules.o target.o \ Attrib.o HName.o Module.o PClass.o PDelays.o PEvent.o PExpr.o PFunction.o \ PGate.o PGenerate.o PModport.o PNamedItem.o PPackage.o PScope.o PSpec.o \ diff --git a/pform_struct_type.cc b/pform_struct_type.cc deleted file mode 100644 index fb88c541e..000000000 --- a/pform_struct_type.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011-2021 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 - * 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 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -# include "pform.h" -# include "parse_misc.h" -# include "ivl_assert.h" - -using namespace std; - -ivl_variable_type_t struct_type_t::figure_packed_base_type(void) const -{ - if (! packed_flag) - return IVL_VT_NO_TYPE; - - if (members.get() == 0) - return IVL_VT_NO_TYPE; - - ivl_variable_type_t base_type = IVL_VT_BOOL; - - ivl_assert(*this, members.get()); - for (list::iterator cur = members->begin() - ; cur != members->end() ; ++ cur) { - - struct_member_t*tmp = *cur; - - ivl_variable_type_t tmp_type = IVL_VT_NO_TYPE; - if (tmp->type.get()) - tmp_type = tmp->type->figure_packed_base_type(); - - if (tmp_type == IVL_VT_BOOL) { - continue; - } - - if (tmp_type == IVL_VT_LOGIC) { - base_type = IVL_VT_LOGIC; - continue; - } - - // Oh no! Member is not a packable type! - return IVL_VT_NO_TYPE; - } - - return base_type; -} diff --git a/pform_types.cc b/pform_types.cc index 7df2ccbc2..56509a54c 100644 --- a/pform_types.cc +++ b/pform_types.cc @@ -33,37 +33,6 @@ string_type_t::~string_type_t() { } -ivl_variable_type_t data_type_t::figure_packed_base_type(void) const -{ - return IVL_VT_NO_TYPE; -} - -ivl_variable_type_t parray_type_t::figure_packed_base_type(void) const -{ - return base_type->figure_packed_base_type(); -} - -ivl_variable_type_t vector_type_t::figure_packed_base_type(void) const -{ - return base_type; -} - -ivl_variable_type_t enum_type_t::figure_packed_base_type() const -{ - return base_type->figure_packed_base_type(); -} - -ivl_variable_type_t atom_type_t::figure_packed_base_type() const -{ - switch (type_code) { - case TIME: - case INT: - return IVL_VT_LOGIC; - default: - return IVL_VT_BOOL; - } -} - atom_type_t size_type (atom_type_t::INT, true); PNamedItem::SymbolType enum_type_t::symbol_type() const diff --git a/pform_types.h b/pform_types.h index d40dc08a7..557b2a268 100644 --- a/pform_types.h +++ b/pform_types.h @@ -155,9 +155,6 @@ class data_type_t : public PNamedItem { public: inline explicit data_type_t() { } virtual ~data_type_t() = 0; - // This method is used to figure out the base type of a packed - // compound object. Return IVL_VT_NO_TYPE if the type is not packed. - virtual ivl_variable_type_t figure_packed_base_type(void)const; // This method is used by the pform dumper to diagnostic dump. The // pform_dump dumps type type in pform format, and the debug_dump // prints the output in a linear form. @@ -194,8 +191,6 @@ struct enum_type_t : public data_type_t { // Return the elaborated version of the type. ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; - ivl_variable_type_t figure_packed_base_type() const; - SymbolType symbol_type() const; data_type_t *base_type; @@ -209,7 +204,6 @@ struct struct_member_t : public LineInfo { }; struct struct_type_t : public data_type_t { - virtual ivl_variable_type_t figure_packed_base_type(void)const; virtual void pform_dump(std::ostream&out, unsigned indent) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; @@ -238,8 +232,6 @@ struct atom_type_t : public data_type_t { virtual std::ostream& debug_dump(std::ostream&out) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; - - ivl_variable_type_t figure_packed_base_type() const; }; extern atom_type_t size_type; @@ -262,7 +254,6 @@ struct vector_type_t : public data_type_t { inline explicit vector_type_t(ivl_variable_type_t bt, bool sf, std::list*pd) : base_type(bt), signed_flag(sf), integer_flag(false), implicit_flag(false), pdims(pd) { } - virtual ivl_variable_type_t figure_packed_base_type(void)const; virtual void pform_dump(std::ostream&out, unsigned indent) const; virtual std::ostream& debug_dump(std::ostream&out) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; @@ -293,7 +284,6 @@ struct parray_type_t : public array_base_t { inline explicit parray_type_t(data_type_t*btype, std::list*pd) : array_base_t(btype, pd) { } - virtual ivl_variable_type_t figure_packed_base_type(void)const; virtual void pform_dump(std::ostream&out, unsigned indent) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; };