/** * @module ccpu * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) * @brief TODO * @date 10.05.2009 */ #ifndef CCPU_H #define CCPU_H 1 #include #include #include "cdat.h" #include "cmem.h" #include "cprogram.h" /** * @class CCPU * * TODO */ class CCPU { public: /** * @method CCPU * @brief Default ctor * @param cnt number of registers to allocate for this cpu * @return - * @globalvars none * @exception none * @conditions none */ CCPU(const unsigned cnt); /** * @method ~CCPU * @brief Default dtor * @param - * @return - * @globalvars none * @exception none * @conditions none */ ~CCPU(); /** * @method getRegisterCount * @brief get number of registers * @param - * @return number of registers * @globalvars none * @exception none * @conditions none */ const unsigned getRegisterCount() { return m_regcnt; } /** * @method getRegisters * @brief get pointer to registers array * @param - * @return pointer to registers array * @globalvars none * @exception none * @conditions none */ CDat *getRegisters() { return m_registers; } /** * @method setMemory * @brief set memory of cpu * @param memory pointer to memory * @return - * @globalvars none * @exception none * @conditions none */ void setMemory(const CMem *memory) { m_memory = memory; } /** * @method getMemory * @brief get pointer to memory * @param - * @return pointer to memory * @globalvars none * @exception none * @conditions none */ const CMem *getMemory() { return m_memory; } /** * @method setProgram * @brief set program to execute * @param memory pointer to program * @return - * @globalvars none * @exception none * @conditions none */ void setProgram(const CProgram *program) { m_program = program; } /** * @method getProgram * @brief get pointer to program * @param - * @return pointer to program * @globalvars none * @exception none * @conditions none */ const CProgram *getProgram() { return m_program; } /** * @method run * @brief execute current program * @param - * @return - * @globalvars none * @exception runtime_error * @conditions none */ void run(); #if DEBUG /** * @method dumpRegisters * @brief dump content of registers to outputstream * @param out outputstream to write to * @return void * @globalvars none * @exception none * @conditions none */ void dumpRegisters(std::ostream& out); #endif private: /* members */ CDat *m_registers; unsigned m_regcnt; const CMem *m_memory; const CProgram *m_program; bool m_flagzero; bool m_flagsign; }; #endif /* vim: set et sw=2 ts=2: */