Add support for conditional generate. In the process, fix bugs
[iverilog.git] / PSpec.h
blobce8f8d3a75d7bece8128629e719e53931915f34a
1 #ifndef __PSpec_H
2 #define __PSpec_H
3 /*
4 * Copyright (c) 2006 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: PSpec.h,v 1.3 2007/04/13 02:34:35 steve Exp $"
23 #endif
25 # include "LineInfo.h"
26 # include "StringHeap.h"
27 # include <vector>
29 class PExpr;
32 * The PSpecPath is the parse of a specify path, which is in its most
33 * general form <path> = <delays>. The <delays> are collected into the
34 * "delays" vector in all cases, and the variety is in the other
35 * members.
37 * All paths also have a list of source names in the src vector, and a
38 * list of destination names in the dst vector. These pairs are the
39 * actual paths.
41 * If the path is a simple path, then:
42 * condition == nil
43 * edge == 0
44 * data_source_expression == nil
46 * If the path is conditional, then conditional == true and condition
47 * is the condition expression. If the condition expression is nil,
48 * then this is an ifnone conditional path.
50 * If data_source_expression != nil, then the path is edge sensitive
51 * and the edge might not be 0.
53 class PSpecPath : public LineInfo {
55 public:
56 PSpecPath(unsigned src_cnt, unsigned dst_cnt);
57 ~PSpecPath();
59 void elaborate(class Design*des, class NetScope*scope) const;
61 void dump(std::ostream&out, unsigned ind) const;
63 public:
64 // Condition expression, if present.
65 bool conditional;
66 class PExpr* condition;
67 // Edge specification (-1==negedge, 0 = no edge, 1==posedge)
68 int edge;
69 // Ordered set of source nodes of a path
70 std::vector<perm_string> src;
71 // Ordered set of destination nodes of a path
72 std::vector<perm_string> dst;
73 // Data source expression
74 class PExpr* data_source_expression;
76 std::vector<class PExpr*>delays;
79 #endif