2014-07-23 22:39:29 +02:00
|
|
|
#ifndef IVL_AStatement_H
|
|
|
|
|
#define IVL_AStatement_H
|
2008-07-27 21:02:09 +02:00
|
|
|
/*
|
2025-10-13 22:14:57 +02:00
|
|
|
* Copyright (c) 2008-2025 Stephen Williams (steve@icarus.com)
|
2008-07-27 21:02:09 +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.
|
2008-07-27 21:02:09 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include <map>
|
2008-10-22 07:15:49 +02:00
|
|
|
# include "ivl_target.h"
|
2008-07-27 21:02:09 +02:00
|
|
|
# include "StringHeap.h"
|
|
|
|
|
# include "LineInfo.h"
|
2008-10-23 06:56:00 +02:00
|
|
|
# include "Statement.h"
|
2008-08-31 23:36:52 +02:00
|
|
|
# include "PExpr.h"
|
2008-07-27 21:02:09 +02:00
|
|
|
|
|
|
|
|
class PExpr;
|
2008-10-22 07:15:49 +02:00
|
|
|
class NetAnalog;
|
|
|
|
|
class NetScope;
|
|
|
|
|
class Design;
|
2008-07-27 21:02:09 +02:00
|
|
|
|
2008-07-27 23:22:19 +02:00
|
|
|
/*
|
|
|
|
|
* A contribution statement is like an assignment: there is an l-value
|
|
|
|
|
* expression and an r-value expression. The l-value is a branch probe
|
|
|
|
|
* expression.
|
|
|
|
|
*/
|
2008-10-23 06:56:00 +02:00
|
|
|
class AContrib : public Statement {
|
2008-07-27 21:02:09 +02:00
|
|
|
|
|
|
|
|
public:
|
2008-07-27 23:22:19 +02:00
|
|
|
AContrib(PExpr*lval, PExpr*rval);
|
2025-10-13 22:14:57 +02:00
|
|
|
~AContrib() override;
|
2008-07-27 21:02:09 +02:00
|
|
|
|
2025-10-13 22:14:57 +02:00
|
|
|
virtual void dump(std::ostream&out, unsigned ind) const override;
|
|
|
|
|
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
|
2008-07-27 23:22:19 +02:00
|
|
|
|
2008-07-27 21:02:09 +02:00
|
|
|
private:
|
2008-07-27 23:22:19 +02:00
|
|
|
PExpr*lval_;
|
|
|
|
|
PExpr*rval_;
|
2008-07-27 21:02:09 +02:00
|
|
|
};
|
|
|
|
|
|
2008-07-27 23:22:19 +02:00
|
|
|
/*
|
|
|
|
|
* An analog process is not a statement, but contains an analog
|
|
|
|
|
* statement. The process is where we attach process characteristics
|
|
|
|
|
* such as initial vs. always, attributes....
|
|
|
|
|
*/
|
2008-07-27 21:02:09 +02:00
|
|
|
class AProcess : public LineInfo {
|
|
|
|
|
|
|
|
|
|
public:
|
2008-10-23 06:56:00 +02:00
|
|
|
AProcess(ivl_process_type_t t, Statement*st)
|
2008-07-27 21:02:09 +02:00
|
|
|
: type_(t), statement_(st) { }
|
|
|
|
|
|
2025-10-13 22:14:57 +02:00
|
|
|
~AProcess() override;
|
2008-07-27 21:02:09 +02:00
|
|
|
|
2008-10-22 07:15:49 +02:00
|
|
|
bool elaborate(Design*des, NetScope*scope) const;
|
|
|
|
|
|
|
|
|
|
ivl_process_type_t type() const { return type_; }
|
2008-10-23 06:56:00 +02:00
|
|
|
Statement*statement() { return statement_; }
|
2008-10-22 07:15:49 +02:00
|
|
|
|
2021-11-04 17:12:04 +01:00
|
|
|
std::map<perm_string,PExpr*> attributes;
|
2008-07-27 21:02:09 +02:00
|
|
|
|
|
|
|
|
// Dump the analog process
|
2021-11-04 17:12:04 +01:00
|
|
|
void dump(std::ostream&out, unsigned ind) const;
|
2008-07-27 21:02:09 +02:00
|
|
|
|
|
|
|
|
private:
|
2008-10-22 07:15:49 +02:00
|
|
|
ivl_process_type_t type_;
|
2008-10-23 06:56:00 +02:00
|
|
|
Statement*statement_;
|
2008-07-27 21:02:09 +02:00
|
|
|
|
|
|
|
|
private: // not implemented
|
|
|
|
|
AProcess(const AProcess&);
|
|
|
|
|
AProcess& operator= (const AProcess&);
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-23 22:39:29 +02:00
|
|
|
#endif /* IVL_AStatement_H */
|