Support for wide modulus operations.
[iverilog.git] / pform_types.h
blob151da1569c1bd3e9d95d7d1208f2f835389a444a
1 #ifndef __pform_types_H
2 #define __pform_types_H
3 /*
4 * Copyright (c) 2007 Stephen Williams (steve@icarus.com)
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 #ifdef HAVE_CVS_IDENT
22 #ident "$Id: pform_types.h,v 1.2 2007/06/04 02:19:07 steve Exp $"
23 #endif
25 // This for the perm_string type.
26 # include "StringHeap.h"
27 # include <iostream>
28 # include <list>
31 * parse-form types.
34 struct index_component_t {
35 enum ctype_t { SEL_NONE, SEL_BIT, SEL_PART, SEL_IDX_UP, SEL_IDX_DO };
37 index_component_t() : sel(SEL_NONE), msb(0), lsb(0) { };
38 ~index_component_t() { }
40 ctype_t sel;
41 class PExpr*msb;
42 class PExpr*lsb;
45 struct name_component_t {
46 explicit name_component_t(perm_string n) : name(n) { }
47 ~name_component_t() { }
49 perm_string name;
50 std::list<index_component_t>index;
53 extern bool operator < (const name_component_t&lef, const name_component_t&rig);
56 * The pform_name_t is the general form for a heirarchical identifier.
58 typedef std::list<name_component_t> pform_name_t;
60 inline perm_string peek_head_name(const pform_name_t&that)
62 return that.front().name;
65 inline perm_string peek_tail_name(const pform_name_t&that)
67 return that.back().name;
70 extern std::ostream& operator<< (std::ostream&out, const pform_name_t&);
71 extern std::ostream& operator<< (std::ostream&out, const name_component_t&that);
72 extern std::ostream& operator<< (std::ostream&out, const index_component_t&that);
74 #endif