From 45581d3d376e8deed84952cb838ae330549e5241 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 12 May 2009 23:18:17 +0200 Subject: my cpu design --- ue3/mycpu/cinstruction.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 ue3/mycpu/cinstruction.h (limited to 'ue3/mycpu/cinstruction.h') diff --git a/ue3/mycpu/cinstruction.h b/ue3/mycpu/cinstruction.h new file mode 100644 index 0000000..b16c067 --- /dev/null +++ b/ue3/mycpu/cinstruction.h @@ -0,0 +1,98 @@ +/** + * @module cinstruction + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#ifndef CINSTRUCTION_H +#define CINSTRUCTION_H 1 + +#include +#include +//#include "ccpu.h" + +/* declare CCPU */ +class CCPU; + +/** + * @class CInstruction + * + * TODO + */ +class CInstruction +{ + public: + /** + * @method CInstruction + * @brief Default ctor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + CInstruction(std::string name) + : m_name(name) + {}; + + /** + * @method ~CInstruction + * @brief Default dtor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + virtual ~CInstruction() + {}; + + /* TODO */ + virtual bool operator==(std::string& name) + { + return name == m_name; + } + + /* TODO */ + virtual const std::string& getName() + { + return m_name; + } + + /* TODO */ + virtual std::ostream& dump(std::ostream& stream) + { + stream << m_name; + return stream; + } + + /* TODO */ + friend std::ostream& operator<<(std::ostream& stream, CInstruction& instr) + { + return instr.dump(stream); + } + + /* TODO */ + virtual const unsigned parseRegister(const std::string& str); + + /* TODO */ + virtual void checkRegister(CCPU *cpu, unsigned regidx); + + /* TODO */ + virtual CInstruction *factory() = 0; + + /* TODO */ + virtual void compile(std::list& params) = 0; + + /* TODO */ + virtual void execute(CCPU *cpu) = 0; + + protected: + /* members */ + std::string m_name; +}; + +#endif + +/* vim: set et sw=2 ts=2: */ -- cgit v1.2.3