Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 126 lines (102 sloc) 2.155 kb
769159d @steveicarus Add parse decorations for expressions.
steveicarus authored
1 /*
2 * Copyright (c) 2011 Stephen Williams (steve@icarus.com)
3 *
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 */
19
20 # include "expression.h"
21
22 Expression::Expression()
23 {
24 }
25
26 Expression::~Expression()
27 {
28 }
29
7d55298 @steveicarus Elaborate array subtypes of ports.
steveicarus authored
30 bool Expression::evaluate(int64_t&) const
31 {
32 return false;
33 }
34
cbb213d @steveicarus Support for some arithmetic operators.
steveicarus authored
35 ExpBinary::ExpBinary(Expression*op1, Expression*op2)
36 : operand1_(op1), operand2_(op2)
37 {
38 }
39
40 ExpBinary::~ExpBinary()
41 {
42 delete operand1_;
43 delete operand2_;
44 }
45
e172b4d @steveicarus Add support for unary abs and not operators.
steveicarus authored
46 ExpUnary::ExpUnary(Expression*op1)
47 : operand1_(op1)
48 {
49 }
50
51 ExpUnary::~ExpUnary()
52 {
53 delete operand1_;
54 }
55
cbb213d @steveicarus Support for some arithmetic operators.
steveicarus authored
56 ExpArithmetic::ExpArithmetic(ExpArithmetic::fun_t op, Expression*op1, Expression*op2)
57 : ExpBinary(op1, op2), fun_(op)
58 {
59 }
60
61 ExpArithmetic::~ExpArithmetic()
62 {
63 }
64
7d55298 @steveicarus Elaborate array subtypes of ports.
steveicarus authored
65 ExpInteger::ExpInteger(int64_t val)
66 : value_(val)
67 {
68 }
69
70 ExpInteger::~ExpInteger()
71 {
72 }
73
74 bool ExpInteger::evaluate(int64_t&val) const
75 {
76 val = value_;
77 return true;
78 }
79
769159d @steveicarus Add parse decorations for expressions.
steveicarus authored
80 ExpLogical::ExpLogical(ExpLogical::fun_t ty, Expression*op1, Expression*op2)
cbb213d @steveicarus Support for some arithmetic operators.
steveicarus authored
81 : ExpBinary(op1, op2), fun_(ty)
769159d @steveicarus Add parse decorations for expressions.
steveicarus authored
82 {
83 }
84
85 ExpLogical::~ExpLogical()
86 {
87 }
88
89 ExpName::ExpName(perm_string nn)
162b26c @steveicarus Add more complete support for vhdl local signals.
steveicarus authored
90 : name_(nn), index_(0)
91 {
92 }
93
94 ExpName::ExpName(perm_string nn, Expression*ix)
95 : name_(nn), index_(ix)
769159d @steveicarus Add parse decorations for expressions.
steveicarus authored
96 {
97 }
98
99 ExpName::~ExpName()
100 {
162b26c @steveicarus Add more complete support for vhdl local signals.
steveicarus authored
101 delete index_;
769159d @steveicarus Add parse decorations for expressions.
steveicarus authored
102 }
e172b4d @steveicarus Add support for unary abs and not operators.
steveicarus authored
103
37d6de3 @pszostek Add use clause parsing
pszostek authored
104 const char* ExpName::name() const
105 {
106 return name_;
107 }
108
e172b4d @steveicarus Add support for unary abs and not operators.
steveicarus authored
109 ExpUAbs::ExpUAbs(Expression*op1)
110 : ExpUnary(op1)
111 {
112 }
113
114 ExpUAbs::~ExpUAbs()
115 {
116 }
117
118 ExpUNot::ExpUNot(Expression*op1)
119 : ExpUnary(op1)
120 {
121 }
122
123 ExpUNot::~ExpUNot()
124 {
125 }
Something went wrong with that request. Please try again.