File: Update.hpp

package info (click to toggle)
fauhdlc 20100325-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,724 kB
  • ctags: 3,646
  • sloc: cpp: 22,017; ansic: 5,778; yacc: 806; lex: 744; makefile: 546; python: 461; xml: 381; sh: 61
file content (71 lines) | stat: -rw-r--r-- 1,818 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* $Id: Update.hpp 4323 2009-01-27 13:48:12Z potyra $ 
 *
 * Update: update a signal (intermediate opcode)
 *
 * Copyright (C) 2008-2009 FAUmachine Team <info@faumachine.org>.
 * This program is free software. You can redistribute it and/or modify it
 * under the terms of the GNU General Public License, either version 2 of
 * the License, or (at your option) any later version. See COPYING.
 */

#ifndef __UPDATE_HPP_INCLUDED
#define __UPDATE_HPP_INCLUDED

#include "intermediate/opcodes/OpCode.hpp"
#include <cassert>
#include "intermediate/operands/Operand.hpp"

namespace intermediate {

//! update a given driver
/** This class will update a given driver after a given delay, assuming the
 *  initial transport mechanism.
 *
 *  Read operands src, delay
 *  Write operands: trg 
 *
 *  src: source value of the operation (any type allowed)
 *  delay: delay value (integer)
 *  dst: DirectOperand pointing to the driver (pointer)
 *
 *  Operation: call to the kernel, to add <src,delay> to given driver.
 */
class Update : public OpCode {
public:
	Update(
		Operand *source,
		Operand *delayOp,
		Operand *dest
		) :	src(source), delay(delayOp), dst(dest) {

		assert(delay->type == OP_TYPE_INTEGER);
		assert(dst->type == OP_TYPE_POINTER);
	}

	//! Accept a Visitor.
 	/** All intermediate code nodes need to implement this method.
         *
         *  @param v the Visitor that can visit this node.
         */
	virtual void accept(Visitor& v) {
		v.visit(*this);
	}

	//! source operand
	Operand *src;
	//! delay operand
	Operand *delay;
	//! destination operand
	Operand *dst;

protected:
	virtual ~Update() {
		util::MiscUtil::terminate(this->src);
		util::MiscUtil::terminate(this->delay);
		util::MiscUtil::terminate(this->dst);
	}
};

}; /* namespace intermediate */

#endif /* __UPDATE_HPP_INCLUDED */