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/Makefile | 8 +-- ue3/mycpu/ccpu.cpp | 78 +++++++++++++++++++++ ue3/mycpu/ccpu.h | 167 +++++++++++++++++++++++++++++++++++++++++++++ ue3/mycpu/cdat.h | 29 ++++++-- ue3/mycpu/cdisplay.h | 48 +++++++++++++ ue3/mycpu/cinstruction.cpp | 46 +++++++++++++ ue3/mycpu/cinstruction.h | 98 ++++++++++++++++++++++++++ ue3/mycpu/cmem.h | 109 +++++++++++++++++++++++++++++ ue3/mycpu/cprogram.cpp | 126 ++++++++++++++++++++++++++++++++++ ue3/mycpu/cprogram.h | 78 +++++++++++++++++++++ ue3/mycpu/instructions.cpp | 27 ++++++++ ue3/mycpu/instructions.h | 66 ++++++++++++++++++ ue3/mycpu/mycpu.cpp | 152 +++++++++++++++++++++++++++++++++++++++++ 13 files changed, 1022 insertions(+), 10 deletions(-) create mode 100644 ue3/mycpu/ccpu.cpp create mode 100644 ue3/mycpu/ccpu.h create mode 100644 ue3/mycpu/cdisplay.h create mode 100644 ue3/mycpu/cinstruction.cpp create mode 100644 ue3/mycpu/cinstruction.h create mode 100644 ue3/mycpu/cmem.h create mode 100644 ue3/mycpu/cprogram.cpp create mode 100644 ue3/mycpu/cprogram.h create mode 100644 ue3/mycpu/instructions.cpp create mode 100644 ue3/mycpu/instructions.h create mode 100644 ue3/mycpu/mycpu.cpp diff --git a/ue3/mycpu/Makefile b/ue3/mycpu/Makefile index 6f57741..16067d1 100644 --- a/ue3/mycpu/Makefile +++ b/ue3/mycpu/Makefile @@ -6,13 +6,13 @@ CXX= g++ LD= $(CXX) DEBUGFLAGS= -DNDEBUG INCLUDE_PATH= -I/usr/local/include -CXXFLAGS= -O -ansi -pedantic-errors -Wall $(INCLUDE_PATH) $(DEBUGFLAGS) +CXXFLAGS= -O -ansi -pedantic-errors -Wall -Wno-long-long $(INCLUDE_PATH) $(DEBUGFLAGS) LDFLAGS= -LIBS= -L/usr/local/lib +LIBS= -L/usr/local/lib -lboost_program_options BIN= mycpu -OBJS= mycpu.o cdat.o -HEADERS= cdat.h +OBJS= cinstruction.o instructions.o cprogram.o ccpu.o mycpu.o +HEADERS= cdat.h cmem.h cinstruction.h instructions.h cprogram.h cdisplay.h ccpu.h .SUFFIXES: .cpp .o diff --git a/ue3/mycpu/ccpu.cpp b/ue3/mycpu/ccpu.cpp new file mode 100644 index 0000000..6f364f8 --- /dev/null +++ b/ue3/mycpu/ccpu.cpp @@ -0,0 +1,78 @@ +/** + * @module ccpu + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#ifdef DEBUG +# include +# include +#endif +#include "ccpu.h" + +using namespace std; + +CCPU::CCPU(const unsigned cnt) + : m_regcnt(cnt), m_memory(NULL), m_program(NULL), m_flagzero(0), m_flagsign(0) +{ + m_registers = new CDat[cnt]; + for(unsigned i = 0; i < cnt; ++i) + m_registers[i] = 0; +} + +/*----------------------------------------------------------------------------*/ + +CCPU::~CCPU() +{ + delete[] m_registers; + m_registers = NULL; +} + +/*----------------------------------------------------------------------------*/ + +void CCPU::run() +{ + if (m_memory == NULL) + throw runtime_error("CPU has no memory"); + if (m_program == NULL) + throw runtime_error("CPU has no program to execute"); + if (m_regcnt == 0) + throw runtime_error("CPU has no registers"); + + bool run = true; + while(run) + { + unsigned pc = static_cast(m_registers[0]); + + /* end of the program reached */ + if (pc == m_program->size()) + return; + + /* pc is out of bound */ + if (pc > m_program->size()) + throw runtime_error("Programcounter is out of bound"); + + /* execute instruction */ + m_program->at(pc)->execute(this); + ++m_registers[0]; + } + + cout << "LALA" << endl; +} + +/*----------------------------------------------------------------------------*/ + +#if DEBUG +void CCPU::dumpRegisters(std::ostream& out) +{ + out << "[REGISTER DUMP]" << endl; + for(unsigned i = 0; i < getRegisterCount(); ++i) + { + out << "[" << std::setw(4) << std::setfill('0') << i << "] " + << m_registers[i] << endl; + } +} +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h new file mode 100644 index 0000000..e28a7cc --- /dev/null +++ b/ue3/mycpu/ccpu.h @@ -0,0 +1,167 @@ +/** + * @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: */ diff --git a/ue3/mycpu/cdat.h b/ue3/mycpu/cdat.h index dc8a07c..365bd88 100644 --- a/ue3/mycpu/cdat.h +++ b/ue3/mycpu/cdat.h @@ -1,12 +1,12 @@ /** * @module cdat * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief Datatype template for mycpu + * @brief Datatype template and datatype definition for CCPU and CMem * @date 10.05.2009 */ -#ifndef CDATT_H -#define CDATT_H +#ifndef CDAT_H +#define CDAT_H 1 #include #include @@ -14,7 +14,7 @@ /** * @class CDatT * - * Datatype template for mycpu. + * Datatype template for CCPU and CMem. */ template class CDatT @@ -85,6 +85,20 @@ class CDatT return m_value; } + /** + * @method operator T + * @brief convert to T + * @param - + * @return T + * @globalvars none + * @exception none + * @conditions none + */ + operator T() + { + return m_value; + } + /** * @method operator< * @brief implementation of operator < @@ -300,8 +314,11 @@ class CDatT T m_value; }; - -/** define CDat */ +/** + * @class CDat + * + * Datatype for CCPU and CMem + */ typedef CDatT CDat; #endif diff --git a/ue3/mycpu/cdisplay.h b/ue3/mycpu/cdisplay.h new file mode 100644 index 0000000..629ec88 --- /dev/null +++ b/ue3/mycpu/cdisplay.h @@ -0,0 +1,48 @@ +/** + * @module cdisplay + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#ifndef CDISPLAY_H +#define CDISPLAY_H #1 + +/** + * @class CDisplay + * + * TODO + */ +class CDisplay +{ + public: + /** + * @method CDisplay + * @brief Default ctor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + CDisplay() + {}; + + /** + * @method ~CDisplay + * @brief Default dtor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + ~CDisplay(); + + private: + /* members */ +}; + +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/cinstruction.cpp b/ue3/mycpu/cinstruction.cpp new file mode 100644 index 0000000..32bdd2f --- /dev/null +++ b/ue3/mycpu/cinstruction.cpp @@ -0,0 +1,46 @@ +/** + * @module cinstruction + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#include +#include +#include +#include "cinstruction.h" +#include "ccpu.h" + +using namespace std; + +const unsigned CInstruction::parseRegister(const std::string& str) +{ + unsigned reg; + if (str.length() < 2 || str[0] != 'R') + throw runtime_error("Invalid syntax of register"); + + try + { + reg = boost::lexical_cast(str.substr(1)); + } + catch(boost::bad_lexical_cast& ex) + { + throw runtime_error("Invalid syntax of register"); + } + + return reg; +} + +/*----------------------------------------------------------------------------*/ + +inline void CInstruction::checkRegister(CCPU *cpu, unsigned regidx) +{ + if (regidx >= cpu->getRegisterCount()) + { + stringstream sstr; + sstr << "Register R" << regidx << " doesn't exist (out of bound)"; + throw runtime_error(sstr.str()); + } +} + +/* vim: set et sw=2 ts=2: */ 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: */ diff --git a/ue3/mycpu/cmem.h b/ue3/mycpu/cmem.h new file mode 100644 index 0000000..5045c34 --- /dev/null +++ b/ue3/mycpu/cmem.h @@ -0,0 +1,109 @@ +/** + * @module cmem + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief Memory template and memory definition for CCPU + * @date 10.05.2009 + */ + +#ifndef CMEM_H +#define CMEM_H 1 + +#include +#include +#include +#include +#include +#ifdef DEBUG +# include +# include +#endif +#include "cdat.h" + +/** + * @class CVectorMem + * + * Extends std::vector template for use as memory for CCPU. + */ +template > +class CVectorMem + : public std::vector +{ + public: + using std::vector::size; + using std::vector::at; + + /** + * @method initialize + * @brief initialize the vector with the content of istream. istream is + * read per line. empty lines will add unitialized elements. + * @param in inputstream to read from + * @return void + * @globalvars none + * @exception std::runtime_error + * @conditions none + */ + void initialize(std::istream& in) + { + if (!in.good()) + return; + + std::string line; + unsigned i = 0; + while (!in.eof() && in.good()) + { + ++i; + std::getline(in, line); + + /* skip last line if it's empty */ + if (line.empty() && in.eof()) + break; + + T value; + try + { + if (!line.empty()) + value = boost::lexical_cast(line); + } + catch(boost::bad_lexical_cast& ex) + { + std::stringstream sstr; + sstr << "Unable to convert input (line " << i << "): " << ex.what(); + throw std::runtime_error(sstr.str()); + } + + push_back(value); + } + } + +#if DEBUG + /** + * @method dump + * @brief dumps contents of vector to outputstream + * @param out outputstream to write to + * @return void + * @globalvars none + * @exception none + * @conditions none + */ + void dump(std::ostream& out) + { + out << "[MEMORY DUMP]" << std::endl; + for(unsigned i = 0; i < size(); ++i) + { + out << "[" << std::setw(4) << std::setfill('0') << i << "] " + << at(i) << std::endl; + } + } +#endif +}; + +/** + * @class CMem + * + * Memory definition for CCPU + */ +typedef CVectorMem CMem; + +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/cprogram.cpp b/ue3/mycpu/cprogram.cpp new file mode 100644 index 0000000..03d4c30 --- /dev/null +++ b/ue3/mycpu/cprogram.cpp @@ -0,0 +1,126 @@ +/** + * @module cprogram + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 12.05.2009 + */ + +#include +#include +#ifdef DEBUG +# include +# include +#endif +#include "cprogram.h" +#include "instructions.h" + +using namespace std; + +CProgram::CProgram() +{ + m_instrset.insert(new CInstructionInc); +} + +/*----------------------------------------------------------------------------*/ + +CProgram::~CProgram() +{ + /* free instruction set */ + set::iterator it; + for (it = m_instrset.begin(); it != m_instrset.end(); ++it) + delete *it; + + /* free instruction */ + for (iterator it = begin(); it != end(); ++it) + delete *it; +} + +/*----------------------------------------------------------------------------*/ + +void CProgram::compile(std::istream& in) +{ + if (!in.good()) + return; + + string line; + unsigned i = 0; + while (!in.eof() && in.good()) + { + ++i; + + /* read stream per line */ + getline(in, line); + if (line.empty()) + continue; + + boost::trim(line); + + /* ignore comments */ + if (line.find_first_of('#') == 0) + continue; + + /* get instruction name */ + size_t pos = line.find_first_of(' '); + string instrname = line.substr(0, pos); + + /* search and create instruction */ + CInstruction *instrptr = NULL; + set::iterator it; + for (it = m_instrset.begin(); it != m_instrset.end(); ++it) + { + if (*(*it) == instrname) + { + instrptr = *it; + break; + } + } + if (instrptr == NULL) + { + stringstream sstr; + sstr << "Unknown instruction '" << instrname << "' on line " << i << "."; + throw runtime_error(sstr.str()); + } + + /* create instruction */ + CInstruction *instr = instrptr->factory(); + + /* parse instruction parameters */ + string params = (pos == string::npos) ? "" : line.substr(pos + 1); + boost::trim(params); + list instrparams; + boost::split(instrparams, params, boost::is_any_of(", "), boost::token_compress_on); + + /* let instruction parse the parameters. catch+throw exception */ + try + { + instr->compile(instrparams); + } + catch(runtime_error& ex) + { + stringstream sstr; + sstr << "Unable to compile instruction '" << instrname + << "' (line " << i << "): " << ex.what(); + throw runtime_error(sstr.str()); + } + + push_back(instr); + } +} + +/*----------------------------------------------------------------------------*/ + +#if DEBUG +void CProgram::dump(std::ostream& out) +{ + out << "[PROGRAM DUMP]" << endl; + unsigned i = 0; + for(iterator it = begin(); it < end(); ++it) + { + out << "[" << std::setw(4) << std::setfill('0') << i << "] " + << *(*it) << endl; + ++i; + } +} +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/cprogram.h b/ue3/mycpu/cprogram.h new file mode 100644 index 0000000..bf161b8 --- /dev/null +++ b/ue3/mycpu/cprogram.h @@ -0,0 +1,78 @@ +/** + * @module cprogram + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#ifndef CPROGRAM_H +#define CPROGRAM_H 1 + +#include +#include +#include "cinstruction.h" + +/** + * @class CProgram + * + * TODO + */ +class CProgram + : public std::vector +{ + public: + /** + * @method CProgram + * @brief Default ctor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + CProgram(); + + /** + * @method ~CProgram + * @brief Default dtor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + ~CProgram(); + + /** + * @method compile + * @brief create instructions from parsing stream + * @param in inputstream to read from + * @return void + * @globalvars none + * @exception std::runtime_error + * @conditions none + */ + void compile(std::istream& in); + +#if DEBUG + /** + * @method dump + * @brief dumps contents to outputstream + * @param out outputstream to write to + * @return void + * @globalvars none + * @exception none + * @conditions none + */ + void dump(std::ostream& out); +#endif + + private: + /* members */ + /** set of known instructions */ + std::set m_instrset; +}; + +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/instructions.cpp b/ue3/mycpu/instructions.cpp new file mode 100644 index 0000000..c283e57 --- /dev/null +++ b/ue3/mycpu/instructions.cpp @@ -0,0 +1,27 @@ +/** + * @module instructions + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#include "instructions.h" + +using namespace std; + +void CInstructionInc::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + m_regidx1 = parseRegister(params.front()); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionInc::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + cpu->getRegisters()[m_regidx1]++; +} + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h new file mode 100644 index 0000000..ebd1533 --- /dev/null +++ b/ue3/mycpu/instructions.h @@ -0,0 +1,66 @@ +/** + * @module instructions + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#ifndef INSTRUCTIONS_H +#define INSTRUCTIONS_H 1 + +#include "cinstruction.h" +#include "ccpu.h" + +/** + * @class CInstructionInc + * + * TODO + */ +class CInstructionInc + : public CInstruction +{ + public: + /** + * @method CInstruction + * @brief Default ctor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + CInstructionInc() + : CInstruction("inc") + {}; + + /** + * @method ~CInstruction + * @brief Default dtor + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + ~CInstructionInc() + {}; + + /* TODO */ + CInstructionInc *factory() + { + return new CInstructionInc; + } + + /* TODO */ + void compile(std::list& params); + + /* TODO */ + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/mycpu.cpp b/ue3/mycpu/mycpu.cpp new file mode 100644 index 0000000..af91fe7 --- /dev/null +++ b/ue3/mycpu/mycpu.cpp @@ -0,0 +1,152 @@ +/** + * @module mycpu + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 11.05.2009 + * @par Exercise + * 3 + */ + +#include +#include +#include +#include +#include +#include "ccpu.h" +#include "cmem.h" +#include "cprogram.h" + +using namespace std; +namespace po = boost::program_options; + +/** TODO */ +void myterminate() +{ + cerr << "Unexpected termination" << endl; + abort(); +} + +/** + * @func main + * @brief program entry point + * @param argc standard parameter of main + * @param argv standard parameter of main + * @return 0 on success, not 0 otherwise + * @globalvars none + * @exception none + * @conditions none + * + * TODO + */ +int main(int argc, char* argv[]) +{ + //TODO set_terminate(myterminate); + string me(argv[0]); + + /* define commandline options */ + po::options_description desc("Allowed options"); + desc.add_options() + ("help,h", "this help message") + ("compile,c", po::value(), "input programfile") + ("memory,m", po::value(), "input memoryfile"); + + /* parse commandline options */ + po::variables_map vm; + try + { + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + } + catch(po::error& ex) + { + cerr << me << ": Error: " << ex.what() << endl; + } + + /* print usage upon request or missing params */ + if (vm.count("help") || !vm.count("compile")) + { + cout << "Usage: " << me << " -c [-m ]" << endl; + cout << desc << endl; + return 0; + } + + /* create memory and optionally initialize memory from file */ + CMem memory; + if (vm.count("memory")) + { + string memoryfile(vm["memory"].as()); + ifstream file(memoryfile.c_str(), ios::in); + if (!file.is_open()) + { + cerr << me << ": Unable to open memoryfile '" << memoryfile << "' for reading." << endl; + return 1; + } + + try + { + memory.initialize(file); + file.close(); + } + catch(runtime_error& ex) + { + file.close(); + cerr << me << ": Error while reading from memoryfile:" << endl + << " " << ex.what() << endl; + return 1; + } + +#if DEBUG + memory.dump(cout); +#endif + } + + /* create program instance */ + CProgram program; + string programfile(vm["compile"].as()); + ifstream file(programfile.c_str(), ios::in); + if (!file.is_open()) + { + cerr << me << ": Unable to open programfile '" << programfile << "' for reading." << endl; + return 1; + } + + try + { + program.compile(file); + file.close(); + } + catch(runtime_error& ex) + { + file.close(); + cerr << me << ": Error while compiling programfile:" << endl + << " " << ex.what() << endl; + return 1; + } + +#if DEBUG + program.dump(cout); +#endif + + + /* create cpu and execute the program */ + try + { + CCPU cpu(256); + cpu.setMemory(&memory); + cpu.setProgram(&program); + cpu.run(); +#if DEBUG + cpu.dumpRegisters(cout); +#endif + } + catch(runtime_error& ex) + { + cerr << me << ": Error while executing program:" << endl + << " " << ex.what() << endl; + return 1; + } + + return 0; +} + +/* vim: set et sw=2 ts=2: */ -- cgit v1.2.3 From 89e202f49b9857dcd3627fbc4e0262125d729bbc Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 04:09:39 +0200 Subject: adding all instructions and displays --- ue3/mycpu/Makefile | 2 +- ue3/mycpu/ccpu.cpp | 18 +- ue3/mycpu/ccpu.h | 84 +++++++++- ue3/mycpu/cdat.h | 4 +- ue3/mycpu/cdisplay.h | 41 ++++- ue3/mycpu/cinstruction.cpp | 4 +- ue3/mycpu/cinstruction.h | 133 +++++++++++++-- ue3/mycpu/cprogram.cpp | 14 ++ ue3/mycpu/displays.h | 56 +++++++ ue3/mycpu/instructions.cpp | 339 +++++++++++++++++++++++++++++++++++++- ue3/mycpu/instructions.h | 399 ++++++++++++++++++++++++++++++++++++++++++--- ue3/mycpu/mycpu.cpp | 16 +- ue3/mycpu/test/memory1 | 1 + ue3/mycpu/test/program1 | 13 ++ 14 files changed, 1051 insertions(+), 73 deletions(-) create mode 100644 ue3/mycpu/displays.h create mode 100644 ue3/mycpu/test/memory1 create mode 100644 ue3/mycpu/test/program1 diff --git a/ue3/mycpu/Makefile b/ue3/mycpu/Makefile index 16067d1..eec8b47 100644 --- a/ue3/mycpu/Makefile +++ b/ue3/mycpu/Makefile @@ -12,7 +12,7 @@ LIBS= -L/usr/local/lib -lboost_program_options BIN= mycpu OBJS= cinstruction.o instructions.o cprogram.o ccpu.o mycpu.o -HEADERS= cdat.h cmem.h cinstruction.h instructions.h cprogram.h cdisplay.h ccpu.h +HEADERS= cdat.h cmem.h cinstruction.h instructions.h cprogram.h cdisplay.h displays.h ccpu.h .SUFFIXES: .cpp .o diff --git a/ue3/mycpu/ccpu.cpp b/ue3/mycpu/ccpu.cpp index 6f364f8..b1539a4 100644 --- a/ue3/mycpu/ccpu.cpp +++ b/ue3/mycpu/ccpu.cpp @@ -10,23 +10,35 @@ # include #endif #include "ccpu.h" +#include "displays.h" using namespace std; CCPU::CCPU(const unsigned cnt) - : m_regcnt(cnt), m_memory(NULL), m_program(NULL), m_flagzero(0), m_flagsign(0) + : m_regcnt(cnt), m_memory(NULL), m_program(NULL), m_flagzero(false), m_flagsign(false) { + /* create registers */ m_registers = new CDat[cnt]; for(unsigned i = 0; i < cnt; ++i) m_registers[i] = 0; + + /* create displays */ + m_displays.insert(new CDisplayWDEZ); + m_displays.insert(new CDisplayWHEX); } /*----------------------------------------------------------------------------*/ CCPU::~CCPU() { + /* delete registers */ delete[] m_registers; m_registers = NULL; + + /* delete displays */ + std::set::iterator it; + for (it = m_displays.begin() ; it != m_displays.end(); ++it) + delete *it; } /*----------------------------------------------------------------------------*/ @@ -47,7 +59,7 @@ void CCPU::run() /* end of the program reached */ if (pc == m_program->size()) - return; + break; /* pc is out of bound */ if (pc > m_program->size()) @@ -57,8 +69,6 @@ void CCPU::run() m_program->at(pc)->execute(this); ++m_registers[0]; } - - cout << "LALA" << endl; } /*----------------------------------------------------------------------------*/ diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h index e28a7cc..1ef1923 100644 --- a/ue3/mycpu/ccpu.h +++ b/ue3/mycpu/ccpu.h @@ -8,11 +8,12 @@ #ifndef CCPU_H #define CCPU_H 1 -#include #include +#include #include "cdat.h" #include "cmem.h" #include "cprogram.h" +#include "cdisplay.h" /** * @class CCPU @@ -53,7 +54,7 @@ class CCPU * @exception none * @conditions none */ - const unsigned getRegisterCount() + const unsigned getRegisterCount() const { return m_regcnt; } @@ -67,7 +68,7 @@ class CCPU * @exception none * @conditions none */ - CDat *getRegisters() + CDat *getRegisters() const { return m_registers; } @@ -81,7 +82,7 @@ class CCPU * @exception none * @conditions none */ - void setMemory(const CMem *memory) + void setMemory(CMem *memory) { m_memory = memory; } @@ -95,7 +96,7 @@ class CCPU * @exception none * @conditions none */ - const CMem *getMemory() + CMem *getMemory() const { return m_memory; } @@ -128,6 +129,76 @@ class CCPU return m_program; } + /** + * @method getDisplays + * @brief get set of pointers to displays + * @param - + * @return reference to set of pointers to displays + * @globalvars none + * @exception none + * @conditions none + */ + const std::set& getDisplays() + { + return m_displays; + } + + /** + * @method setFlagZero + * @brief set zero flag + * @param value new value of zero flag + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + void setFlagZero(const bool value) + { + m_flagzero = value; + } + + /** + * @method getFlagZero + * @brief get value of zero flag + * @param - + * @return value of zero flag + * @globalvars none + * @exception none + * @conditions none + */ + const bool getFlagZero() + { + return m_flagzero; + } + + /** + * @method setFlagSign + * @brief set sign flag + * @param value new value of sign flag + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + void setFlagSign(const bool value) + { + m_flagsign = value; + } + + /** + * @method getFlagSign + * @brief get value of sign flag + * @param - + * @return value of sign flag + * @globalvars none + * @exception none + * @conditions none + */ + const bool getFlagSign() + { + return m_flagsign; + } + /** * @method run * @brief execute current program @@ -156,8 +227,9 @@ class CCPU /* members */ CDat *m_registers; unsigned m_regcnt; - const CMem *m_memory; + CMem *m_memory; const CProgram *m_program; + std::set m_displays; bool m_flagzero; bool m_flagsign; }; diff --git a/ue3/mycpu/cdat.h b/ue3/mycpu/cdat.h index 365bd88..c656b99 100644 --- a/ue3/mycpu/cdat.h +++ b/ue3/mycpu/cdat.h @@ -72,7 +72,7 @@ class CDatT {} /** - * @method value + * @method getValue * @brief returns value of CDatT * @param - * @return value of CDatT @@ -80,7 +80,7 @@ class CDatT * @exception none * @conditions none */ - T value() const + T getValue() const { return m_value; } diff --git a/ue3/mycpu/cdisplay.h b/ue3/mycpu/cdisplay.h index 629ec88..ed9b84d 100644 --- a/ue3/mycpu/cdisplay.h +++ b/ue3/mycpu/cdisplay.h @@ -6,7 +6,7 @@ */ #ifndef CDISPLAY_H -#define CDISPLAY_H #1 +#define CDISPLAY_H 1 /** * @class CDisplay @@ -19,14 +19,16 @@ class CDisplay /** * @method CDisplay * @brief Default ctor - * @param - + * @param name name of display * @return - * @globalvars none * @exception none * @conditions none */ - CDisplay() - {}; + CDisplay(std::string name) + { + m_name = name; + } /** * @method ~CDisplay @@ -37,10 +39,37 @@ class CDisplay * @exception none * @conditions none */ - ~CDisplay(); + virtual ~CDisplay() + {} + + /** + * @method getName + * @brief returns name of display + * @param - + * @return name of display + * @globalvars none + * @exception none + * @conditions none + */ + virtual const std::string& getName() + { + return m_name; + } + + /** + * @method getName + * @brief prints value to display + * @param value value to display + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + virtual void display(const CDat &value) = 0; - private: + protected: /* members */ + std::string m_name; }; #endif diff --git a/ue3/mycpu/cinstruction.cpp b/ue3/mycpu/cinstruction.cpp index 32bdd2f..57acd5f 100644 --- a/ue3/mycpu/cinstruction.cpp +++ b/ue3/mycpu/cinstruction.cpp @@ -16,7 +16,7 @@ using namespace std; const unsigned CInstruction::parseRegister(const std::string& str) { unsigned reg; - if (str.length() < 2 || str[0] != 'R') + if (str.length() < 2 || str[0] != 'r') throw runtime_error("Invalid syntax of register"); try @@ -33,7 +33,7 @@ const unsigned CInstruction::parseRegister(const std::string& str) /*----------------------------------------------------------------------------*/ -inline void CInstruction::checkRegister(CCPU *cpu, unsigned regidx) +inline void CInstruction::checkRegister(CCPU *cpu, const unsigned regidx) { if (regidx >= cpu->getRegisterCount()) { diff --git a/ue3/mycpu/cinstruction.h b/ue3/mycpu/cinstruction.h index b16c067..57fcff1 100644 --- a/ue3/mycpu/cinstruction.h +++ b/ue3/mycpu/cinstruction.h @@ -10,9 +10,8 @@ #include #include -//#include "ccpu.h" -/* declare CCPU */ +/* forward declare CCPU */ class CCPU; /** @@ -26,7 +25,7 @@ class CInstruction /** * @method CInstruction * @brief Default ctor - * @param - + * @param name name of instruction * @return - * @globalvars none * @exception none @@ -34,7 +33,7 @@ class CInstruction */ CInstruction(std::string name) : m_name(name) - {}; + {} /** * @method ~CInstruction @@ -46,46 +45,150 @@ class CInstruction * @conditions none */ virtual ~CInstruction() - {}; + {} - /* TODO */ + /** + * @method operator== + * @brief implementation of operator == + * @param reference to std::string + * @return true if instructionname is name + * @globalvars none + * @exception none + * @conditions none + */ virtual bool operator==(std::string& name) { return name == m_name; } - /* TODO */ + /** + * @method getName + * @brief returns instruction name + * @param - + * @return name of instruction + * @globalvars none + * @exception none + * @conditions none + */ virtual const std::string& getName() { return m_name; } - /* TODO */ + /** + * @method isLabel + * @brief returns true if the instruction defines a label + * @param - + * @return true if the instruction defines a label + * @globalvars none + * @exception none + * @conditions none + */ + virtual const bool isLabel() + { + return false; + } + + /** + * @method getLabelName + * @brief returns labelname if the instruction defines a label + * @param - + * @return labelname if the instruction defines a label + * @globalvars none + * @exception none + * @conditions none + */ + virtual const std::string getLabelName() + { + return ""; + } + + /** + * @method dump + * @brief dumps information about instruction to outputstream + * @param stream outputstream + * @return reference to outputstream + * @globalvars none + * @exception none + * @conditions none + */ virtual std::ostream& dump(std::ostream& stream) { stream << m_name; return stream; } - /* TODO */ + /** + * @method operator<< + * @brief Shift/output operator for outputstream + * @param stream reference to outputstream + * @param cdat object which will be printed to stream + * @return reference to outputstream + * @globalvars none + * @exception none + * @conditions none + */ friend std::ostream& operator<<(std::ostream& stream, CInstruction& instr) { return instr.dump(stream); } - /* TODO */ + /** + * @method parseRegister + * @brief parses register syntax Rx (e.g. "R1") + * @param str register in assembler syntax + * @return registernumber + * @globalvars none + * @exception runtime_error + * @conditions none + */ virtual const unsigned parseRegister(const std::string& str); - /* TODO */ - virtual void checkRegister(CCPU *cpu, unsigned regidx); + /** + * @method checkRegister + * @brief performs a register boundary check + * does the register exist in cpu? + * @param cpu pointer to cpu + * @param regidx registernumber + * @return - + * @globalvars none + * @exception runtime_error + * @conditions none + */ + virtual void checkRegister(CCPU *cpu, const unsigned regidx); - /* TODO */ + /** + * @method factory + * @brief creates a new instance of this instruction + * @param - + * @return new instruction instance + * @globalvars none + * @exception none + * @conditions none + */ virtual CInstruction *factory() = 0; - /* TODO */ + /** + * @method compile + * @brief parses instruction parameters and prepares the + * instruction for executing + * @param params list of parameters of this instruction + * @return - + * @globalvars none + * @exception runtime_error + * @conditions none + */ virtual void compile(std::list& params) = 0; - /* TODO */ + /** + * @method execute + * @brief executes the instruction + * @param cpu pointer to cpu + * @return - + * @globalvars none + * @exception runtime_error + * @conditions none + */ virtual void execute(CCPU *cpu) = 0; protected: diff --git a/ue3/mycpu/cprogram.cpp b/ue3/mycpu/cprogram.cpp index 03d4c30..f6fc3cb 100644 --- a/ue3/mycpu/cprogram.cpp +++ b/ue3/mycpu/cprogram.cpp @@ -19,6 +19,19 @@ using namespace std; CProgram::CProgram() { m_instrset.insert(new CInstructionInc); + m_instrset.insert(new CInstructionDec); + m_instrset.insert(new CInstructionAdd); + m_instrset.insert(new CInstructionSub); + m_instrset.insert(new CInstructionMul); + m_instrset.insert(new CInstructionDiv); + m_instrset.insert(new CInstructionLoad); + m_instrset.insert(new CInstructionStore); + m_instrset.insert(new CInstructionTest); + m_instrset.insert(new CInstructionLabel); + m_instrset.insert(new CInstructionJumpA); + m_instrset.insert(new CInstructionJumpZ); + m_instrset.insert(new CInstructionJumpS); + m_instrset.insert(new CInstructionWrite); } /*----------------------------------------------------------------------------*/ @@ -54,6 +67,7 @@ void CProgram::compile(std::istream& in) continue; boost::trim(line); + boost::to_lower(line); /* ignore comments */ if (line.find_first_of('#') == 0) diff --git a/ue3/mycpu/displays.h b/ue3/mycpu/displays.h new file mode 100644 index 0000000..f7adbdb --- /dev/null +++ b/ue3/mycpu/displays.h @@ -0,0 +1,56 @@ +/** + * @module displays + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief TODO + * @date 10.05.2009 + */ + +#ifndef DISPLAYS_H +#define DISPLAYS_H 1 + +#include +#include "cdisplay.h" + +/** + * @class CDisplayWDEZ + * + * TODO + */ +class CDisplayWDEZ + : public CDisplay +{ + public: + CDisplayWDEZ() + : CDisplay("wdez") + {} + + void display(const CDat &value) + { + std::cout << std::dec << value << std::endl; + } +}; + +/*============================================================================*/ + +/** + * @class CDisplayWHEX + * + * TODO + */ +class CDisplayWHEX + : public CDisplay +{ + public: + CDisplayWHEX() + : CDisplay("whex") + {} + + void display(const CDat &value) + { + std::cout << std::hex << value << std::endl; + } +}; + +#endif + +/* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/instructions.cpp b/ue3/mycpu/instructions.cpp index c283e57..609cd1c 100644 --- a/ue3/mycpu/instructions.cpp +++ b/ue3/mycpu/instructions.cpp @@ -14,6 +14,7 @@ void CInstructionInc::compile(std::list& params) if (params.size() != 1) throw runtime_error("Invalid paramater count - must be 1"); m_regidx1 = parseRegister(params.front()); + params.pop_front(); } /*----------------------------------------------------------------------------*/ @@ -21,7 +22,343 @@ void CInstructionInc::compile(std::list& params) void CInstructionInc::execute(CCPU *cpu) { checkRegister(cpu, m_regidx1); - cpu->getRegisters()[m_regidx1]++; + cpu->getRegisters()[ m_regidx1 ]++; } +/*============================================================================*/ + +void CInstructionDec::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionDec::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + cpu->getRegisters()[ m_regidx1 ]--; +} + +/*============================================================================*/ + +void CInstructionAdd::compile(std::list& params) +{ + if (params.size() != 3) + throw runtime_error("Invalid paramater count - must be 3"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); + m_regidx2 = parseRegister(params.front()); + params.pop_front(); + m_regidx3 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionAdd::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + checkRegister(cpu, m_regidx2); + checkRegister(cpu, m_regidx3); + cpu->getRegisters()[ m_regidx1 ] = cpu->getRegisters()[ m_regidx2 ] + + cpu->getRegisters()[ m_regidx3 ]; +} + +/*============================================================================*/ + +void CInstructionSub::compile(std::list& params) +{ + if (params.size() != 3) + throw runtime_error("Invalid paramater count - must be 3"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); + m_regidx2 = parseRegister(params.front()); + params.pop_front(); + m_regidx3 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionSub::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + checkRegister(cpu, m_regidx2); + checkRegister(cpu, m_regidx3); + cpu->getRegisters()[ m_regidx1 ] = cpu->getRegisters()[ m_regidx2 ] + - cpu->getRegisters()[ m_regidx3 ]; +} + +/*============================================================================*/ + +void CInstructionMul::compile(std::list& params) +{ + if (params.size() != 3) + throw runtime_error("Invalid paramater count - must be 3"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); + m_regidx2 = parseRegister(params.front()); + params.pop_front(); + m_regidx3 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionMul::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + checkRegister(cpu, m_regidx2); + checkRegister(cpu, m_regidx3); + cpu->getRegisters()[ m_regidx1 ] = cpu->getRegisters()[ m_regidx2 ] + * cpu->getRegisters()[ m_regidx3 ]; +} + +/*============================================================================*/ + +void CInstructionDiv::compile(std::list& params) +{ + if (params.size() != 3) + throw runtime_error("Invalid paramater count - must be 3"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); + m_regidx2 = parseRegister(params.front()); + params.pop_front(); + m_regidx3 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionDiv::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + checkRegister(cpu, m_regidx2); + checkRegister(cpu, m_regidx3); + cpu->getRegisters()[ m_regidx1 ] = cpu->getRegisters()[ m_regidx2 ] + / cpu->getRegisters()[ m_regidx3 ]; +} + +/*============================================================================*/ + +void CInstructionLoad::compile(std::list& params) +{ + if (params.size() != 2) + throw runtime_error("Invalid paramater count - must be 2"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); + m_regidx2 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionLoad::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + checkRegister(cpu, m_regidx2); + CDat val = cpu->getRegisters()[ m_regidx2 ]; + cpu->getRegisters()[ m_regidx1 ] = (*cpu->getMemory())[ val ]; +} + +/*============================================================================*/ + +void CInstructionStore::compile(std::list& params) +{ + if (params.size() != 2) + throw runtime_error("Invalid paramater count - must be 2"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); + m_regidx2 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionStore::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + checkRegister(cpu, m_regidx2); + CDat val = cpu->getRegisters()[ m_regidx2 ]; + (*cpu->getMemory())[ val ] = cpu->getRegisters()[ m_regidx1 ]; +} + +/*============================================================================*/ + +void CInstructionTest::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionTest::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + if (cpu->getRegisters()[ m_regidx1 ] == CDat(0)) + cpu->setFlagZero(true); + if (cpu->getRegisters()[ m_regidx1 ] < CDat(0)) + cpu->setFlagSign(true); +} + +/*============================================================================*/ + +void CInstructionLabel::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + string label = params.front(); + params.pop_front(); + if (label.length() < 2 || label[ label.length() - 1] != ':') + throw runtime_error("Label has invalid syntax"); + m_label = label.substr(0, label.length() - 1); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionLabel::execute(CCPU *cpu) +{ + if (m_label.empty()) + throw runtime_error("Empty label"); +} + +/*============================================================================*/ + +void CInstructionJumpA::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + m_addr = params.front(); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionJumpA::execute(CCPU *cpu) +{ + if (m_addr.empty()) + throw runtime_error("Empty address"); + + const CProgram *progam = cpu->getProgram(); + for(unsigned i = 0; i < progam->size(); i++) + { + if (progam->at(i)->isLabel() && progam->at(i)->getLabelName() == m_addr) + { + cpu->getRegisters()[ 0 ] = i; + return; + } + } + + throw runtime_error("Unknown label '" + m_addr + "'"); +} + +/*============================================================================*/ + +void CInstructionJumpZ::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + m_addr = params.front(); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionJumpZ::execute(CCPU *cpu) +{ + if (!cpu->getFlagZero()) + return; + if (m_addr.empty()) + throw runtime_error("Empty address"); + + const CProgram *progam = cpu->getProgram(); + for(unsigned i = 0; i < progam->size(); i++) + { + if (progam->at(i)->isLabel() && progam->at(i)->getLabelName() == m_addr) + { + cpu->getRegisters()[ 0 ] = i; + return; + } + } + + throw runtime_error("Unknown label '" + m_addr + "'"); +} + +/*============================================================================*/ + +void CInstructionJumpS::compile(std::list& params) +{ + if (params.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + m_addr = params.front(); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionJumpS::execute(CCPU *cpu) +{ + if (!cpu->getFlagSign()) + return; + if (m_addr.empty()) + throw runtime_error("Empty address"); + + const CProgram *progam = cpu->getProgram(); + for(unsigned i = 0; i < progam->size(); i++) + { + if (progam->at(i)->isLabel() && progam->at(i)->getLabelName() == m_addr) + { + cpu->getRegisters()[ 0 ] = i; + return; + } + } + + throw runtime_error("Unknown label '" + m_addr + "'"); +} + +/*============================================================================*/ + +void CInstructionWrite::compile(std::list& params) +{ + if (params.size() != 2) + throw runtime_error("Invalid paramater count - must be 2"); + m_dev = params.front(); + params.pop_front(); + m_regidx1 = parseRegister(params.front()); + params.pop_front(); +} + +/*----------------------------------------------------------------------------*/ + +void CInstructionWrite::execute(CCPU *cpu) +{ + checkRegister(cpu, m_regidx1); + if (m_dev.empty()) + throw runtime_error("Empty device"); + + CDisplay *display = NULL; + std::set displays = cpu->getDisplays(); + std::set::iterator it; + for(it = displays.begin(); it != displays.end(); ++it) + { + if ((*it)->getName() == m_dev) + { + display = *it; + break; + } + } + if (display == NULL) + throw runtime_error("Unknown display"); + + display->display(cpu->getRegisters()[ m_regidx1 ]); +} + + /* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h index ebd1533..8c62e0b 100644 --- a/ue3/mycpu/instructions.h +++ b/ue3/mycpu/instructions.h @@ -20,45 +20,392 @@ class CInstructionInc : public CInstruction { public: - /** - * @method CInstruction - * @brief Default ctor - * @param - - * @return - - * @globalvars none - * @exception none - * @conditions none - */ CInstructionInc() : CInstruction("inc") - {}; - - /** - * @method ~CInstruction - * @brief Default dtor - * @param - - * @return - - * @globalvars none - * @exception none - * @conditions none - */ - ~CInstructionInc() - {}; - - /* TODO */ + {} + CInstructionInc *factory() { return new CInstructionInc; } - /* TODO */ void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +/*============================================================================*/ + +/** + * @class CInstructionDec + * + * TODO + */ +class CInstructionDec + : public CInstruction +{ + public: + CInstructionDec() + : CInstruction("dec") + {} + + CInstructionDec *factory() + { + return new CInstructionDec; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +/*============================================================================*/ + +/** + * @class CInstructionAdd + * + * TODO + */ +class CInstructionAdd + : public CInstruction +{ + public: + CInstructionAdd() + : CInstruction("add") + {} + + CInstructionAdd *factory() + { + return new CInstructionAdd; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; + +/*============================================================================*/ + +/** + * @class CInstructionSub + * + * TODO + */ +class CInstructionSub + : public CInstruction +{ + public: + CInstructionSub() + : CInstruction("sub") + {} + + CInstructionSub *factory() + { + return new CInstructionSub; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; - /* TODO */ +/*============================================================================*/ + +/** + * @class CInstructionMul + * + * TODO + */ +class CInstructionMul + : public CInstruction +{ + public: + CInstructionMul() + : CInstruction("mul") + {} + + CInstructionMul *factory() + { + return new CInstructionMul; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; + +/*============================================================================*/ + +/** + * @class CInstructionDiv + * + * TODO + */ +class CInstructionDiv + : public CInstruction +{ + public: + CInstructionDiv() + : CInstruction("div") + {} + + CInstructionDiv *factory() + { + return new CInstructionDiv; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; + unsigned m_regidx3; +}; + +/*============================================================================*/ + +/** + * @class CInstructionLoad + * + * TODO + */ +class CInstructionLoad + : public CInstruction +{ + public: + CInstructionLoad() + : CInstruction("load") + {} + + CInstructionLoad *factory() + { + return new CInstructionLoad; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; +}; + +/*============================================================================*/ + +/** + * @class CInstructionStore + * + * TODO + */ +class CInstructionStore + : public CInstruction +{ + public: + CInstructionStore() + : CInstruction("store") + {} + + CInstructionStore *factory() + { + return new CInstructionStore; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; + unsigned m_regidx2; +}; + +/*============================================================================*/ + +/** + * @class CInstructionTest + * + * TODO + */ +class CInstructionTest + : public CInstruction +{ + public: + CInstructionTest() + : CInstruction("test") + {} + + CInstructionTest *factory() + { + return new CInstructionTest; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + unsigned m_regidx1; +}; + +/*============================================================================*/ + +/** + * @class CInstructionLabel + * + * TODO + */ +class CInstructionLabel + : public CInstruction +{ + public: + CInstructionLabel() + : CInstruction("label"), m_label("") + {} + + const bool isLabel() + { + return true; + } + + const std::string getLabelName() + { + return m_label; + } + + CInstructionLabel *factory() + { + return new CInstructionLabel; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_label; +}; + +/*============================================================================*/ + +/** + * @class CInstructionJumpA + * + * TODO + */ +class CInstructionJumpA + : public CInstruction +{ + public: + CInstructionJumpA() + : CInstruction("jumpa"), m_addr("") + {} + + CInstructionJumpA *factory() + { + return new CInstructionJumpA; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_addr; +}; + +/*============================================================================*/ + +/** + * @class CInstructionJumpZ + * + * TODO + */ +class CInstructionJumpZ + : public CInstruction +{ + public: + CInstructionJumpZ() + : CInstruction("jumpz"), m_addr("") + {} + + CInstructionJumpZ *factory() + { + return new CInstructionJumpZ; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_addr; +}; + +/*============================================================================*/ + +/** + * @class CInstructionJumpS + * + * TODO + */ +class CInstructionJumpS + : public CInstruction +{ + public: + CInstructionJumpS() + : CInstruction("jumps"), m_addr("") + {} + + CInstructionJumpS *factory() + { + return new CInstructionJumpS; + } + + void compile(std::list& params); + void execute(CCPU *cpu); + + protected: + std::string m_addr; +}; + +/*============================================================================*/ + +/** + * @class CInstructionWrite + * + * TODO + */ +class CInstructionWrite + : public CInstruction +{ + public: + CInstructionWrite() + : CInstruction("write"), m_dev("") + {} + + CInstructionWrite *factory() + { + return new CInstructionWrite; + } + + void compile(std::list& params); void execute(CCPU *cpu); protected: unsigned m_regidx1; + std::string m_dev; }; #endif diff --git a/ue3/mycpu/mycpu.cpp b/ue3/mycpu/mycpu.cpp index af91fe7..08861a4 100644 --- a/ue3/mycpu/mycpu.cpp +++ b/ue3/mycpu/mycpu.cpp @@ -19,13 +19,6 @@ using namespace std; namespace po = boost::program_options; -/** TODO */ -void myterminate() -{ - cerr << "Unexpected termination" << endl; - abort(); -} - /** * @func main * @brief program entry point @@ -40,7 +33,6 @@ void myterminate() */ int main(int argc, char* argv[]) { - //TODO set_terminate(myterminate); string me(argv[0]); /* define commandline options */ @@ -136,13 +128,17 @@ int main(int argc, char* argv[]) cpu.setProgram(&program); cpu.run(); #if DEBUG - cpu.dumpRegisters(cout); + //cpu.dumpRegisters(cout); #endif } catch(runtime_error& ex) { cerr << me << ": Error while executing program:" << endl - << " " << ex.what() << endl; + << " " << ex.what() << endl; +#if DEBUG + memory.dump(cout); + //cpu.dumpRegisters(cout); +#endif return 1; } diff --git a/ue3/mycpu/test/memory1 b/ue3/mycpu/test/memory1 new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/ue3/mycpu/test/memory1 @@ -0,0 +1 @@ +20 diff --git a/ue3/mycpu/test/program1 b/ue3/mycpu/test/program1 new file mode 100644 index 0000000..ae5e9d2 --- /dev/null +++ b/ue3/mycpu/test/program1 @@ -0,0 +1,13 @@ +# set R2 = 10 +LOAD R2, R1 + +# start of loop +label Loop: +inc R3 +sub R4, R3, R2 +test R4 +jumpz EndLoop +write WDEZ, R3 +jumpa Loop + +label EndLoop: -- cgit v1.2.3 From 431bbac5a99abbccf33500e22aa353ec792eff94 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 15:29:51 +0200 Subject: * adding -Wno-long-long to all Makefiles * adding execute operator to cinstruction * added labels map for better performance --- ue1/imgsynth/Makefile | 2 +- ue2/imgsynth2/Makefile | 2 +- ue3/mycpu/ccpu.cpp | 2 +- ue3/mycpu/ccpu.h | 2 +- ue3/mycpu/cinstruction.h | 47 ++++++++++++--------------------- ue3/mycpu/cprogram.cpp | 21 +++++++++++++++ ue3/mycpu/cprogram.h | 27 +++++++++++++++++++ ue3/mycpu/instructions.cpp | 65 +++------------------------------------------- ue3/mycpu/instructions.h | 20 ++++---------- 9 files changed, 78 insertions(+), 110 deletions(-) diff --git a/ue1/imgsynth/Makefile b/ue1/imgsynth/Makefile index 6b52d60..71f57d7 100644 --- a/ue1/imgsynth/Makefile +++ b/ue1/imgsynth/Makefile @@ -5,7 +5,7 @@ CC= g++ LD= $(CC) DEBUGFLAGS= -CFLAGS= -O -ansi -pedantic-errors -Wall $(DEBUGFLAGS) +CFLAGS= -O -ansi -pedantic-errors -Wall -Wno-long-long $(DEBUGFLAGS) LDFLAGS= LIBS= -lboost_program_options diff --git a/ue2/imgsynth2/Makefile b/ue2/imgsynth2/Makefile index 481230c..932ae97 100644 --- a/ue2/imgsynth2/Makefile +++ b/ue2/imgsynth2/Makefile @@ -6,7 +6,7 @@ CXX= g++ LD= $(CXX) DEBUGFLAGS= -DNDEBUG INCLUDE_PATH= -I/usr/local/include -CXXFLAGS= -O -ansi -pedantic-errors -Wall $(INCLUDE_PATH) $(DEBUGFLAGS) +CXXFLAGS= -O -ansi -pedantic-errors -Wall -Wno-long-long $(INCLUDE_PATH) $(DEBUGFLAGS) LDFLAGS= LIBS= -L/usr/local/lib -lboost_program_options diff --git a/ue3/mycpu/ccpu.cpp b/ue3/mycpu/ccpu.cpp index b1539a4..16209e2 100644 --- a/ue3/mycpu/ccpu.cpp +++ b/ue3/mycpu/ccpu.cpp @@ -66,7 +66,7 @@ void CCPU::run() throw runtime_error("Programcounter is out of bound"); /* execute instruction */ - m_program->at(pc)->execute(this); + (*m_program->at(pc))(this); ++m_registers[0]; } } diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h index 1ef1923..01c897f 100644 --- a/ue3/mycpu/ccpu.h +++ b/ue3/mycpu/ccpu.h @@ -205,7 +205,7 @@ class CCPU * @param - * @return - * @globalvars none - * @exception runtime_error + * @exception std::runtime_error * @conditions none */ void run(); diff --git a/ue3/mycpu/cinstruction.h b/ue3/mycpu/cinstruction.h index 57fcff1..40e9ddc 100644 --- a/ue3/mycpu/cinstruction.h +++ b/ue3/mycpu/cinstruction.h @@ -62,45 +62,32 @@ class CInstruction } /** - * @method getName - * @brief returns instruction name - * @param - - * @return name of instruction - * @globalvars none - * @exception none - * @conditions none - */ - virtual const std::string& getName() - { - return m_name; - } - - /** - * @method isLabel - * @brief returns true if the instruction defines a label - * @param - - * @return true if the instruction defines a label + * @method operator() + * @brief implementation of operator (CCPU) + * @param cpu pointer to cpu + * @return - * @globalvars none - * @exception none + * @exception std::runtime_error * @conditions none */ - virtual const bool isLabel() + virtual CInstruction& operator()(CCPU *cpu) { - return false; + execute(cpu); + return *this; } /** - * @method getLabelName - * @brief returns labelname if the instruction defines a label + * @method getName + * @brief returns instruction name * @param - - * @return labelname if the instruction defines a label + * @return name of instruction * @globalvars none * @exception none * @conditions none */ - virtual const std::string getLabelName() + virtual const std::string& getName() { - return ""; + return m_name; } /** @@ -139,7 +126,7 @@ class CInstruction * @param str register in assembler syntax * @return registernumber * @globalvars none - * @exception runtime_error + * @exception std::runtime_error * @conditions none */ virtual const unsigned parseRegister(const std::string& str); @@ -152,7 +139,7 @@ class CInstruction * @param regidx registernumber * @return - * @globalvars none - * @exception runtime_error + * @exception std::runtime_error * @conditions none */ virtual void checkRegister(CCPU *cpu, const unsigned regidx); @@ -175,7 +162,7 @@ class CInstruction * @param params list of parameters of this instruction * @return - * @globalvars none - * @exception runtime_error + * @exception std::runtime_error * @conditions none */ virtual void compile(std::list& params) = 0; @@ -186,7 +173,7 @@ class CInstruction * @param cpu pointer to cpu * @return - * @globalvars none - * @exception runtime_error + * @exception std::runtime_error * @conditions none */ virtual void execute(CCPU *cpu) = 0; diff --git a/ue3/mycpu/cprogram.cpp b/ue3/mycpu/cprogram.cpp index f6fc3cb..f904bce 100644 --- a/ue3/mycpu/cprogram.cpp +++ b/ue3/mycpu/cprogram.cpp @@ -107,6 +107,16 @@ void CProgram::compile(std::istream& in) /* let instruction parse the parameters. catch+throw exception */ try { + /* handle label instruction ourself, but still add a dummy instruction */ + if (instrname == "label") + { + if (instrparams.size() != 1) + throw runtime_error("Invalid paramater count - must be 1"); + string label = instrparams.front(); + if (label.length() < 2 || label[ label.length() - 1] != ':') + throw runtime_error("Label has invalid syntax"); + m_labels[ label.substr(0, label.length() - 1) ] = size(); + } instr->compile(instrparams); } catch(runtime_error& ex) @@ -123,6 +133,17 @@ void CProgram::compile(std::istream& in) /*----------------------------------------------------------------------------*/ +unsigned CProgram::findLabel(const std::string& label) const +{ + map::const_iterator it; + it = m_labels.find(label); + if (it == m_labels.end()) + throw runtime_error("Unknown label '" + label + "'"); + return it->second; +} + +/*----------------------------------------------------------------------------*/ + #if DEBUG void CProgram::dump(std::ostream& out) { diff --git a/ue3/mycpu/cprogram.h b/ue3/mycpu/cprogram.h index bf161b8..c145832 100644 --- a/ue3/mycpu/cprogram.h +++ b/ue3/mycpu/cprogram.h @@ -10,6 +10,7 @@ #include #include +#include #include "cinstruction.h" /** @@ -43,6 +44,31 @@ class CProgram */ ~CProgram(); + /** + * @method getLabels + * @brief get reference to labels map + * @param - + * @return reference to labels map + * @globalvars none + * @exception none + * @conditions none + */ + const std::map& getLabels() const + { + return m_labels; + } + + /** + * @method findLabel + * @brief search for label + * @param label name of label to search for + * @return index of found label in program + * @globalvars none + * @exception std::runtime_error + * @conditions none + */ + unsigned findLabel(const std::string& label) const; + /** * @method compile * @brief create instructions from parsing stream @@ -71,6 +97,7 @@ class CProgram /* members */ /** set of known instructions */ std::set m_instrset; + std::map m_labels; }; #endif diff --git a/ue3/mycpu/instructions.cpp b/ue3/mycpu/instructions.cpp index 609cd1c..a6ac611 100644 --- a/ue3/mycpu/instructions.cpp +++ b/ue3/mycpu/instructions.cpp @@ -5,6 +5,7 @@ * @date 10.05.2009 */ +#include #include "instructions.h" using namespace std; @@ -210,27 +211,6 @@ void CInstructionTest::execute(CCPU *cpu) /*============================================================================*/ -void CInstructionLabel::compile(std::list& params) -{ - if (params.size() != 1) - throw runtime_error("Invalid paramater count - must be 1"); - string label = params.front(); - params.pop_front(); - if (label.length() < 2 || label[ label.length() - 1] != ':') - throw runtime_error("Label has invalid syntax"); - m_label = label.substr(0, label.length() - 1); -} - -/*----------------------------------------------------------------------------*/ - -void CInstructionLabel::execute(CCPU *cpu) -{ - if (m_label.empty()) - throw runtime_error("Empty label"); -} - -/*============================================================================*/ - void CInstructionJumpA::compile(std::list& params) { if (params.size() != 1) @@ -245,18 +225,7 @@ void CInstructionJumpA::execute(CCPU *cpu) { if (m_addr.empty()) throw runtime_error("Empty address"); - - const CProgram *progam = cpu->getProgram(); - for(unsigned i = 0; i < progam->size(); i++) - { - if (progam->at(i)->isLabel() && progam->at(i)->getLabelName() == m_addr) - { - cpu->getRegisters()[ 0 ] = i; - return; - } - } - - throw runtime_error("Unknown label '" + m_addr + "'"); + cpu->getRegisters()[ 0 ] = cpu->getProgram()->findLabel(m_addr); } /*============================================================================*/ @@ -275,20 +244,7 @@ void CInstructionJumpZ::execute(CCPU *cpu) { if (!cpu->getFlagZero()) return; - if (m_addr.empty()) - throw runtime_error("Empty address"); - - const CProgram *progam = cpu->getProgram(); - for(unsigned i = 0; i < progam->size(); i++) - { - if (progam->at(i)->isLabel() && progam->at(i)->getLabelName() == m_addr) - { - cpu->getRegisters()[ 0 ] = i; - return; - } - } - - throw runtime_error("Unknown label '" + m_addr + "'"); + cpu->getRegisters()[ 0 ] = cpu->getProgram()->findLabel(m_addr); } /*============================================================================*/ @@ -307,20 +263,7 @@ void CInstructionJumpS::execute(CCPU *cpu) { if (!cpu->getFlagSign()) return; - if (m_addr.empty()) - throw runtime_error("Empty address"); - - const CProgram *progam = cpu->getProgram(); - for(unsigned i = 0; i < progam->size(); i++) - { - if (progam->at(i)->isLabel() && progam->at(i)->getLabelName() == m_addr) - { - cpu->getRegisters()[ 0 ] = i; - return; - } - } - - throw runtime_error("Unknown label '" + m_addr + "'"); + cpu->getRegisters()[ 0 ] = cpu->getProgram()->findLabel(m_addr); } /*============================================================================*/ diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h index 8c62e0b..0e4d99c 100644 --- a/ue3/mycpu/instructions.h +++ b/ue3/mycpu/instructions.h @@ -274,29 +274,19 @@ class CInstructionLabel { public: CInstructionLabel() - : CInstruction("label"), m_label("") + : CInstruction("label") {} - const bool isLabel() - { - return true; - } - - const std::string getLabelName() - { - return m_label; - } - CInstructionLabel *factory() { return new CInstructionLabel; } - void compile(std::list& params); - void execute(CCPU *cpu); + void compile(std::list& params) + {} - protected: - std::string m_label; + void execute(CCPU *cpu) + {} }; /*============================================================================*/ -- cgit v1.2.3 From 3c6f886d5a8bfd36c796b963d6e3178ad9577742 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 16:55:17 +0200 Subject: * added documentation (no more TODOs) * added testsuite + testcase * used copyctor instead of assign operator more often --- .hgignore | 1 + ue3/mycpu/ccpu.cpp | 3 ++- ue3/mycpu/ccpu.h | 6 +++-- ue3/mycpu/cdisplay.h | 9 ++++--- ue3/mycpu/cinstruction.cpp | 4 ++-- ue3/mycpu/cinstruction.h | 6 ++--- ue3/mycpu/cprogram.cpp | 6 ++--- ue3/mycpu/cprogram.h | 5 ++-- ue3/mycpu/displays.h | 8 ++++--- ue3/mycpu/instructions.cpp | 6 ++--- ue3/mycpu/instructions.h | 57 ++++++++++++++++++++++++++++++++------------ ue3/mycpu/mycpu.cpp | 25 ++++++++++++------- ue3/mycpu/test/test.sh | 40 +++++++++++++++++++++++++++++++ ue3/mycpu/test/test1_memory | 1 + ue3/mycpu/test/test1_output | 19 +++++++++++++++ ue3/mycpu/test/test1_program | 13 ++++++++++ 16 files changed, 161 insertions(+), 48 deletions(-) create mode 100755 ue3/mycpu/test/test.sh create mode 100644 ue3/mycpu/test/test1_memory create mode 100644 ue3/mycpu/test/test1_output create mode 100644 ue3/mycpu/test/test1_program diff --git a/.hgignore b/.hgignore index 2dd5fef..b96a5d0 100644 --- a/.hgignore +++ b/.hgignore @@ -5,6 +5,7 @@ syntax: glob *.so *.swp *~ +tmpfile ue1/imgsynth/imgsynth ue2/imgsynth/test/*_out* ue2/imgsynth2/imgsynth2 diff --git a/ue3/mycpu/ccpu.cpp b/ue3/mycpu/ccpu.cpp index 16209e2..af86200 100644 --- a/ue3/mycpu/ccpu.cpp +++ b/ue3/mycpu/ccpu.cpp @@ -1,7 +1,8 @@ /** * @module ccpu * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief CPU implementation. Used as a container for memory and instructions. + * Implements an run method to execute the program (= the instructions). * @date 10.05.2009 */ diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h index 01c897f..05b5c03 100644 --- a/ue3/mycpu/ccpu.h +++ b/ue3/mycpu/ccpu.h @@ -1,7 +1,8 @@ /** * @module ccpu * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief CPU implementation. Used as a container for memory and instructions. + * Implements a run method to execute the program (= the instructions). * @date 10.05.2009 */ @@ -18,7 +19,8 @@ /** * @class CCPU * - * TODO + * CPU implementation. Used as a container for memory and instructions. + * Implements a run method to execute the program (= the instructions). */ class CCPU { diff --git a/ue3/mycpu/cdisplay.h b/ue3/mycpu/cdisplay.h index ed9b84d..c2a84a6 100644 --- a/ue3/mycpu/cdisplay.h +++ b/ue3/mycpu/cdisplay.h @@ -1,7 +1,7 @@ /** * @module cdisplay * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief Abstract class for displays * @date 10.05.2009 */ @@ -11,7 +11,7 @@ /** * @class CDisplay * - * TODO + * Abstract class for displays */ class CDisplay { @@ -26,9 +26,8 @@ class CDisplay * @conditions none */ CDisplay(std::string name) - { - m_name = name; - } + : m_name(name) + {} /** * @method ~CDisplay diff --git a/ue3/mycpu/cinstruction.cpp b/ue3/mycpu/cinstruction.cpp index 57acd5f..5c1bd5c 100644 --- a/ue3/mycpu/cinstruction.cpp +++ b/ue3/mycpu/cinstruction.cpp @@ -1,8 +1,8 @@ /** * @module cinstruction * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO - * @date 10.05.2009 + * @brief Abstract class for displays + * @date 13.05.2009 */ #include diff --git a/ue3/mycpu/cinstruction.h b/ue3/mycpu/cinstruction.h index 40e9ddc..942d8cf 100644 --- a/ue3/mycpu/cinstruction.h +++ b/ue3/mycpu/cinstruction.h @@ -1,8 +1,8 @@ /** * @module cinstruction * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO - * @date 10.05.2009 + * @brief Abstract class for displays + * @date 13.05.2009 */ #ifndef CINSTRUCTION_H @@ -17,7 +17,7 @@ class CCPU; /** * @class CInstruction * - * TODO + * Abstract class for displays */ class CInstruction { diff --git a/ue3/mycpu/cprogram.cpp b/ue3/mycpu/cprogram.cpp index f904bce..1a450f5 100644 --- a/ue3/mycpu/cprogram.cpp +++ b/ue3/mycpu/cprogram.cpp @@ -1,7 +1,7 @@ /** * @module cprogram * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief CProgram extends std::vector and adds a method for parsing programfile * @date 12.05.2009 */ @@ -75,7 +75,7 @@ void CProgram::compile(std::istream& in) /* get instruction name */ size_t pos = line.find_first_of(' '); - string instrname = line.substr(0, pos); + string instrname(line.substr(0, pos)); /* search and create instruction */ CInstruction *instrptr = NULL; @@ -112,7 +112,7 @@ void CProgram::compile(std::istream& in) { if (instrparams.size() != 1) throw runtime_error("Invalid paramater count - must be 1"); - string label = instrparams.front(); + string label(instrparams.front()); if (label.length() < 2 || label[ label.length() - 1] != ':') throw runtime_error("Label has invalid syntax"); m_labels[ label.substr(0, label.length() - 1) ] = size(); diff --git a/ue3/mycpu/cprogram.h b/ue3/mycpu/cprogram.h index c145832..27e7647 100644 --- a/ue3/mycpu/cprogram.h +++ b/ue3/mycpu/cprogram.h @@ -1,7 +1,7 @@ /** * @module cprogram * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief CProgram extends std::vector and adds a method for parsing programfile * @date 10.05.2009 */ @@ -16,7 +16,8 @@ /** * @class CProgram * - * TODO + * CProgram extends std::vector and adds a method for parsing + * programfile. This adds instances of CInstruction to CProgram itself. */ class CProgram : public std::vector diff --git a/ue3/mycpu/displays.h b/ue3/mycpu/displays.h index f7adbdb..87b9408 100644 --- a/ue3/mycpu/displays.h +++ b/ue3/mycpu/displays.h @@ -1,7 +1,7 @@ /** * @module displays * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief Implementations of CDisplay * @date 10.05.2009 */ @@ -14,7 +14,8 @@ /** * @class CDisplayWDEZ * - * TODO + * Implementation of CDisplay + * Prints CDat to stdout as decimal */ class CDisplayWDEZ : public CDisplay @@ -35,7 +36,8 @@ class CDisplayWDEZ /** * @class CDisplayWHEX * - * TODO + * Implementation of CDisplay + * Prints CDat to stdout as decimal */ class CDisplayWHEX : public CDisplay diff --git a/ue3/mycpu/instructions.cpp b/ue3/mycpu/instructions.cpp index a6ac611..c2ce096 100644 --- a/ue3/mycpu/instructions.cpp +++ b/ue3/mycpu/instructions.cpp @@ -1,7 +1,7 @@ /** * @module instructions * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief Implementations of CInstruction * @date 10.05.2009 */ @@ -162,7 +162,7 @@ void CInstructionLoad::execute(CCPU *cpu) { checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); - CDat val = cpu->getRegisters()[ m_regidx2 ]; + CDat val(cpu->getRegisters()[ m_regidx2 ]); cpu->getRegisters()[ m_regidx1 ] = (*cpu->getMemory())[ val ]; } @@ -184,7 +184,7 @@ void CInstructionStore::execute(CCPU *cpu) { checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); - CDat val = cpu->getRegisters()[ m_regidx2 ]; + CDat val(cpu->getRegisters()[ m_regidx2 ]); (*cpu->getMemory())[ val ] = cpu->getRegisters()[ m_regidx1 ]; } diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h index 0e4d99c..a52b991 100644 --- a/ue3/mycpu/instructions.h +++ b/ue3/mycpu/instructions.h @@ -1,7 +1,7 @@ /** * @module instructions * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO + * @brief Implementations of CInstruction * @date 10.05.2009 */ @@ -14,7 +14,9 @@ /** * @class CInstructionInc * - * TODO + * Implementation of assembler command "inc" + * Syntax: inc R1 + * (R1++) */ class CInstructionInc : public CInstruction @@ -41,7 +43,9 @@ class CInstructionInc /** * @class CInstructionDec * - * TODO + * Implementation of assembler command "dec" + * Syntax: dec R1 + * (R1--) */ class CInstructionDec : public CInstruction @@ -68,7 +72,9 @@ class CInstructionDec /** * @class CInstructionAdd * - * TODO + * Implementation of assembler command "add" + * Syntax: add R1, R2, R3 + * (R1 = R2 + R3) */ class CInstructionAdd : public CInstruction @@ -97,7 +103,9 @@ class CInstructionAdd /** * @class CInstructionSub * - * TODO + * Implementation of assembler command "sub" + * Syntax: sub R1, R2, R3 + * (R1 = R2 - R3) */ class CInstructionSub : public CInstruction @@ -126,7 +134,9 @@ class CInstructionSub /** * @class CInstructionMul * - * TODO + * Implementation of assembler command "mul" + * Syntax: mul R1, R2, R3 + * (R1 = R2 * R3) */ class CInstructionMul : public CInstruction @@ -155,7 +165,9 @@ class CInstructionMul /** * @class CInstructionDiv * - * TODO + * Implementation of assembler command "div" + * Syntax: div R1, R2, R3 + * (R1 = R2 / R3) */ class CInstructionDiv : public CInstruction @@ -184,7 +196,9 @@ class CInstructionDiv /** * @class CInstructionLoad * - * TODO + * Implementation of assembler command "load" + * Syntax: load R1, R2 + * (R1 = memory[R2]) */ class CInstructionLoad : public CInstruction @@ -212,7 +226,9 @@ class CInstructionLoad /** * @class CInstructionStore * - * TODO + * Implementation of assembler command "store" + * Syntax: store R1, R2 + * (memory[R2] = R1) */ class CInstructionStore : public CInstruction @@ -240,7 +256,9 @@ class CInstructionStore /** * @class CInstructionTest * - * TODO + * Implementation of assembler command "test" + * Syntax: test R1 + * (R1 == 0: zeroflag: true, R1 < 0: signflag: true) */ class CInstructionTest : public CInstruction @@ -267,7 +285,8 @@ class CInstructionTest /** * @class CInstructionLabel * - * TODO + * Implementation of assembler command "label" + * Syntax: label name: */ class CInstructionLabel : public CInstruction @@ -294,7 +313,9 @@ class CInstructionLabel /** * @class CInstructionJumpA * - * TODO + * Implementation of assembler command "jumpa" + * Syntax: jumpa labelname + * (jump to labelname) */ class CInstructionJumpA : public CInstruction @@ -321,7 +342,9 @@ class CInstructionJumpA /** * @class CInstructionJumpZ * - * TODO + * Implementation of assembler command "jumpz" + * Syntax: jumpz labelname + * (jump to labelname if zeroflag) */ class CInstructionJumpZ : public CInstruction @@ -348,7 +371,9 @@ class CInstructionJumpZ /** * @class CInstructionJumpS * - * TODO + * Implementation of assembler command "jumps" + * Syntax: jumps labelname + * (jump to labelname if signflag) */ class CInstructionJumpS : public CInstruction @@ -375,7 +400,9 @@ class CInstructionJumpS /** * @class CInstructionWrite * - * TODO + * Implementation of assembler command "write" + * Syntax: write DEV, R1 + * (write R1 to DEV, which is a name of a display) */ class CInstructionWrite : public CInstruction diff --git a/ue3/mycpu/mycpu.cpp b/ue3/mycpu/mycpu.cpp index 08861a4..b25e721 100644 --- a/ue3/mycpu/mycpu.cpp +++ b/ue3/mycpu/mycpu.cpp @@ -1,10 +1,14 @@ /** * @module mycpu * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief TODO - * @date 11.05.2009 + * @brief mycpu executes a programfile (in simple assembler) by parsing the + * programfile first. This creates a vector of instructions, which will + * be executed in linear order (except jumps) afterwards. In order to + * initialize the memory of the cpu before execution an optional + * memoryfile can be passed as commandline option. + * @date 13.05.2009 * @par Exercise - * 3 + * 4 */ #include @@ -29,7 +33,11 @@ namespace po = boost::program_options; * @exception none * @conditions none * - * TODO + * parse commandline options, create and initialize memory, + * create cprogram instance, which parses the programfile and + * execute CCPU::run() + * On error print error message to stderr. + * Unknown commandline options will print a usage message. */ int main(int argc, char* argv[]) { @@ -88,7 +96,7 @@ int main(int argc, char* argv[]) } #if DEBUG - memory.dump(cout); + memory.dump(cerr); #endif } @@ -116,7 +124,7 @@ int main(int argc, char* argv[]) } #if DEBUG - program.dump(cout); + program.dump(cerr); #endif @@ -128,7 +136,7 @@ int main(int argc, char* argv[]) cpu.setProgram(&program); cpu.run(); #if DEBUG - //cpu.dumpRegisters(cout); + //cpu.dumpRegisters(cerr); #endif } catch(runtime_error& ex) @@ -136,8 +144,7 @@ int main(int argc, char* argv[]) cerr << me << ": Error while executing program:" << endl << " " << ex.what() << endl; #if DEBUG - memory.dump(cout); - //cpu.dumpRegisters(cout); + memory.dump(cerr); #endif return 1; } diff --git a/ue3/mycpu/test/test.sh b/ue3/mycpu/test/test.sh new file mode 100755 index 0000000..ad2ae4d --- /dev/null +++ b/ue3/mycpu/test/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +binary="./mycpu" +tmpfile="test/tmpfile" +inputs=( $(ls test/* | grep _program | sort -n) ) + +for input in ${inputs[@]} +do + echo "Testing $input ..." + + programfile="$input" + args="-c $programfile" + memoryfile="${input/_program/_memory}" + reffile="${input/_program/_output}" + if [ -e "$memoryfile" ] + then + args+=" -m $memoryfile" + fi + + if [ ! -e "$reffile" ] + then + echo " ERROR: reference file $reffile doesn't exist" + exit 1 + fi + + rm -rf "$tmpfile" + echo " Executing $binary $args ..." + $binary $args > $tmpfile + + md5_1=$(md5sum < "$reffile") + md5_2=$(md5sum < "$tmpfile") + if [ "$md5_1" != "$md5_2" ] + then + echo " ERROR: output and $reffile differ" + diff -Nau $reffile $tmpfile + exit 1 + else + echo " SUCCESS" + fi +done diff --git a/ue3/mycpu/test/test1_memory b/ue3/mycpu/test/test1_memory new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/ue3/mycpu/test/test1_memory @@ -0,0 +1 @@ +20 diff --git a/ue3/mycpu/test/test1_output b/ue3/mycpu/test/test1_output new file mode 100644 index 0000000..ac30dc2 --- /dev/null +++ b/ue3/mycpu/test/test1_output @@ -0,0 +1,19 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 diff --git a/ue3/mycpu/test/test1_program b/ue3/mycpu/test/test1_program new file mode 100644 index 0000000..ae5e9d2 --- /dev/null +++ b/ue3/mycpu/test/test1_program @@ -0,0 +1,13 @@ +# set R2 = 10 +LOAD R2, R1 + +# start of loop +label Loop: +inc R3 +sub R4, R3, R2 +test R4 +jumpz EndLoop +write WDEZ, R3 +jumpa Loop + +label EndLoop: -- cgit v1.2.3 From 67e99a217bd88a289d997b73f3e7cae6019bc22f Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 17:01:15 +0200 Subject: fixing doxygen documentation --- ue3/mycpu/ccpu.h | 2 +- ue3/mycpu/cdat.h | 20 ++++++++++---------- ue3/mycpu/cdisplay.h | 1 + ue3/mycpu/cinstruction.h | 5 +++-- ue3/mycpu/instructions.h | 24 ++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h index 05b5c03..6849623 100644 --- a/ue3/mycpu/ccpu.h +++ b/ue3/mycpu/ccpu.h @@ -106,7 +106,7 @@ class CCPU /** * @method setProgram * @brief set program to execute - * @param memory pointer to program + * @param program pointer to program * @return - * @globalvars none * @exception none diff --git a/ue3/mycpu/cdat.h b/ue3/mycpu/cdat.h index c656b99..a533fae 100644 --- a/ue3/mycpu/cdat.h +++ b/ue3/mycpu/cdat.h @@ -102,7 +102,7 @@ class CDatT /** * @method operator< * @brief implementation of operator < - * @param reference to CDatT + * @param x reference to CDatT * @return true if cdat is less than object x * @globalvars none * @exception none @@ -116,7 +116,7 @@ class CDatT /** * @method operator== * @brief implementation of operator == - * @param reference to CDatT + * @param x reference to CDatT * @return true if cdat equals object x * @globalvars none * @exception none @@ -130,7 +130,7 @@ class CDatT /** * @method operator+= * @brief implementation of operator += - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -145,7 +145,7 @@ class CDatT /** * @method operator-= * @brief implementation of operator -= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -160,7 +160,7 @@ class CDatT /** * @method operator*= * @brief implementation of operator *= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -175,7 +175,7 @@ class CDatT /** * @method operator/= * @brief implementation of operator /= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -190,7 +190,7 @@ class CDatT /** * @method operator%= * @brief implementation of operator %= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -205,7 +205,7 @@ class CDatT /** * @method operator|= * @brief implementation of operator |= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -220,7 +220,7 @@ class CDatT /** * @method operator&= * @brief implementation of operator &= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none @@ -235,7 +235,7 @@ class CDatT /** * @method operator^= * @brief implementation of operator ^= - * @param reference to CDatT + * @param x reference to CDatT * @return refecence to CDatT * @globalvars none * @exception none diff --git a/ue3/mycpu/cdisplay.h b/ue3/mycpu/cdisplay.h index c2a84a6..0a0a723 100644 --- a/ue3/mycpu/cdisplay.h +++ b/ue3/mycpu/cdisplay.h @@ -68,6 +68,7 @@ class CDisplay protected: /* members */ + /** name of display */ std::string m_name; }; diff --git a/ue3/mycpu/cinstruction.h b/ue3/mycpu/cinstruction.h index 942d8cf..4cc69de 100644 --- a/ue3/mycpu/cinstruction.h +++ b/ue3/mycpu/cinstruction.h @@ -50,7 +50,7 @@ class CInstruction /** * @method operator== * @brief implementation of operator == - * @param reference to std::string + * @param name reference to std::string * @return true if instructionname is name * @globalvars none * @exception none @@ -109,7 +109,7 @@ class CInstruction * @method operator<< * @brief Shift/output operator for outputstream * @param stream reference to outputstream - * @param cdat object which will be printed to stream + * @param instr object which will be printed to stream * @return reference to outputstream * @globalvars none * @exception none @@ -180,6 +180,7 @@ class CInstruction protected: /* members */ + /** name of instruction */ std::string m_name; }; diff --git a/ue3/mycpu/instructions.h b/ue3/mycpu/instructions.h index a52b991..4c36562 100644 --- a/ue3/mycpu/instructions.h +++ b/ue3/mycpu/instructions.h @@ -35,6 +35,7 @@ class CInstructionInc void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; }; @@ -64,6 +65,7 @@ class CInstructionDec void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; }; @@ -93,8 +95,11 @@ class CInstructionAdd void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** register number */ unsigned m_regidx2; + /** register number */ unsigned m_regidx3; }; @@ -124,8 +129,11 @@ class CInstructionSub void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** register number */ unsigned m_regidx2; + /** register number */ unsigned m_regidx3; }; @@ -155,8 +163,11 @@ class CInstructionMul void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** register number */ unsigned m_regidx2; + /** register number */ unsigned m_regidx3; }; @@ -186,8 +197,11 @@ class CInstructionDiv void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** register number */ unsigned m_regidx2; + /** register number */ unsigned m_regidx3; }; @@ -217,7 +231,9 @@ class CInstructionLoad void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** register number */ unsigned m_regidx2; }; @@ -247,7 +263,9 @@ class CInstructionStore void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** register number */ unsigned m_regidx2; }; @@ -277,6 +295,7 @@ class CInstructionTest void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; }; @@ -334,6 +353,7 @@ class CInstructionJumpA void execute(CCPU *cpu); protected: + /** labelname */ std::string m_addr; }; @@ -363,6 +383,7 @@ class CInstructionJumpZ void execute(CCPU *cpu); protected: + /** labelname */ std::string m_addr; }; @@ -392,6 +413,7 @@ class CInstructionJumpS void execute(CCPU *cpu); protected: + /** labelname */ std::string m_addr; }; @@ -421,7 +443,9 @@ class CInstructionWrite void execute(CCPU *cpu); protected: + /** register number */ unsigned m_regidx1; + /** device name */ std::string m_dev; }; -- cgit v1.2.3 From 9e7c204525a50f36ba7aa7563f1a9702d0bb6f44 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 13 May 2009 17:11:40 +0200 Subject: adding tab as whitespace --- ue3/mycpu/cprogram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ue3/mycpu/cprogram.cpp b/ue3/mycpu/cprogram.cpp index 1a450f5..3fcf734 100644 --- a/ue3/mycpu/cprogram.cpp +++ b/ue3/mycpu/cprogram.cpp @@ -102,7 +102,7 @@ void CProgram::compile(std::istream& in) string params = (pos == string::npos) ? "" : line.substr(pos + 1); boost::trim(params); list instrparams; - boost::split(instrparams, params, boost::is_any_of(", "), boost::token_compress_on); + boost::split(instrparams, params, boost::is_any_of(", \t"), boost::token_compress_on); /* let instruction parse the parameters. catch+throw exception */ try -- cgit v1.2.3 From ad6ca84f6e93f983de926ae71f31f42325986f61 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 14 May 2009 18:15:28 +0200 Subject: * making cdisplay a template * adding some asserts * adding classdiagramm and protokoll * fixing protokoll.pdf in ue1 --- ue1/protokoll.pdf | Bin 283846 -> 283840 bytes ue3/mycpu/cdisplay.h | 26 +++++--- ue3/mycpu/cinstruction.cpp | 2 + ue3/mycpu/instructions.cpp | 34 +++++++++++ ue3/mycpu/test/memory1 | 1 - ue3/mycpu/test/program1 | 13 ---- ue3/mycpu/test/test.sh | 4 +- ue3/protokoll.pdf | Bin 0 -> 405263 bytes ue3/protokoll/mycpu.png | Bin 0 -> 111899 bytes ue3/protokoll/mycpu.vpp | Bin 0 -> 129025 bytes ue3/protokoll/protokoll.tex | 144 +++++++++++++++++++++++++++++++++++++++----- 11 files changed, 185 insertions(+), 39 deletions(-) delete mode 100644 ue3/mycpu/test/memory1 delete mode 100644 ue3/mycpu/test/program1 create mode 100644 ue3/protokoll.pdf create mode 100644 ue3/protokoll/mycpu.png create mode 100644 ue3/protokoll/mycpu.vpp diff --git a/ue1/protokoll.pdf b/ue1/protokoll.pdf index d1a72ac..3682945 100644 Binary files a/ue1/protokoll.pdf and b/ue1/protokoll.pdf differ diff --git a/ue3/mycpu/cdisplay.h b/ue3/mycpu/cdisplay.h index 0a0a723..1523f68 100644 --- a/ue3/mycpu/cdisplay.h +++ b/ue3/mycpu/cdisplay.h @@ -1,7 +1,7 @@ /** * @module cdisplay * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief Abstract class for displays + * @brief Abstract template class for displays * @date 10.05.2009 */ @@ -9,15 +9,16 @@ #define CDISPLAY_H 1 /** - * @class CDisplay + * @class CDisplayT * - * Abstract class for displays + * Abstract template class for displays */ -class CDisplay +template +class CDisplayT { public: /** - * @method CDisplay + * @method CDisplayT * @brief Default ctor * @param name name of display * @return - @@ -25,12 +26,12 @@ class CDisplay * @exception none * @conditions none */ - CDisplay(std::string name) + CDisplayT(std::string name) : m_name(name) {} /** - * @method ~CDisplay + * @method ~CDisplayT * @brief Default dtor * @param - * @return - @@ -38,7 +39,7 @@ class CDisplay * @exception none * @conditions none */ - virtual ~CDisplay() + virtual ~CDisplayT() {} /** @@ -64,7 +65,7 @@ class CDisplay * @exception none * @conditions none */ - virtual void display(const CDat &value) = 0; + virtual void display(const T &value) = 0; protected: /* members */ @@ -72,6 +73,13 @@ class CDisplay std::string m_name; }; +/** + * @class CDisplay + * + * Memory definition for CCPU + */ +typedef CDisplayT CDisplay; + #endif /* vim: set et sw=2 ts=2: */ diff --git a/ue3/mycpu/cinstruction.cpp b/ue3/mycpu/cinstruction.cpp index 5c1bd5c..a766015 100644 --- a/ue3/mycpu/cinstruction.cpp +++ b/ue3/mycpu/cinstruction.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "cinstruction.h" #include "ccpu.h" @@ -35,6 +36,7 @@ const unsigned CInstruction::parseRegister(const std::string& str) inline void CInstruction::checkRegister(CCPU *cpu, const unsigned regidx) { + assert(cpu != NULL); if (regidx >= cpu->getRegisterCount()) { stringstream sstr; diff --git a/ue3/mycpu/instructions.cpp b/ue3/mycpu/instructions.cpp index c2ce096..ef9e944 100644 --- a/ue3/mycpu/instructions.cpp +++ b/ue3/mycpu/instructions.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "instructions.h" using namespace std; @@ -22,6 +23,8 @@ void CInstructionInc::compile(std::list& params) void CInstructionInc::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); cpu->getRegisters()[ m_regidx1 ]++; } @@ -40,6 +43,8 @@ void CInstructionDec::compile(std::list& params) void CInstructionDec::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); cpu->getRegisters()[ m_regidx1 ]--; } @@ -62,6 +67,8 @@ void CInstructionAdd::compile(std::list& params) void CInstructionAdd::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); checkRegister(cpu, m_regidx3); @@ -87,6 +94,8 @@ void CInstructionSub::compile(std::list& params) void CInstructionSub::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); checkRegister(cpu, m_regidx3); @@ -137,6 +146,8 @@ void CInstructionDiv::compile(std::list& params) void CInstructionDiv::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); checkRegister(cpu, m_regidx3); @@ -160,6 +171,9 @@ void CInstructionLoad::compile(std::list& params) void CInstructionLoad::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); + assert(cpu->getMemory() != NULL); checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); CDat val(cpu->getRegisters()[ m_regidx2 ]); @@ -182,6 +196,9 @@ void CInstructionStore::compile(std::list& params) void CInstructionStore::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); + assert(cpu->getMemory() != NULL); checkRegister(cpu, m_regidx1); checkRegister(cpu, m_regidx2); CDat val(cpu->getRegisters()[ m_regidx2 ]); @@ -202,6 +219,8 @@ void CInstructionTest::compile(std::list& params) void CInstructionTest::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); if (cpu->getRegisters()[ m_regidx1 ] == CDat(0)) cpu->setFlagZero(true); @@ -223,6 +242,9 @@ void CInstructionJumpA::compile(std::list& params) void CInstructionJumpA::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); + assert(cpu->getProgram() != NULL); if (m_addr.empty()) throw runtime_error("Empty address"); cpu->getRegisters()[ 0 ] = cpu->getProgram()->findLabel(m_addr); @@ -242,8 +264,13 @@ void CInstructionJumpZ::compile(std::list& params) void CInstructionJumpZ::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); + assert(cpu->getProgram() != NULL); if (!cpu->getFlagZero()) return; + if (m_addr.empty()) + throw runtime_error("Empty address"); cpu->getRegisters()[ 0 ] = cpu->getProgram()->findLabel(m_addr); } @@ -261,8 +288,13 @@ void CInstructionJumpS::compile(std::list& params) void CInstructionJumpS::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); + assert(cpu->getProgram() != NULL); if (!cpu->getFlagSign()) return; + if (m_addr.empty()) + throw runtime_error("Empty address"); cpu->getRegisters()[ 0 ] = cpu->getProgram()->findLabel(m_addr); } @@ -282,6 +314,8 @@ void CInstructionWrite::compile(std::list& params) void CInstructionWrite::execute(CCPU *cpu) { + assert(cpu != NULL); + assert(cpu->getRegisters() != NULL); checkRegister(cpu, m_regidx1); if (m_dev.empty()) throw runtime_error("Empty device"); diff --git a/ue3/mycpu/test/memory1 b/ue3/mycpu/test/memory1 deleted file mode 100644 index 209e3ef..0000000 --- a/ue3/mycpu/test/memory1 +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/ue3/mycpu/test/program1 b/ue3/mycpu/test/program1 deleted file mode 100644 index ae5e9d2..0000000 --- a/ue3/mycpu/test/program1 +++ /dev/null @@ -1,13 +0,0 @@ -# set R2 = 10 -LOAD R2, R1 - -# start of loop -label Loop: -inc R3 -sub R4, R3, R2 -test R4 -jumpz EndLoop -write WDEZ, R3 -jumpa Loop - -label EndLoop: diff --git a/ue3/mycpu/test/test.sh b/ue3/mycpu/test/test.sh index ad2ae4d..ff1076c 100755 --- a/ue3/mycpu/test/test.sh +++ b/ue3/mycpu/test/test.sh @@ -32,9 +32,11 @@ do if [ "$md5_1" != "$md5_2" ] then echo " ERROR: output and $reffile differ" - diff -Nau $reffile $tmpfile + diff -Naur "$reffile" "$tmpfile" + rm -rf "$tmpfile" exit 1 else echo " SUCCESS" fi + rm -rf "$tmpfile" done diff --git a/ue3/protokoll.pdf b/ue3/protokoll.pdf new file mode 100644 index 0000000..3d8c5eb Binary files /dev/null and b/ue3/protokoll.pdf differ diff --git a/ue3/protokoll/mycpu.png b/ue3/protokoll/mycpu.png new file mode 100644 index 0000000..570d50a Binary files /dev/null and b/ue3/protokoll/mycpu.png differ diff --git a/ue3/protokoll/mycpu.vpp b/ue3/protokoll/mycpu.vpp new file mode 100644 index 0000000..1f4b264 Binary files /dev/null and b/ue3/protokoll/mycpu.vpp differ diff --git a/ue3/protokoll/protokoll.tex b/ue3/protokoll/protokoll.tex index 8b413e7..dd53735 100644 --- a/ue3/protokoll/protokoll.tex +++ b/ue3/protokoll/protokoll.tex @@ -38,44 +38,110 @@ Manuel Mausz, \matrnr 0728348\\ Abbildung~\ref{fig:classdiagram1} zeigt das Klassendiagramm der Aufgabe. -TODO +Als Datentyp für Register und Hauptspeicher der CPU wurde ein allgemeines +Template implementiert, welche andere Datentypen oder Klasse umhüllen kann. +Zudem wurden die gängigsten Operatoren definiert, die man sich von einem +Datentyp erwarten kann. Gemäß der Aufgabenstellung wurde der Datentyp CDat als +umhüllter Integer-Wert definiert. + +Der Hauptspeicher der CPU wurde als abgeleitetes Template \mbox{CVectorMem} des +Templates \mbox{std::vector} implementiert, damit dieses um die +Methode \mbox{initialize} und \mbox{dump} erweitert werden konnten. Erstere +dient zur Initialisierung des Hauptspeichers bzw. Füllung des Vectors, +zweiteres zur Debugausgabe. Der Datentyp CMem wurde via typedef als +\mbox{CVectorMem} mit dem Templateargument CDat definiert. Somit enthält der +Hauptspeicher nur Elemente des Typs CDat. + +Die geforderten zwei Display-Klassen \mbox{CDisplayWDEZ} und +\mbox{CDisplayWHEX} wurden von der abstrakten Klasse CDisplay abgeleitet, welche +selbst als Template CDisplayT mit dem Templateargument CDat definiert ist. + +Der Programmspeicher \mbox{CProgram} wurde vom Template +\mbox{std::vector} abgeleitet. Somit ist diese Klasse, ähnlich +wie CMem, selbst ein Vector. Zudem wurden weitere Methoden hinzugefügt. Die +Methode \mbox{compile} dient zum Kompilieren bzw. Umwandeln des +Syntax der Programmdatei in Instanzen der Klasse CInstruction, die später von +der CPU ausgeführt werden. Zur Umwandlung werden bei der Instantiierung von +\mbox{CProgram} sämtliche erlaubten Instruktionen (also Instanzen von +\mbox{CInstruction}) in ein \mbox{std::set} eingefügt. Im Zuge der Methode +\mbox{compile} wird durch Iterieren die jeweilige Instruktion gesucht und durch +Anwendung des Designpattern \textit{Factory method pattern} die Instruktion +dupliziert und in \mbox{CProgram} gespeichert. Labels werden zwecks Effizienz in +einer \mbox{std::map} festgehalten. + +Die jeweiligen unterstützen Instruktionen wurden wie gefordert von der Klasse +\mbox{CInstruction} abgeleitet. \mbox{CInstruction} fordert die +Implementierung einer Methode \mbox{compile}, die während des parsens der +Programmdatei von \mbox{CProgram} aufgerufen werden, als auch eine Methode +\mbox{execute}, die im Zuge der Ausführung des Programms von CCPU +aufgerufen werden. + +Die eigentliche CPU wird durch die Klasse \mbox{CCPU} implementiert. Diese +dient hauptsächlich als Container für die einzelnen, notwendigen Teile +(Hauptspeicher, Programmspeicher, Displays, ...) und besitzt daher entsprechend +viele get- und set-Funktionen. Die Methode \mbox{run} dient zur Ausführung des +Programms und ist eine Schleife, die über die Instruktionen iteriert und die +Methode \mbox{execute} aufruft. %================================================================== -\begin{figure}[htb] - \begin{center} - \epsfxsize=0.9\textwidth\epsfbox{mycpu.png} - \end{center} - \caption{Klassendiagramm 1} - \label{fig:classdiagram1} -\end{figure} +\begin{center} + \begin{figure}[htb] + \epsfxsize=1.6\textwidth\epsfbox{mycpu.png} + \caption{Klassendiagramm 1} + \label{fig:classdiagram1} + \end{figure} +\end{center} %================================================================== \subsection{Verwaltung der Ressourcen} -TODO +Alle Objekte, die im Konstruktor alloziert werden, werden im Destruktor wieder +freigegeben. Die Objekte, die über die \textit{Factory method pattern} +alloziert werden, werden im Zuge des Destruktor des Vectors bzw. +von \mbox{CProgram} wieder freigegeben. \subsection{Fehlerbehandlung} -TODO +Es wurden keine eigenen Exceptions eingeführt. Statt dessen werden Exceptions +meist in Exceptions des Typs \mbox{std::runtime\_error} umgewandelt. Da die +Hierarchie nicht sehr tief ist, fängt lediglich \mbox{CPropram::compile} +Exceptions des Typs \mbox{std::runtime\_error}, um zusätzliche Information an +den ursprünglichen Aufrufer der Methode weiterzugeben. Dies geschieht ebenfalls +per Exception des Typs \mbox{std::runtime\_error}. \subsection{Implementierung} -TODO - +Siehe Punkt~\ref{Design} und Abbildung~\ref{fig:classdiagram1} sowie +Punkt~\ref{Listings}.\\ +Es wurde viel mit Templates gearbeitet. \section{Projektverlauf} \subsection{Probleme und Fallstricke} -TODO +Abgesehen von den mittlerweile üblichen Schwierigkeiten die Angabe bzw. +die Gedanken dessen Verfassers verstehen zu wollen, arbeitete das erste Design +noch vermehrt mit Text. Unter anderem hatte die Methode +\mbox{CInstruction::execute} einen Parameter des Typs \mbox{std::string}, was +zum dazu führte, das die Instruktion bei jeder Aufführung (zum Beispiel durch +Jumps) erneut geparsed werden musste. \subsection{Arbeitsaufwand} \begin{tabular}{ll} \toprule - Entwicklungsschritt / Meilenstein & Arbeitsaufwand in Stunden\\ + Entwicklungsschritt / Meilenstein & Arbeitsaufwand\\ + \midrule + Erstes Design & 3 Stunden\\ + \hline + Implementierung & 3 Tage\\ + \hline + Anpassung des Designs und der Implementierung & 4 Stunden\\ + \hline + Dokumentation (Doxygen) und Überprüfung aller\\ + Anforderungen gemäß der Programmierrichtlinien & 4 Stunden\\ \hline - TODO & TODO\\ + Erstellung des Protokolls & 3 Stunden\\ \bottomrule \end{tabular} @@ -88,5 +154,53 @@ TODO \subsection{mycpu.cpp} \lstinputlisting{../mycpu/mycpu.cpp} +\newpage +\subsection{cdat.h} +\lstinputlisting{../mycpu/cdat.h} + +\newpage +\subsection{cmem.h} +\lstinputlisting{../mycpu/cmem.h} + +\newpage +\subsection{cinstruction.h} +\lstinputlisting{../mycpu/cinstruction.h} + +\newpage +\subsection{cinstruction.cpp} +\lstinputlisting{../mycpu/cinstruction.cpp} + +\newpage +\subsection{instructions.h} +\lstinputlisting{../mycpu/instructions.h} + +\newpage +\subsection{instructions.cpp} +\lstinputlisting{../mycpu/instructions.cpp} + +\newpage +\subsection{cdisplay.h} +\lstinputlisting{../mycpu/cdisplay.h} + +\newpage +\subsection{displays.h} +\lstinputlisting{../mycpu/displays.h} + +\newpage +\subsection{cprogram.h} +\lstinputlisting{../mycpu/cprogram.h} + +\newpage +\subsection{cprogram.cpp} +\lstinputlisting{../mycpu/cprogram.cpp} + +\newpage +\subsection{ccpu.h} +\lstinputlisting{../mycpu/ccpu.h} + +\newpage +\subsection{ccpu.cpp} +\lstinputlisting{../mycpu/ccpu.cpp} + \end{document} -- cgit v1.2.3 From 3563c6dfd0f5f102cb748ecc6ad318601990515e Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 14 May 2009 18:21:15 +0200 Subject: adding doxygen docs --- ue3/doxygen/annotated.html | 54 ++ ue3/doxygen/ccpu_8h-source.html | 114 +++ ue3/doxygen/cdat_8h-source.html | 148 ++++ ue3/doxygen/cdisplay_8h-source.html | 52 ++ ue3/doxygen/cinstruction_8h-source.html | 85 +++ ue3/doxygen/classCCPU-members.html | 42 ++ ue3/doxygen/classCCPU.html | 578 ++++++++++++++++ ue3/doxygen/classCDat.html | 35 + ue3/doxygen/classCDatT-members.html | 48 ++ ue3/doxygen/classCDatT.html | 879 ++++++++++++++++++++++++ ue3/doxygen/classCDisplay.html | 45 ++ ue3/doxygen/classCDisplay.png | Bin 0 -> 514 bytes ue3/doxygen/classCDisplayT-members.html | 33 + ue3/doxygen/classCDisplayT.html | 227 ++++++ ue3/doxygen/classCDisplayWDEZ-members.html | 30 + ue3/doxygen/classCDisplayWDEZ.html | 87 +++ ue3/doxygen/classCDisplayWDEZ.png | Bin 0 -> 400 bytes ue3/doxygen/classCDisplayWHEX-members.html | 30 + ue3/doxygen/classCDisplayWHEX.html | 87 +++ ue3/doxygen/classCDisplayWHEX.png | Bin 0 -> 389 bytes ue3/doxygen/classCInstruction-members.html | 41 ++ ue3/doxygen/classCInstruction.html | 575 ++++++++++++++++ ue3/doxygen/classCInstruction.png | Bin 0 -> 1882 bytes ue3/doxygen/classCInstructionAdd-members.html | 45 ++ ue3/doxygen/classCInstructionAdd.html | 223 ++++++ ue3/doxygen/classCInstructionAdd.png | Bin 0 -> 389 bytes ue3/doxygen/classCInstructionDec-members.html | 43 ++ ue3/doxygen/classCInstructionDec.html | 189 +++++ ue3/doxygen/classCInstructionDec.png | Bin 0 -> 393 bytes ue3/doxygen/classCInstructionDiv-members.html | 45 ++ ue3/doxygen/classCInstructionDiv.html | 223 ++++++ ue3/doxygen/classCInstructionDiv.png | Bin 0 -> 382 bytes ue3/doxygen/classCInstructionInc-members.html | 43 ++ ue3/doxygen/classCInstructionInc.html | 189 +++++ ue3/doxygen/classCInstructionInc.png | Bin 0 -> 373 bytes ue3/doxygen/classCInstructionJumpA-members.html | 43 ++ ue3/doxygen/classCInstructionJumpA.html | 189 +++++ ue3/doxygen/classCInstructionJumpA.png | Bin 0 -> 414 bytes ue3/doxygen/classCInstructionJumpS-members.html | 43 ++ ue3/doxygen/classCInstructionJumpS.html | 189 +++++ ue3/doxygen/classCInstructionJumpS.png | Bin 0 -> 416 bytes ue3/doxygen/classCInstructionJumpZ-members.html | 43 ++ ue3/doxygen/classCInstructionJumpZ.html | 189 +++++ ue3/doxygen/classCInstructionJumpZ.png | Bin 0 -> 416 bytes ue3/doxygen/classCInstructionLabel-members.html | 42 ++ ue3/doxygen/classCInstructionLabel.html | 170 +++++ ue3/doxygen/classCInstructionLabel.png | Bin 0 -> 400 bytes ue3/doxygen/classCInstructionLoad-members.html | 44 ++ ue3/doxygen/classCInstructionLoad.html | 206 ++++++ ue3/doxygen/classCInstructionLoad.png | Bin 0 -> 395 bytes ue3/doxygen/classCInstructionMul-members.html | 45 ++ ue3/doxygen/classCInstructionMul.html | 223 ++++++ ue3/doxygen/classCInstructionMul.png | Bin 0 -> 384 bytes ue3/doxygen/classCInstructionStore-members.html | 44 ++ ue3/doxygen/classCInstructionStore.html | 206 ++++++ ue3/doxygen/classCInstructionStore.png | Bin 0 -> 400 bytes ue3/doxygen/classCInstructionSub-members.html | 45 ++ ue3/doxygen/classCInstructionSub.html | 223 ++++++ ue3/doxygen/classCInstructionSub.png | Bin 0 -> 388 bytes ue3/doxygen/classCInstructionTest-members.html | 43 ++ ue3/doxygen/classCInstructionTest.html | 189 +++++ ue3/doxygen/classCInstructionTest.png | Bin 0 -> 392 bytes ue3/doxygen/classCInstructionWrite-members.html | 44 ++ ue3/doxygen/classCInstructionWrite.html | 206 ++++++ ue3/doxygen/classCInstructionWrite.png | Bin 0 -> 394 bytes ue3/doxygen/classCMem.html | 35 + ue3/doxygen/classCProgram-members.html | 33 + ue3/doxygen/classCProgram.html | 234 +++++++ ue3/doxygen/classCVectorMem-members.html | 29 + ue3/doxygen/classCVectorMem.html | 83 +++ ue3/doxygen/cmem_8h-source.html | 95 +++ ue3/doxygen/cprogram_8h-source.html | 60 ++ ue3/doxygen/displays_8h-source.html | 60 ++ ue3/doxygen/doxygen.css | 358 ++++++++++ ue3/doxygen/doxygen.png | Bin 0 -> 1281 bytes ue3/doxygen/files.html | 30 + ue3/doxygen/functions.html | 259 +++++++ ue3/doxygen/functions_func.html | 219 ++++++ ue3/doxygen/functions_rela.html | 44 ++ ue3/doxygen/functions_vars.html | 71 ++ ue3/doxygen/hierarchy.html | 58 ++ ue3/doxygen/index.html | 22 + ue3/doxygen/instructions_8h-source.html | 347 ++++++++++ ue3/doxygen/namespaces.html | 23 + ue3/doxygen/namespacestd.html | 32 + ue3/doxygen/tab_b.gif | Bin 0 -> 35 bytes ue3/doxygen/tab_l.gif | Bin 0 -> 706 bytes ue3/doxygen/tab_r.gif | Bin 0 -> 2585 bytes ue3/doxygen/tabs.css | 102 +++ ue3/mycpu/cdisplay.h | 2 +- ue3/mycpu/displays.h | 18 + 91 files changed, 8829 insertions(+), 1 deletion(-) create mode 100644 ue3/doxygen/annotated.html create mode 100644 ue3/doxygen/ccpu_8h-source.html create mode 100644 ue3/doxygen/cdat_8h-source.html create mode 100644 ue3/doxygen/cdisplay_8h-source.html create mode 100644 ue3/doxygen/cinstruction_8h-source.html create mode 100644 ue3/doxygen/classCCPU-members.html create mode 100644 ue3/doxygen/classCCPU.html create mode 100644 ue3/doxygen/classCDat.html create mode 100644 ue3/doxygen/classCDatT-members.html create mode 100644 ue3/doxygen/classCDatT.html create mode 100644 ue3/doxygen/classCDisplay.html create mode 100644 ue3/doxygen/classCDisplay.png create mode 100644 ue3/doxygen/classCDisplayT-members.html create mode 100644 ue3/doxygen/classCDisplayT.html create mode 100644 ue3/doxygen/classCDisplayWDEZ-members.html create mode 100644 ue3/doxygen/classCDisplayWDEZ.html create mode 100644 ue3/doxygen/classCDisplayWDEZ.png create mode 100644 ue3/doxygen/classCDisplayWHEX-members.html create mode 100644 ue3/doxygen/classCDisplayWHEX.html create mode 100644 ue3/doxygen/classCDisplayWHEX.png create mode 100644 ue3/doxygen/classCInstruction-members.html create mode 100644 ue3/doxygen/classCInstruction.html create mode 100644 ue3/doxygen/classCInstruction.png create mode 100644 ue3/doxygen/classCInstructionAdd-members.html create mode 100644 ue3/doxygen/classCInstructionAdd.html create mode 100644 ue3/doxygen/classCInstructionAdd.png create mode 100644 ue3/doxygen/classCInstructionDec-members.html create mode 100644 ue3/doxygen/classCInstructionDec.html create mode 100644 ue3/doxygen/classCInstructionDec.png create mode 100644 ue3/doxygen/classCInstructionDiv-members.html create mode 100644 ue3/doxygen/classCInstructionDiv.html create mode 100644 ue3/doxygen/classCInstructionDiv.png create mode 100644 ue3/doxygen/classCInstructionInc-members.html create mode 100644 ue3/doxygen/classCInstructionInc.html create mode 100644 ue3/doxygen/classCInstructionInc.png create mode 100644 ue3/doxygen/classCInstructionJumpA-members.html create mode 100644 ue3/doxygen/classCInstructionJumpA.html create mode 100644 ue3/doxygen/classCInstructionJumpA.png create mode 100644 ue3/doxygen/classCInstructionJumpS-members.html create mode 100644 ue3/doxygen/classCInstructionJumpS.html create mode 100644 ue3/doxygen/classCInstructionJumpS.png create mode 100644 ue3/doxygen/classCInstructionJumpZ-members.html create mode 100644 ue3/doxygen/classCInstructionJumpZ.html create mode 100644 ue3/doxygen/classCInstructionJumpZ.png create mode 100644 ue3/doxygen/classCInstructionLabel-members.html create mode 100644 ue3/doxygen/classCInstructionLabel.html create mode 100644 ue3/doxygen/classCInstructionLabel.png create mode 100644 ue3/doxygen/classCInstructionLoad-members.html create mode 100644 ue3/doxygen/classCInstructionLoad.html create mode 100644 ue3/doxygen/classCInstructionLoad.png create mode 100644 ue3/doxygen/classCInstructionMul-members.html create mode 100644 ue3/doxygen/classCInstructionMul.html create mode 100644 ue3/doxygen/classCInstructionMul.png create mode 100644 ue3/doxygen/classCInstructionStore-members.html create mode 100644 ue3/doxygen/classCInstructionStore.html create mode 100644 ue3/doxygen/classCInstructionStore.png create mode 100644 ue3/doxygen/classCInstructionSub-members.html create mode 100644 ue3/doxygen/classCInstructionSub.html create mode 100644 ue3/doxygen/classCInstructionSub.png create mode 100644 ue3/doxygen/classCInstructionTest-members.html create mode 100644 ue3/doxygen/classCInstructionTest.html create mode 100644 ue3/doxygen/classCInstructionTest.png create mode 100644 ue3/doxygen/classCInstructionWrite-members.html create mode 100644 ue3/doxygen/classCInstructionWrite.html create mode 100644 ue3/doxygen/classCInstructionWrite.png create mode 100644 ue3/doxygen/classCMem.html create mode 100644 ue3/doxygen/classCProgram-members.html create mode 100644 ue3/doxygen/classCProgram.html create mode 100644 ue3/doxygen/classCVectorMem-members.html create mode 100644 ue3/doxygen/classCVectorMem.html create mode 100644 ue3/doxygen/cmem_8h-source.html create mode 100644 ue3/doxygen/cprogram_8h-source.html create mode 100644 ue3/doxygen/displays_8h-source.html create mode 100644 ue3/doxygen/doxygen.css create mode 100644 ue3/doxygen/doxygen.png create mode 100644 ue3/doxygen/files.html create mode 100644 ue3/doxygen/functions.html create mode 100644 ue3/doxygen/functions_func.html create mode 100644 ue3/doxygen/functions_rela.html create mode 100644 ue3/doxygen/functions_vars.html create mode 100644 ue3/doxygen/hierarchy.html create mode 100644 ue3/doxygen/index.html create mode 100644 ue3/doxygen/instructions_8h-source.html create mode 100644 ue3/doxygen/namespaces.html create mode 100644 ue3/doxygen/namespacestd.html create mode 100644 ue3/doxygen/tab_b.gif create mode 100644 ue3/doxygen/tab_l.gif create mode 100644 ue3/doxygen/tab_r.gif create mode 100644 ue3/doxygen/tabs.css diff --git a/ue3/doxygen/annotated.html b/ue3/doxygen/annotated.html new file mode 100644 index 0000000..fb958c8 --- /dev/null +++ b/ue3/doxygen/annotated.html @@ -0,0 +1,54 @@ + + +mycpu: Class List + + + + + + +

mycpu Class List

Here are the classes, structs, unions and interfaces with brief descriptions: + + + + + + + + + + + + + + + + + + + + + + + + + +
CCPU
CDat
CDatT< T >
CDisplay
CDisplayT< T >
CDisplayWDEZ
CDisplayWHEX
CInstruction
CInstructionAdd
CInstructionDec
CInstructionDiv
CInstructionInc
CInstructionJumpA
CInstructionJumpS
CInstructionJumpZ
CInstructionLabel
CInstructionLoad
CInstructionMul
CInstructionStore
CInstructionSub
CInstructionTest
CInstructionWrite
CMem
CProgram
CVectorMem< T, Allocator >
+
Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/ccpu_8h-source.html b/ue3/doxygen/ccpu_8h-source.html new file mode 100644 index 0000000..0081283 --- /dev/null +++ b/ue3/doxygen/ccpu_8h-source.html @@ -0,0 +1,114 @@ + + +mycpu: mycpu/ccpu.h Source File + + + + + +

mycpu/ccpu.h

00001 
+00009 #ifndef CCPU_H
+00010 #define CCPU_H 1
+00011 
+00012 #include <iostream>
+00013 #include <set>
+00014 #include "cdat.h"
+00015 #include "cmem.h"
+00016 #include "cprogram.h"
+00017 #include "cdisplay.h"
+00018 
+00025 class CCPU
+00026 {
+00027   public:
+00037     CCPU(const unsigned cnt);
+00038 
+00048     ~CCPU();
+00049 
+00059     const unsigned getRegisterCount() const
+00060     {
+00061       return m_regcnt;
+00062     }
+00063 
+00073     CDat *getRegisters() const
+00074     {
+00075       return m_registers;
+00076     }
+00077 
+00087     void setMemory(CMem *memory)
+00088     {
+00089       m_memory = memory;
+00090     }
+00091 
+00101     CMem *getMemory() const
+00102     {
+00103       return m_memory;
+00104     }
+00105 
+00115     void setProgram(const CProgram *program)
+00116     {
+00117       m_program = program;
+00118     }
+00119 
+00129     const CProgram *getProgram()
+00130     {
+00131       return m_program;
+00132     }
+00133 
+00143     const std::set<CDisplay *>& getDisplays()
+00144     {
+00145       return m_displays;
+00146     }
+00147 
+00157     void setFlagZero(const bool value)
+00158     {
+00159       m_flagzero = value;
+00160     }
+00161 
+00171     const bool getFlagZero()
+00172     {
+00173       return m_flagzero;
+00174     }
+00175 
+00185     void setFlagSign(const bool value)
+00186     {
+00187       m_flagsign = value;
+00188     }
+00189 
+00199     const bool getFlagSign()
+00200     {
+00201       return m_flagsign;
+00202     }
+00203 
+00213     void run();
+00214 
+00215 #if DEBUG
+00216 
+00225     void dumpRegisters(std::ostream& out);
+00226 #endif
+00227 
+00228   private:
+00229     /* members */
+00230     CDat *m_registers;
+00231     unsigned m_regcnt;
+00232     CMem *m_memory;
+00233     const CProgram *m_program;
+00234     std::set<CDisplay *> m_displays;
+00235     bool m_flagzero;
+00236     bool m_flagsign;
+00237 };
+00238 
+00239 #endif
+00240 
+00241 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/cdat_8h-source.html b/ue3/doxygen/cdat_8h-source.html new file mode 100644 index 0000000..5c40e9d --- /dev/null +++ b/ue3/doxygen/cdat_8h-source.html @@ -0,0 +1,148 @@ + + +mycpu: mycpu/cdat.h Source File + + + + + +

mycpu/cdat.h

00001 
+00008 #ifndef CDAT_H
+00009 #define CDAT_H 1
+00010 
+00011 #include <boost/operators.hpp>
+00012 #include <iostream>
+00013 
+00019 template <class T>
+00020 class CDatT
+00021   : boost::operators<CDatT<T> >
+00022 {
+00023   public:
+00033     CDatT()
+00034     {}
+00035 
+00045     ~CDatT()
+00046     {}
+00047 
+00057     CDatT(const CDatT& other)
+00058       : m_value(other.m_value)
+00059     {}
+00060 
+00070     CDatT(T newval)
+00071       : m_value(newval)
+00072     {}
+00073 
+00083     T getValue() const
+00084     {
+00085       return m_value;
+00086     }
+00087 
+00097     operator T()
+00098     {
+00099       return m_value;
+00100     }
+00101 
+00111     bool operator<(const CDatT& x) const
+00112     {
+00113       return m_value < x.m_value;
+00114     }
+00115 
+00125     bool operator==(const CDatT& x) const
+00126     {
+00127       return m_value == x.m_value;
+00128     }
+00129 
+00139     CDatT& operator+=(const CDatT& x)
+00140     {
+00141       m_value += x.m_value;
+00142       return *this;
+00143     }
+00144 
+00154     CDatT& operator-=(const CDatT& x)
+00155     {
+00156       m_value -= x.m_value;
+00157       return *this;
+00158     }
+00159 
+00169     CDatT& operator*=(const CDatT& x)
+00170     {
+00171       m_value *= x.m_value;
+00172       return *this;
+00173     }
+00174 
+00184     CDatT& operator/=(const CDatT& x)
+00185     {
+00186       m_value /= x.m_value;
+00187       return *this;
+00188     }
+00189 
+00199     CDatT& operator%=(const CDatT& x)
+00200     {
+00201       m_value %= x.m_value;
+00202       return *this;
+00203     }
+00204 
+00214     CDatT& operator|=(const CDatT& x)
+00215     {
+00216       m_value |= x.m_value;
+00217       return *this;
+00218     }
+00219 
+00229     CDatT& operator&=(const CDatT& x)
+00230     {
+00231       m_value &= x.m_value;
+00232       return *this;
+00233     }
+00234 
+00244     CDatT& operator^=(const CDatT& x)
+00245     {
+00246       m_value ^= x.m_value;
+00247       return *this;
+00248     }
+00249 
+00259     CDatT& operator++()
+00260     {
+00261       m_value++;
+00262       return *this;
+00263     }
+00264 
+00274     CDatT& operator--()
+00275     {
+00276       m_value--;
+00277       return *this;
+00278     }
+00279 
+00290     friend std::ostream& operator<<(std::ostream& stream, CDatT cdat)
+00291     {
+00292       stream << cdat.m_value;
+00293       return stream;
+00294     }
+00295 
+00306     friend std::istream& operator>>(std::istream & stream, CDatT& cdat)
+00307     {
+00308       stream >> cdat.m_value;
+00309       return stream;
+00310     }
+00311 
+00312   private:
+00313     /* members */
+00314     T m_value;
+00315 };
+00316 
+00322 typedef CDatT<int> CDat;
+00323 
+00324 #endif
+00325 
+00326 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/cdisplay_8h-source.html b/ue3/doxygen/cdisplay_8h-source.html new file mode 100644 index 0000000..b8c4ef3 --- /dev/null +++ b/ue3/doxygen/cdisplay_8h-source.html @@ -0,0 +1,52 @@ + + +mycpu: mycpu/cdisplay.h Source File + + + + + +

mycpu/cdisplay.h

00001 
+00008 #ifndef CDISPLAY_H
+00009 #define CDISPLAY_H 1
+00010 
+00016 template <class T>
+00017 class CDisplayT
+00018 {
+00019   public:
+00029     CDisplayT(std::string name)
+00030       : m_name(name)
+00031     {}
+00032 
+00042     virtual ~CDisplayT()
+00043     {}
+00044 
+00054     virtual const std::string& getName()
+00055     {
+00056       return m_name;
+00057     }
+00058 
+00068     virtual void display(const T &value) = 0;
+00069 
+00070   protected:
+00071     /* members */
+00073     std::string m_name;
+00074 };
+00075 
+00081 typedef CDisplayT<CDat> CDisplay;
+00082 
+00083 #endif
+00084 
+00085 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/cinstruction_8h-source.html b/ue3/doxygen/cinstruction_8h-source.html new file mode 100644 index 0000000..3055c9c --- /dev/null +++ b/ue3/doxygen/cinstruction_8h-source.html @@ -0,0 +1,85 @@ + + +mycpu: mycpu/cinstruction.h Source File + + + + + +

mycpu/cinstruction.h

00001 
+00008 #ifndef CINSTRUCTION_H
+00009 #define CINSTRUCTION_H 1
+00010 
+00011 #include <iostream>
+00012 #include <list>
+00013 
+00014 /* forward declare CCPU */
+00015 class CCPU;
+00016 
+00022 class CInstruction
+00023 {
+00024   public:
+00034     CInstruction(std::string name)
+00035       : m_name(name)
+00036     {}
+00037 
+00047     virtual ~CInstruction()
+00048     {}
+00049 
+00059     virtual bool operator==(std::string& name)
+00060     {
+00061       return name == m_name;
+00062     }
+00063 
+00073     virtual CInstruction& operator()(CCPU *cpu)
+00074     {
+00075       execute(cpu);
+00076       return *this;
+00077     }
+00078 
+00088     virtual const std::string& getName()
+00089     {
+00090       return m_name;
+00091     }
+00092 
+00102     virtual std::ostream& dump(std::ostream& stream)
+00103     {
+00104       stream << m_name;
+00105       return stream;
+00106     }
+00107 
+00118     friend std::ostream& operator<<(std::ostream& stream, CInstruction& instr)
+00119     {
+00120       return instr.dump(stream);
+00121     }
+00122 
+00132     virtual const unsigned parseRegister(const std::string& str);
+00133 
+00145     virtual void checkRegister(CCPU *cpu, const unsigned regidx);
+00146 
+00156     virtual CInstruction *factory() = 0;
+00157 
+00168     virtual void compile(std::list<std::string>& params) = 0;
+00169 
+00179     virtual void execute(CCPU *cpu) = 0;
+00180 
+00181   protected:
+00182     /* members */
+00184     std::string m_name;
+00185 };
+00186 
+00187 #endif
+00188 
+00189 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCCPU-members.html b/ue3/doxygen/classCCPU-members.html new file mode 100644 index 0000000..921d0e7 --- /dev/null +++ b/ue3/doxygen/classCCPU-members.html @@ -0,0 +1,42 @@ + + +mycpu: Member List + + + + + + +

CCPU Member List

This is the complete list of members for CCPU, including all inherited members.

+ + + + + + + + + + + + + + +
CCPU(const unsigned cnt)CCPU
getDisplays()CCPU [inline]
getFlagSign()CCPU [inline]
getFlagZero()CCPU [inline]
getMemory() const CCPU [inline]
getProgram()CCPU [inline]
getRegisterCount() const CCPU [inline]
getRegisters() const CCPU [inline]
run()CCPU
setFlagSign(const bool value)CCPU [inline]
setFlagZero(const bool value)CCPU [inline]
setMemory(CMem *memory)CCPU [inline]
setProgram(const CProgram *program)CCPU [inline]
~CCPU()CCPU


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCCPU.html b/ue3/doxygen/classCCPU.html new file mode 100644 index 0000000..c888360 --- /dev/null +++ b/ue3/doxygen/classCCPU.html @@ -0,0 +1,578 @@ + + +mycpu: CCPU Class Reference + + + + + + +

CCPU Class Reference

#include <ccpu.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CCPU (const unsigned cnt)
 Default ctor.
 ~CCPU ()
 Default dtor.
const unsigned getRegisterCount () const
 get number of registers
CDatgetRegisters () const
 get pointer to registers array
void setMemory (CMem *memory)
 set memory of cpu
CMemgetMemory () const
 get pointer to memory
void setProgram (const CProgram *program)
 set program to execute
const CProgramgetProgram ()
 get pointer to program
const std::set
+< CDisplay * > & 
getDisplays ()
 get set of pointers to displays
void setFlagZero (const bool value)
 set zero flag
const bool getFlagZero ()
 get value of zero flag
void setFlagSign (const bool value)
 set sign flag
const bool getFlagSign ()
 get value of sign flag
void run ()
 execute current program
+


Detailed Description

+CPU implementation. Used as a container for memory and instructions. Implements a run method to execute the program (= the instructions).

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + +
CCPU::CCPU (const unsigned  cnt  ) 
+
+
+ +

+Default ctor. +

+

Methodname:
CCPU
+
Parameters:
+ + +
cnt number of registers to allocate for this cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
CCPU::~CCPU (  ) 
+
+
+ +

+Default dtor. +

+

Methodname:
~CCPU
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + +
const unsigned CCPU::getRegisterCount (  )  const [inline]
+
+
+ +

+get number of registers +

+

Methodname:
getRegisterCount
+
Parameters:
+ + +
- 
+
+
Returns:
number of registers
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
CDat* CCPU::getRegisters (  )  const [inline]
+
+
+ +

+get pointer to registers array +

+

Methodname:
getRegisters
+
Parameters:
+ + +
- 
+
+
Returns:
pointer to registers array
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
void CCPU::setMemory (CMem memory  )  [inline]
+
+
+ +

+set memory of cpu +

+

Methodname:
setMemory
+
Parameters:
+ + +
memory pointer to memory
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
CMem* CCPU::getMemory (  )  const [inline]
+
+
+ +

+get pointer to memory +

+

Methodname:
getMemory
+
Parameters:
+ + +
- 
+
+
Returns:
pointer to memory
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
void CCPU::setProgram (const CProgram program  )  [inline]
+
+
+ +

+set program to execute +

+

Methodname:
setProgram
+
Parameters:
+ + +
program pointer to program
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
const CProgram* CCPU::getProgram (  )  [inline]
+
+
+ +

+get pointer to program +

+

Methodname:
getProgram
+
Parameters:
+ + +
- 
+
+
Returns:
pointer to program
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
const std::set<CDisplay *>& CCPU::getDisplays (  )  [inline]
+
+
+ +

+get set of pointers to displays +

+

Methodname:
getDisplays
+
Parameters:
+ + +
- 
+
+
Returns:
reference to set of pointers to displays
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
void CCPU::setFlagZero (const bool  value  )  [inline]
+
+
+ +

+set zero flag +

+

Methodname:
setFlagZero
+
Parameters:
+ + +
value new value of zero flag
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
const bool CCPU::getFlagZero (  )  [inline]
+
+
+ +

+get value of zero flag +

+

Methodname:
getFlagZero
+
Parameters:
+ + +
- 
+
+
Returns:
value of zero flag
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
void CCPU::setFlagSign (const bool  value  )  [inline]
+
+
+ +

+set sign flag +

+

Methodname:
setFlagSign
+
Parameters:
+ + +
value new value of sign flag
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
const bool CCPU::getFlagSign (  )  [inline]
+
+
+ +

+get value of sign flag +

+

Methodname:
getFlagSign
+
Parameters:
+ + +
- 
+
+
Returns:
value of sign flag
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
void CCPU::run (  ) 
+
+
+ +

+execute current program +

+

Methodname:
run
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDat.html b/ue3/doxygen/classCDat.html new file mode 100644 index 0000000..198ebc0 --- /dev/null +++ b/ue3/doxygen/classCDat.html @@ -0,0 +1,35 @@ + + +mycpu: CDat Class Reference + + + + + + +

CDat Class Reference

#include <cdat.h> +

+ + +
+


Detailed Description

+Datatype for CCPU and CMem
The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDatT-members.html b/ue3/doxygen/classCDatT-members.html new file mode 100644 index 0000000..a10a4d1 --- /dev/null +++ b/ue3/doxygen/classCDatT-members.html @@ -0,0 +1,48 @@ + + +mycpu: Member List + + + + + + +

CDatT< T > Member List

This is the complete list of members for CDatT< T >, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + +
CDatT()CDatT< T > [inline]
CDatT(const CDatT &other)CDatT< T > [inline]
CDatT(T newval)CDatT< T > [inline]
getValue() const CDatT< T > [inline]
operator &=(const CDatT &x)CDatT< T > [inline]
operator *=(const CDatT &x)CDatT< T > [inline]
operator T()CDatT< T > [inline]
operator%=(const CDatT &x)CDatT< T > [inline]
operator++()CDatT< T > [inline]
operator+=(const CDatT &x)CDatT< T > [inline]
operator--()CDatT< T > [inline]
operator-=(const CDatT &x)CDatT< T > [inline]
operator/=(const CDatT &x)CDatT< T > [inline]
operator<(const CDatT &x) const CDatT< T > [inline]
operator<<(std::ostream &stream, CDatT cdat)CDatT< T > [friend]
operator==(const CDatT &x) const CDatT< T > [inline]
operator>>(std::istream &stream, CDatT &cdat)CDatT< T > [friend]
operator^=(const CDatT &x)CDatT< T > [inline]
operator|=(const CDatT &x)CDatT< T > [inline]
~CDatT()CDatT< T > [inline]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDatT.html b/ue3/doxygen/classCDatT.html new file mode 100644 index 0000000..017eda0 --- /dev/null +++ b/ue3/doxygen/classCDatT.html @@ -0,0 +1,879 @@ + + +mycpu: CDatT< T > Class Template Reference + + + + + + +

CDatT< T > Class Template Reference

#include <cdat.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CDatT ()
 Default ctor.
 ~CDatT ()
 Default dtor.
 CDatT (const CDatT &other)
 Copy constructor for CDatT.
 CDatT (T newval)
 Copy constructor for int.
getValue () const
 returns value of CDatT
 operator T ()
 convert to T
bool operator< (const CDatT &x) const
 implementation of operator <
bool operator== (const CDatT &x) const
 implementation of operator ==
CDatToperator+= (const CDatT &x)
 implementation of operator +=
CDatToperator-= (const CDatT &x)
 implementation of operator -=
CDatToperator *= (const CDatT &x)
 implementation of operator *=
CDatToperator/= (const CDatT &x)
 implementation of operator /=
CDatToperator%= (const CDatT &x)
 implementation of operator %=
CDatToperator|= (const CDatT &x)
 implementation of operator |=
CDatToperator &= (const CDatT &x)
 implementation of operator &=
CDatToperator^= (const CDatT &x)
 implementation of operator ^=
CDatToperator++ ()
 implementation of operator ++
CDatToperator-- ()
 implementation of operator --

Friends

std::ostream & operator<< (std::ostream &stream, CDatT cdat)
 Shift/output operator for outputstream.
std::istream & operator>> (std::istream &stream, CDatT &cdat)
 Shift/read operator for inputstream.
+


Detailed Description

+

template<class T>
+ class CDatT< T >

+ +Datatype template for CCPU and CMem.

Constructor & Destructor Documentation

+ +
+
+
+template<class T>
+ + + + + + + + +
CDatT< T >::CDatT (  )  [inline]
+
+
+ +

+Default ctor. +

+

Methodname:
CDatT
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
bad_alloc 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + +
CDatT< T >::~CDatT (  )  [inline]
+
+
+ +

+Default dtor. +

+

Methodname:
~CDatT
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT< T >::CDatT (const CDatT< T > &  other  )  [inline]
+
+
+ +

+Copy constructor for CDatT. +

+

Methodname:
CDatT
+
Parameters:
+ + +
other reference to CDatT which will be copied
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT< T >::CDatT ( newval  )  [inline]
+
+
+ +

+Copy constructor for int. +

+

Methodname:
CDatT
+
Parameters:
+ + +
newval new value for CDatT
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Function Documentation

+ +
+
+
+template<class T>
+ + + + + + + + +
T CDatT< T >::getValue (  )  const [inline]
+
+
+ +

+returns value of CDatT +

+

Methodname:
getValue
+
Parameters:
+ + +
- 
+
+
Returns:
value of CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + +
CDatT< T >::operator T (  )  [inline]
+
+
+ +

+convert to T +

+

Methodname:
operator T
+
Parameters:
+ + +
- 
+
+
Returns:
T
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
bool CDatT< T >::operator< (const CDatT< T > &  x  )  const [inline]
+
+
+ +

+implementation of operator < +

+

Methodname:
operator<
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
true if cdat is less than object x
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
bool CDatT< T >::operator== (const CDatT< T > &  x  )  const [inline]
+
+
+ +

+implementation of operator == +

+

Methodname:
operator==
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
true if cdat equals object x
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator+= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator += +

+

Methodname:
operator+=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator-= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator -= +

+

Methodname:
operator-=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator *= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator *= +

+

Methodname:
operator*=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator/= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator /= +

+

Methodname:
operator/=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator%= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator %= +

+

Methodname:
operator%=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator|= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator |= +

+

Methodname:
operator|=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator &= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator &= +

+

Methodname:
operator&=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
CDatT& CDatT< T >::operator^= (const CDatT< T > &  x  )  [inline]
+
+
+ +

+implementation of operator ^= +

+

Methodname:
operator^=
+
Parameters:
+ + +
x reference to CDatT
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + +
CDatT& CDatT< T >::operator++ (  )  [inline]
+
+
+ +

+implementation of operator ++ +

+

Methodname:
operator++
+
Parameters:
+ + +
- 
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + +
CDatT& CDatT< T >::operator-- (  )  [inline]
+
+
+ +

+implementation of operator -- +

+

Methodname:
operator--
+
Parameters:
+ + +
- 
+
+
Returns:
refecence to CDatT
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Friends And Related Function Documentation

+ +
+
+
+template<class T>
+ + + + + + + + + + + + + + + + + + +
std::ostream& operator<< (std::ostream &  stream,
CDatT< T >  cdat 
) [friend]
+
+
+ +

+Shift/output operator for outputstream. +

+

Methodname:
operator<<
+
Parameters:
+ + + +
stream reference to outputstream
cdat object which will be printed to stream
+
+
Returns:
reference to outputstream
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + + + + + + + + + + +
std::istream& operator>> (std::istream &  stream,
CDatT< T > &  cdat 
) [friend]
+
+
+ +

+Shift/read operator for inputstream. +

+

Methodname:
operator>>
+
Parameters:
+ + + +
stream reference to inputstream
cdat reference to object which will be read from stream
+
+
Returns:
reference to inputstream
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplay.html b/ue3/doxygen/classCDisplay.html new file mode 100644 index 0000000..90ab9c9 --- /dev/null +++ b/ue3/doxygen/classCDisplay.html @@ -0,0 +1,45 @@ + + +mycpu: CDisplay Class Reference + + + + + + +

CDisplay Class Reference

#include <cdisplay.h> +

+

+Inheritance diagram for CDisplay:
+
+ +

+ +CDisplayWDEZ +CDisplayWHEX + +
+ + +
+

Detailed Description

+Memory definition for CCPU
The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplay.png b/ue3/doxygen/classCDisplay.png new file mode 100644 index 0000000..6aee098 Binary files /dev/null and b/ue3/doxygen/classCDisplay.png differ diff --git a/ue3/doxygen/classCDisplayT-members.html b/ue3/doxygen/classCDisplayT-members.html new file mode 100644 index 0000000..248f8bd --- /dev/null +++ b/ue3/doxygen/classCDisplayT-members.html @@ -0,0 +1,33 @@ + + +mycpu: Member List + + + + + + +

CDisplayT< T > Member List

This is the complete list of members for CDisplayT< T >, including all inherited members.

+ + + + + +
CDisplayT(std::string name)CDisplayT< T > [inline]
display(const T &value)=0CDisplayT< T > [pure virtual]
getName()CDisplayT< T > [inline, virtual]
m_nameCDisplayT< T > [protected]
~CDisplayT()CDisplayT< T > [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplayT.html b/ue3/doxygen/classCDisplayT.html new file mode 100644 index 0000000..e837e43 --- /dev/null +++ b/ue3/doxygen/classCDisplayT.html @@ -0,0 +1,227 @@ + + +mycpu: CDisplayT< T > Class Template Reference + + + + + + +

CDisplayT< T > Class Template Reference

#include <cdisplay.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + +

Public Member Functions

 CDisplayT (std::string name)
 Default ctor.
virtual ~CDisplayT ()
 Default dtor.
virtual const
+std::string & 
getName ()
 returns name of display
virtual void display (const T &value)=0
 prints value to display

Protected Attributes

std::string m_name
+


Detailed Description

+

template<class T>
+ class CDisplayT< T >

+ +Abstract template class for displays

Constructor & Destructor Documentation

+ +
+
+
+template<class T>
+ + + + + + + + + +
CDisplayT< T >::CDisplayT (std::string  name  )  [inline]
+
+
+ +

+Default ctor. +

+

Methodname:
CDisplayT
+
Parameters:
+ + +
name name of display
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + +
virtual CDisplayT< T >::~CDisplayT (  )  [inline, virtual]
+
+
+ +

+Default dtor. +

+

Methodname:
~CDisplayT
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Function Documentation

+ +
+
+
+template<class T>
+ + + + + + + + +
virtual const std::string& CDisplayT< T >::getName (  )  [inline, virtual]
+
+
+ +

+returns name of display +

+

Methodname:
getName
+
Parameters:
+ + +
- 
+
+
Returns:
name of display
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+
+template<class T>
+ + + + + + + + + +
virtual void CDisplayT< T >::display (const T &  value  )  [pure virtual]
+
+
+ +

+prints value to display +

+

Methodname:
display
+
Parameters:
+ + +
value value to display
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Data Documentation

+ +
+
+
+template<class T>
+ + + + +
std::string CDisplayT< T >::m_name [protected]
+
+
+ +

+name of display +

+

+


The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplayWDEZ-members.html b/ue3/doxygen/classCDisplayWDEZ-members.html new file mode 100644 index 0000000..eadb3c0 --- /dev/null +++ b/ue3/doxygen/classCDisplayWDEZ-members.html @@ -0,0 +1,30 @@ + + +mycpu: Member List + + + + + + +

CDisplayWDEZ Member List

This is the complete list of members for CDisplayWDEZ, including all inherited members.

+ + +
CDisplayWDEZ() (defined in CDisplayWDEZ)CDisplayWDEZ [inline]
display(const CDat &value)CDisplayWDEZ [inline]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplayWDEZ.html b/ue3/doxygen/classCDisplayWDEZ.html new file mode 100644 index 0000000..dfc9ae9 --- /dev/null +++ b/ue3/doxygen/classCDisplayWDEZ.html @@ -0,0 +1,87 @@ + + +mycpu: CDisplayWDEZ Class Reference + + + + + + +

CDisplayWDEZ Class Reference

#include <displays.h> +

+

+Inheritance diagram for CDisplayWDEZ:
+
+ +

+ +CDisplay + +
+ +

+List of all members. + + + + + +

Public Member Functions

void display (const CDat &value)
 prints value to display
+


Detailed Description

+Implementation of CDisplay Prints CDat to stdout as decimal

Member Function Documentation

+ +
+
+ + + + + + + + + +
void CDisplayWDEZ::display (const CDat value  )  [inline]
+
+
+ +

+prints value to display +

+

Methodname:
display
+
Parameters:
+ + +
value value to display
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplayWDEZ.png b/ue3/doxygen/classCDisplayWDEZ.png new file mode 100644 index 0000000..10fe751 Binary files /dev/null and b/ue3/doxygen/classCDisplayWDEZ.png differ diff --git a/ue3/doxygen/classCDisplayWHEX-members.html b/ue3/doxygen/classCDisplayWHEX-members.html new file mode 100644 index 0000000..d00d3bc --- /dev/null +++ b/ue3/doxygen/classCDisplayWHEX-members.html @@ -0,0 +1,30 @@ + + +mycpu: Member List + + + + + + +

CDisplayWHEX Member List

This is the complete list of members for CDisplayWHEX, including all inherited members.

+ + +
CDisplayWHEX() (defined in CDisplayWHEX)CDisplayWHEX [inline]
display(const CDat &value)CDisplayWHEX [inline]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplayWHEX.html b/ue3/doxygen/classCDisplayWHEX.html new file mode 100644 index 0000000..bc2d8f1 --- /dev/null +++ b/ue3/doxygen/classCDisplayWHEX.html @@ -0,0 +1,87 @@ + + +mycpu: CDisplayWHEX Class Reference + + + + + + +

CDisplayWHEX Class Reference

#include <displays.h> +

+

+Inheritance diagram for CDisplayWHEX:
+
+ +

+ +CDisplay + +
+ +

+List of all members. + + + + + +

Public Member Functions

void display (const CDat &value)
 prints value to display
+


Detailed Description

+Implementation of CDisplay Prints CDat to stdout as decimal

Member Function Documentation

+ +
+
+ + + + + + + + + +
void CDisplayWHEX::display (const CDat value  )  [inline]
+
+
+ +

+prints value to display +

+

Methodname:
display
+
Parameters:
+ + +
value value to display
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCDisplayWHEX.png b/ue3/doxygen/classCDisplayWHEX.png new file mode 100644 index 0000000..67b90b6 Binary files /dev/null and b/ue3/doxygen/classCDisplayWHEX.png differ diff --git a/ue3/doxygen/classCInstruction-members.html b/ue3/doxygen/classCInstruction-members.html new file mode 100644 index 0000000..e22ff7f --- /dev/null +++ b/ue3/doxygen/classCInstruction-members.html @@ -0,0 +1,41 @@ + + +mycpu: Member List + + + + + + +

CInstruction Member List

This is the complete list of members for CInstruction, including all inherited members.

+ + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
compile(std::list< std::string > &params)=0CInstruction [pure virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)=0CInstruction [pure virtual]
factory()=0CInstruction [pure virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstruction.html b/ue3/doxygen/classCInstruction.html new file mode 100644 index 0000000..052da01 --- /dev/null +++ b/ue3/doxygen/classCInstruction.html @@ -0,0 +1,575 @@ + + +mycpu: CInstruction Class Reference + + + + + + +

CInstruction Class Reference

#include <cinstruction.h> +

+

+Inheritance diagram for CInstruction:
+
+ +

+ +CInstructionAdd +CInstructionDec +CInstructionDiv +CInstructionInc +CInstructionJumpA +CInstructionJumpS +CInstructionJumpZ +CInstructionLabel +CInstructionLoad +CInstructionMul +CInstructionStore +CInstructionSub +CInstructionTest +CInstructionWrite + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CInstruction (std::string name)
 Default ctor.
virtual ~CInstruction ()
 Default dtor.
virtual bool operator== (std::string &name)
 implementation of operator ==
virtual CInstructionoperator() (CCPU *cpu)
 implementation of operator (CCPU)
virtual const
+std::string & 
getName ()
 returns instruction name
virtual std::ostream & dump (std::ostream &stream)
 dumps information about instruction to outputstream
virtual const unsigned parseRegister (const std::string &str)
 parses register syntax Rx (e.g. "R1")
virtual void checkRegister (CCPU *cpu, const unsigned regidx)
 performs a register boundary check does the register exist in cpu?
virtual CInstructionfactory ()=0
 creates a new instance of this instruction
virtual void compile (std::list< std::string > &params)=0
 parses instruction parameters and prepares the instruction for executing
virtual void execute (CCPU *cpu)=0
 executes the instruction

Protected Attributes

std::string m_name

Friends

std::ostream & operator<< (std::ostream &stream, CInstruction &instr)
 Shift/output operator for outputstream.
+


Detailed Description

+Abstract class for displays

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + +
CInstruction::CInstruction (std::string  name  )  [inline]
+
+
+ +

+Default ctor. +

+

Methodname:
CInstruction
+
Parameters:
+ + +
name name of instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
virtual CInstruction::~CInstruction (  )  [inline, virtual]
+
+
+ +

+Default dtor. +

+

Methodname:
~CInstruction
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
virtual bool CInstruction::operator== (std::string &  name  )  [inline, virtual]
+
+
+ +

+implementation of operator == +

+

Methodname:
operator==
+
Parameters:
+ + +
name reference to std::string
+
+
Returns:
true if instructionname is name
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
virtual CInstruction& CInstruction::operator() (CCPU cpu  )  [inline, virtual]
+
+
+ +

+implementation of operator (CCPU) +

+

Methodname:
operator()
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
virtual const std::string& CInstruction::getName (  )  [inline, virtual]
+
+
+ +

+returns instruction name +

+

Methodname:
getName
+
Parameters:
+ + +
- 
+
+
Returns:
name of instruction
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
virtual std::ostream& CInstruction::dump (std::ostream &  stream  )  [inline, virtual]
+
+
+ +

+dumps information about instruction to outputstream +

+

Methodname:
dump
+
Parameters:
+ + +
stream outputstream
+
+
Returns:
reference to outputstream
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
const unsigned CInstruction::parseRegister (const std::string &  str  )  [virtual]
+
+
+ +

+parses register syntax Rx (e.g. "R1") +

+

Methodname:
parseRegister
+
Parameters:
+ + +
str register in assembler syntax
+
+
Returns:
registernumber
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
void CInstruction::checkRegister (CCPU cpu,
const unsigned  regidx 
) [inline, virtual]
+
+
+ +

+performs a register boundary check does the register exist in cpu? +

+

Methodname:
checkRegister
+
Parameters:
+ + + +
cpu pointer to cpu
regidx registernumber
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
virtual CInstruction* CInstruction::factory (  )  [pure virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implemented in CInstructionInc, CInstructionDec, CInstructionAdd, CInstructionSub, CInstructionMul, CInstructionDiv, CInstructionLoad, CInstructionStore, CInstructionTest, CInstructionLabel, CInstructionJumpA, CInstructionJumpZ, CInstructionJumpS, and CInstructionWrite.

+ +
+

+ +

+
+ + + + + + + + + +
virtual void CInstruction::compile (std::list< std::string > &  params  )  [pure virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implemented in CInstructionInc, CInstructionDec, CInstructionAdd, CInstructionSub, CInstructionMul, CInstructionDiv, CInstructionLoad, CInstructionStore, CInstructionTest, CInstructionLabel, CInstructionJumpA, CInstructionJumpZ, CInstructionJumpS, and CInstructionWrite.

+ +
+

+ +

+
+ + + + + + + + + +
virtual void CInstruction::execute (CCPU cpu  )  [pure virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implemented in CInstructionInc, CInstructionDec, CInstructionAdd, CInstructionSub, CInstructionMul, CInstructionDiv, CInstructionLoad, CInstructionStore, CInstructionTest, CInstructionLabel, CInstructionJumpA, CInstructionJumpZ, CInstructionJumpS, and CInstructionWrite.

+ +
+

+


Friends And Related Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
std::ostream& operator<< (std::ostream &  stream,
CInstruction instr 
) [friend]
+
+
+ +

+Shift/output operator for outputstream. +

+

Methodname:
operator<<
+
Parameters:
+ + + +
stream reference to outputstream
instr object which will be printed to stream
+
+
Returns:
reference to outputstream
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
std::string CInstruction::m_name [protected]
+
+
+ +

+name of instruction +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstruction.png b/ue3/doxygen/classCInstruction.png new file mode 100644 index 0000000..e04bf41 Binary files /dev/null and b/ue3/doxygen/classCInstruction.png differ diff --git a/ue3/doxygen/classCInstructionAdd-members.html b/ue3/doxygen/classCInstructionAdd-members.html new file mode 100644 index 0000000..c53ae2e --- /dev/null +++ b/ue3/doxygen/classCInstructionAdd-members.html @@ -0,0 +1,45 @@ + + +mycpu: Member List + + + + + + +

CInstructionAdd Member List

This is the complete list of members for CInstructionAdd, including all inherited members.

+ + + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionAdd() (defined in CInstructionAdd)CInstructionAdd [inline]
compile(std::list< std::string > &params)CInstructionAdd [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionAdd [virtual]
factory()CInstructionAdd [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionAdd [protected]
m_regidx2CInstructionAdd [protected]
m_regidx3CInstructionAdd [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionAdd.html b/ue3/doxygen/classCInstructionAdd.html new file mode 100644 index 0000000..a659978 --- /dev/null +++ b/ue3/doxygen/classCInstructionAdd.html @@ -0,0 +1,223 @@ + + +mycpu: CInstructionAdd Class Reference + + + + + + +

CInstructionAdd Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionAdd:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionAddfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
unsigned m_regidx2
unsigned m_regidx3
+


Detailed Description

+Implementation of assembler command "add" Syntax: add R1, R2, R3 (R1 = R2 + R3)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionAdd* CInstructionAdd::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionAdd::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionAdd::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionAdd::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionAdd::m_regidx2 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionAdd::m_regidx3 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionAdd.png b/ue3/doxygen/classCInstructionAdd.png new file mode 100644 index 0000000..02a7e9c Binary files /dev/null and b/ue3/doxygen/classCInstructionAdd.png differ diff --git a/ue3/doxygen/classCInstructionDec-members.html b/ue3/doxygen/classCInstructionDec-members.html new file mode 100644 index 0000000..f177e69 --- /dev/null +++ b/ue3/doxygen/classCInstructionDec-members.html @@ -0,0 +1,43 @@ + + +mycpu: Member List + + + + + + +

CInstructionDec Member List

This is the complete list of members for CInstructionDec, including all inherited members.

+ + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionDec() (defined in CInstructionDec)CInstructionDec [inline]
compile(std::list< std::string > &params)CInstructionDec [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionDec [virtual]
factory()CInstructionDec [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionDec [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionDec.html b/ue3/doxygen/classCInstructionDec.html new file mode 100644 index 0000000..b32ffa7 --- /dev/null +++ b/ue3/doxygen/classCInstructionDec.html @@ -0,0 +1,189 @@ + + +mycpu: CInstructionDec Class Reference + + + + + + +

CInstructionDec Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionDec:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

CInstructionDecfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
+


Detailed Description

+Implementation of assembler command "dec" Syntax: dec R1 (R1--)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionDec* CInstructionDec::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionDec::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionDec::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionDec::m_regidx1 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionDec.png b/ue3/doxygen/classCInstructionDec.png new file mode 100644 index 0000000..9cf686c Binary files /dev/null and b/ue3/doxygen/classCInstructionDec.png differ diff --git a/ue3/doxygen/classCInstructionDiv-members.html b/ue3/doxygen/classCInstructionDiv-members.html new file mode 100644 index 0000000..57ac77e --- /dev/null +++ b/ue3/doxygen/classCInstructionDiv-members.html @@ -0,0 +1,45 @@ + + +mycpu: Member List + + + + + + +

CInstructionDiv Member List

This is the complete list of members for CInstructionDiv, including all inherited members.

+ + + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionDiv() (defined in CInstructionDiv)CInstructionDiv [inline]
compile(std::list< std::string > &params)CInstructionDiv [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionDiv [virtual]
factory()CInstructionDiv [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionDiv [protected]
m_regidx2CInstructionDiv [protected]
m_regidx3CInstructionDiv [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionDiv.html b/ue3/doxygen/classCInstructionDiv.html new file mode 100644 index 0000000..2bc0023 --- /dev/null +++ b/ue3/doxygen/classCInstructionDiv.html @@ -0,0 +1,223 @@ + + +mycpu: CInstructionDiv Class Reference + + + + + + +

CInstructionDiv Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionDiv:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionDivfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
unsigned m_regidx2
unsigned m_regidx3
+


Detailed Description

+Implementation of assembler command "div" Syntax: div R1, R2, R3 (R1 = R2 / R3)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionDiv* CInstructionDiv::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionDiv::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionDiv::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionDiv::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionDiv::m_regidx2 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionDiv::m_regidx3 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionDiv.png b/ue3/doxygen/classCInstructionDiv.png new file mode 100644 index 0000000..11ede71 Binary files /dev/null and b/ue3/doxygen/classCInstructionDiv.png differ diff --git a/ue3/doxygen/classCInstructionInc-members.html b/ue3/doxygen/classCInstructionInc-members.html new file mode 100644 index 0000000..5d66408 --- /dev/null +++ b/ue3/doxygen/classCInstructionInc-members.html @@ -0,0 +1,43 @@ + + +mycpu: Member List + + + + + + +

CInstructionInc Member List

This is the complete list of members for CInstructionInc, including all inherited members.

+ + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionInc() (defined in CInstructionInc)CInstructionInc [inline]
compile(std::list< std::string > &params)CInstructionInc [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionInc [virtual]
factory()CInstructionInc [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionInc [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionInc.html b/ue3/doxygen/classCInstructionInc.html new file mode 100644 index 0000000..4756c23 --- /dev/null +++ b/ue3/doxygen/classCInstructionInc.html @@ -0,0 +1,189 @@ + + +mycpu: CInstructionInc Class Reference + + + + + + +

CInstructionInc Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionInc:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

CInstructionIncfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
+


Detailed Description

+Implementation of assembler command "inc" Syntax: inc R1 (R1++)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionInc* CInstructionInc::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionInc::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionInc::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionInc::m_regidx1 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionInc.png b/ue3/doxygen/classCInstructionInc.png new file mode 100644 index 0000000..8954718 Binary files /dev/null and b/ue3/doxygen/classCInstructionInc.png differ diff --git a/ue3/doxygen/classCInstructionJumpA-members.html b/ue3/doxygen/classCInstructionJumpA-members.html new file mode 100644 index 0000000..023a9a7 --- /dev/null +++ b/ue3/doxygen/classCInstructionJumpA-members.html @@ -0,0 +1,43 @@ + + +mycpu: Member List + + + + + + +

CInstructionJumpA Member List

This is the complete list of members for CInstructionJumpA, including all inherited members.

+ + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionJumpA() (defined in CInstructionJumpA)CInstructionJumpA [inline]
compile(std::list< std::string > &params)CInstructionJumpA [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionJumpA [virtual]
factory()CInstructionJumpA [inline, virtual]
getName()CInstruction [inline, virtual]
m_addrCInstructionJumpA [protected]
m_nameCInstruction [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionJumpA.html b/ue3/doxygen/classCInstructionJumpA.html new file mode 100644 index 0000000..edd2e4b --- /dev/null +++ b/ue3/doxygen/classCInstructionJumpA.html @@ -0,0 +1,189 @@ + + +mycpu: CInstructionJumpA Class Reference + + + + + + +

CInstructionJumpA Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionJumpA:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

CInstructionJumpAfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

std::string m_addr
+


Detailed Description

+Implementation of assembler command "jumpa" Syntax: jumpa labelname (jump to labelname)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionJumpA* CInstructionJumpA::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionJumpA::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionJumpA::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
std::string CInstructionJumpA::m_addr [protected]
+
+
+ +

+labelname +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionJumpA.png b/ue3/doxygen/classCInstructionJumpA.png new file mode 100644 index 0000000..48998d1 Binary files /dev/null and b/ue3/doxygen/classCInstructionJumpA.png differ diff --git a/ue3/doxygen/classCInstructionJumpS-members.html b/ue3/doxygen/classCInstructionJumpS-members.html new file mode 100644 index 0000000..4ccefd9 --- /dev/null +++ b/ue3/doxygen/classCInstructionJumpS-members.html @@ -0,0 +1,43 @@ + + +mycpu: Member List + + + + + + +

CInstructionJumpS Member List

This is the complete list of members for CInstructionJumpS, including all inherited members.

+ + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionJumpS() (defined in CInstructionJumpS)CInstructionJumpS [inline]
compile(std::list< std::string > &params)CInstructionJumpS [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionJumpS [virtual]
factory()CInstructionJumpS [inline, virtual]
getName()CInstruction [inline, virtual]
m_addrCInstructionJumpS [protected]
m_nameCInstruction [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionJumpS.html b/ue3/doxygen/classCInstructionJumpS.html new file mode 100644 index 0000000..1a5b7a0 --- /dev/null +++ b/ue3/doxygen/classCInstructionJumpS.html @@ -0,0 +1,189 @@ + + +mycpu: CInstructionJumpS Class Reference + + + + + + +

CInstructionJumpS Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionJumpS:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

CInstructionJumpSfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

std::string m_addr
+


Detailed Description

+Implementation of assembler command "jumps" Syntax: jumps labelname (jump to labelname if signflag)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionJumpS* CInstructionJumpS::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionJumpS::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionJumpS::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
std::string CInstructionJumpS::m_addr [protected]
+
+
+ +

+labelname +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionJumpS.png b/ue3/doxygen/classCInstructionJumpS.png new file mode 100644 index 0000000..635cddb Binary files /dev/null and b/ue3/doxygen/classCInstructionJumpS.png differ diff --git a/ue3/doxygen/classCInstructionJumpZ-members.html b/ue3/doxygen/classCInstructionJumpZ-members.html new file mode 100644 index 0000000..168bc98 --- /dev/null +++ b/ue3/doxygen/classCInstructionJumpZ-members.html @@ -0,0 +1,43 @@ + + +mycpu: Member List + + + + + + +

CInstructionJumpZ Member List

This is the complete list of members for CInstructionJumpZ, including all inherited members.

+ + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionJumpZ() (defined in CInstructionJumpZ)CInstructionJumpZ [inline]
compile(std::list< std::string > &params)CInstructionJumpZ [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionJumpZ [virtual]
factory()CInstructionJumpZ [inline, virtual]
getName()CInstruction [inline, virtual]
m_addrCInstructionJumpZ [protected]
m_nameCInstruction [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionJumpZ.html b/ue3/doxygen/classCInstructionJumpZ.html new file mode 100644 index 0000000..a8bb339 --- /dev/null +++ b/ue3/doxygen/classCInstructionJumpZ.html @@ -0,0 +1,189 @@ + + +mycpu: CInstructionJumpZ Class Reference + + + + + + +

CInstructionJumpZ Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionJumpZ:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

CInstructionJumpZfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

std::string m_addr
+


Detailed Description

+Implementation of assembler command "jumpz" Syntax: jumpz labelname (jump to labelname if zeroflag)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionJumpZ* CInstructionJumpZ::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionJumpZ::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionJumpZ::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
std::string CInstructionJumpZ::m_addr [protected]
+
+
+ +

+labelname +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionJumpZ.png b/ue3/doxygen/classCInstructionJumpZ.png new file mode 100644 index 0000000..4840f60 Binary files /dev/null and b/ue3/doxygen/classCInstructionJumpZ.png differ diff --git a/ue3/doxygen/classCInstructionLabel-members.html b/ue3/doxygen/classCInstructionLabel-members.html new file mode 100644 index 0000000..3933096 --- /dev/null +++ b/ue3/doxygen/classCInstructionLabel-members.html @@ -0,0 +1,42 @@ + + +mycpu: Member List + + + + + + +

CInstructionLabel Member List

This is the complete list of members for CInstructionLabel, including all inherited members.

+ + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionLabel() (defined in CInstructionLabel)CInstructionLabel [inline]
compile(std::list< std::string > &params)CInstructionLabel [inline, virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionLabel [inline, virtual]
factory()CInstructionLabel [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionLabel.html b/ue3/doxygen/classCInstructionLabel.html new file mode 100644 index 0000000..e6994be --- /dev/null +++ b/ue3/doxygen/classCInstructionLabel.html @@ -0,0 +1,170 @@ + + +mycpu: CInstructionLabel Class Reference + + + + + + +

CInstructionLabel Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionLabel:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + +

Public Member Functions

CInstructionLabelfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction
+


Detailed Description

+Implementation of assembler command "label" Syntax: label name:

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionLabel* CInstructionLabel::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionLabel::compile (std::list< std::string > &  params  )  [inline, virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionLabel::execute (CCPU cpu  )  [inline, virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionLabel.png b/ue3/doxygen/classCInstructionLabel.png new file mode 100644 index 0000000..2725289 Binary files /dev/null and b/ue3/doxygen/classCInstructionLabel.png differ diff --git a/ue3/doxygen/classCInstructionLoad-members.html b/ue3/doxygen/classCInstructionLoad-members.html new file mode 100644 index 0000000..8786246 --- /dev/null +++ b/ue3/doxygen/classCInstructionLoad-members.html @@ -0,0 +1,44 @@ + + +mycpu: Member List + + + + + + +

CInstructionLoad Member List

This is the complete list of members for CInstructionLoad, including all inherited members.

+ + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionLoad() (defined in CInstructionLoad)CInstructionLoad [inline]
compile(std::list< std::string > &params)CInstructionLoad [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionLoad [virtual]
factory()CInstructionLoad [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionLoad [protected]
m_regidx2CInstructionLoad [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionLoad.html b/ue3/doxygen/classCInstructionLoad.html new file mode 100644 index 0000000..83bbcc2 --- /dev/null +++ b/ue3/doxygen/classCInstructionLoad.html @@ -0,0 +1,206 @@ + + +mycpu: CInstructionLoad Class Reference + + + + + + +

CInstructionLoad Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionLoad:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionLoadfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
unsigned m_regidx2
+


Detailed Description

+Implementation of assembler command "load" Syntax: load R1, R2 (R1 = memory[R2])

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionLoad* CInstructionLoad::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionLoad::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionLoad::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionLoad::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionLoad::m_regidx2 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionLoad.png b/ue3/doxygen/classCInstructionLoad.png new file mode 100644 index 0000000..45fe9bf Binary files /dev/null and b/ue3/doxygen/classCInstructionLoad.png differ diff --git a/ue3/doxygen/classCInstructionMul-members.html b/ue3/doxygen/classCInstructionMul-members.html new file mode 100644 index 0000000..cb1ade9 --- /dev/null +++ b/ue3/doxygen/classCInstructionMul-members.html @@ -0,0 +1,45 @@ + + +mycpu: Member List + + + + + + +

CInstructionMul Member List

This is the complete list of members for CInstructionMul, including all inherited members.

+ + + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionMul() (defined in CInstructionMul)CInstructionMul [inline]
compile(std::list< std::string > &params)CInstructionMul [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionMul [virtual]
factory()CInstructionMul [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionMul [protected]
m_regidx2CInstructionMul [protected]
m_regidx3CInstructionMul [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionMul.html b/ue3/doxygen/classCInstructionMul.html new file mode 100644 index 0000000..7f7bdd9 --- /dev/null +++ b/ue3/doxygen/classCInstructionMul.html @@ -0,0 +1,223 @@ + + +mycpu: CInstructionMul Class Reference + + + + + + +

CInstructionMul Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionMul:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionMulfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
unsigned m_regidx2
unsigned m_regidx3
+


Detailed Description

+Implementation of assembler command "mul" Syntax: mul R1, R2, R3 (R1 = R2 * R3)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionMul* CInstructionMul::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionMul::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionMul::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionMul::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionMul::m_regidx2 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionMul::m_regidx3 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionMul.png b/ue3/doxygen/classCInstructionMul.png new file mode 100644 index 0000000..f300a09 Binary files /dev/null and b/ue3/doxygen/classCInstructionMul.png differ diff --git a/ue3/doxygen/classCInstructionStore-members.html b/ue3/doxygen/classCInstructionStore-members.html new file mode 100644 index 0000000..d06efb9 --- /dev/null +++ b/ue3/doxygen/classCInstructionStore-members.html @@ -0,0 +1,44 @@ + + +mycpu: Member List + + + + + + +

CInstructionStore Member List

This is the complete list of members for CInstructionStore, including all inherited members.

+ + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionStore() (defined in CInstructionStore)CInstructionStore [inline]
compile(std::list< std::string > &params)CInstructionStore [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionStore [virtual]
factory()CInstructionStore [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionStore [protected]
m_regidx2CInstructionStore [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionStore.html b/ue3/doxygen/classCInstructionStore.html new file mode 100644 index 0000000..f2d0133 --- /dev/null +++ b/ue3/doxygen/classCInstructionStore.html @@ -0,0 +1,206 @@ + + +mycpu: CInstructionStore Class Reference + + + + + + +

CInstructionStore Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionStore:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionStorefactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
unsigned m_regidx2
+


Detailed Description

+Implementation of assembler command "store" Syntax: store R1, R2 (memory[R2] = R1)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionStore* CInstructionStore::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionStore::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionStore::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionStore::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionStore::m_regidx2 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionStore.png b/ue3/doxygen/classCInstructionStore.png new file mode 100644 index 0000000..b368340 Binary files /dev/null and b/ue3/doxygen/classCInstructionStore.png differ diff --git a/ue3/doxygen/classCInstructionSub-members.html b/ue3/doxygen/classCInstructionSub-members.html new file mode 100644 index 0000000..4908357 --- /dev/null +++ b/ue3/doxygen/classCInstructionSub-members.html @@ -0,0 +1,45 @@ + + +mycpu: Member List + + + + + + +

CInstructionSub Member List

This is the complete list of members for CInstructionSub, including all inherited members.

+ + + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionSub() (defined in CInstructionSub)CInstructionSub [inline]
compile(std::list< std::string > &params)CInstructionSub [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionSub [virtual]
factory()CInstructionSub [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionSub [protected]
m_regidx2CInstructionSub [protected]
m_regidx3CInstructionSub [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionSub.html b/ue3/doxygen/classCInstructionSub.html new file mode 100644 index 0000000..669d6bb --- /dev/null +++ b/ue3/doxygen/classCInstructionSub.html @@ -0,0 +1,223 @@ + + +mycpu: CInstructionSub Class Reference + + + + + + +

CInstructionSub Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionSub:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionSubfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
unsigned m_regidx2
unsigned m_regidx3
+


Detailed Description

+Implementation of assembler command "sub" Syntax: sub R1, R2, R3 (R1 = R2 - R3)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionSub* CInstructionSub::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionSub::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionSub::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionSub::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionSub::m_regidx2 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
unsigned CInstructionSub::m_regidx3 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionSub.png b/ue3/doxygen/classCInstructionSub.png new file mode 100644 index 0000000..a618537 Binary files /dev/null and b/ue3/doxygen/classCInstructionSub.png differ diff --git a/ue3/doxygen/classCInstructionTest-members.html b/ue3/doxygen/classCInstructionTest-members.html new file mode 100644 index 0000000..8da9434 --- /dev/null +++ b/ue3/doxygen/classCInstructionTest-members.html @@ -0,0 +1,43 @@ + + +mycpu: Member List + + + + + + +

CInstructionTest Member List

This is the complete list of members for CInstructionTest, including all inherited members.

+ + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionTest() (defined in CInstructionTest)CInstructionTest [inline]
compile(std::list< std::string > &params)CInstructionTest [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionTest [virtual]
factory()CInstructionTest [inline, virtual]
getName()CInstruction [inline, virtual]
m_nameCInstruction [protected]
m_regidx1CInstructionTest [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionTest.html b/ue3/doxygen/classCInstructionTest.html new file mode 100644 index 0000000..fdb87d8 --- /dev/null +++ b/ue3/doxygen/classCInstructionTest.html @@ -0,0 +1,189 @@ + + +mycpu: CInstructionTest Class Reference + + + + + + +

CInstructionTest Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionTest:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

CInstructionTestfactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
+


Detailed Description

+Implementation of assembler command "test" Syntax: test R1 (R1 == 0: zeroflag: true, R1 < 0: signflag: true)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionTest* CInstructionTest::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionTest::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionTest::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionTest::m_regidx1 [protected]
+
+
+ +

+register number +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionTest.png b/ue3/doxygen/classCInstructionTest.png new file mode 100644 index 0000000..c91fec4 Binary files /dev/null and b/ue3/doxygen/classCInstructionTest.png differ diff --git a/ue3/doxygen/classCInstructionWrite-members.html b/ue3/doxygen/classCInstructionWrite-members.html new file mode 100644 index 0000000..63a0154 --- /dev/null +++ b/ue3/doxygen/classCInstructionWrite-members.html @@ -0,0 +1,44 @@ + + +mycpu: Member List + + + + + + +

CInstructionWrite Member List

This is the complete list of members for CInstructionWrite, including all inherited members.

+ + + + + + + + + + + + + + + + +
checkRegister(CCPU *cpu, const unsigned regidx)CInstruction [inline, virtual]
CInstruction(std::string name)CInstruction [inline]
CInstructionWrite() (defined in CInstructionWrite)CInstructionWrite [inline]
compile(std::list< std::string > &params)CInstructionWrite [virtual]
dump(std::ostream &stream)CInstruction [inline, virtual]
execute(CCPU *cpu)CInstructionWrite [virtual]
factory()CInstructionWrite [inline, virtual]
getName()CInstruction [inline, virtual]
m_devCInstructionWrite [protected]
m_nameCInstruction [protected]
m_regidx1CInstructionWrite [protected]
operator()(CCPU *cpu)CInstruction [inline, virtual]
operator<<(std::ostream &stream, CInstruction &instr)CInstruction [friend]
operator==(std::string &name)CInstruction [inline, virtual]
parseRegister(const std::string &str)CInstruction [virtual]
~CInstruction()CInstruction [inline, virtual]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionWrite.html b/ue3/doxygen/classCInstructionWrite.html new file mode 100644 index 0000000..074667d --- /dev/null +++ b/ue3/doxygen/classCInstructionWrite.html @@ -0,0 +1,206 @@ + + +mycpu: CInstructionWrite Class Reference + + + + + + +

CInstructionWrite Class Reference

#include <instructions.h> +

+

+Inheritance diagram for CInstructionWrite:
+
+ +

+ +CInstruction + +
+ +

+List of all members. + + + + + + + + + + + + + + + + +

Public Member Functions

CInstructionWritefactory ()
 creates a new instance of this instruction
void compile (std::list< std::string > &params)
 parses instruction parameters and prepares the instruction for executing
void execute (CCPU *cpu)
 executes the instruction

Protected Attributes

unsigned m_regidx1
std::string m_dev
+


Detailed Description

+Implementation of assembler command "write" Syntax: write DEV, R1 (write R1 to DEV, which is a name of a display)

Member Function Documentation

+ +
+
+ + + + + + + + +
CInstructionWrite* CInstructionWrite::factory (  )  [inline, virtual]
+
+
+ +

+creates a new instance of this instruction +

+

Methodname:
factory
+
Parameters:
+ + +
- 
+
+
Returns:
new instruction instance
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionWrite::compile (std::list< std::string > &  params  )  [virtual]
+
+
+ +

+parses instruction parameters and prepares the instruction for executing +

+

Methodname:
compile
+
Parameters:
+ + +
params list of parameters of this instruction
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+ +

+
+ + + + + + + + + +
void CInstructionWrite::execute (CCPU cpu  )  [virtual]
+
+
+ +

+executes the instruction +

+

Methodname:
execute
+
Parameters:
+ + +
cpu pointer to cpu
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +

Implements CInstruction.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
unsigned CInstructionWrite::m_regidx1 [protected]
+
+
+ +

+register number +

+

+ +

+
+ + + + +
std::string CInstructionWrite::m_dev [protected]
+
+
+ +

+device name +

+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCInstructionWrite.png b/ue3/doxygen/classCInstructionWrite.png new file mode 100644 index 0000000..23bf880 Binary files /dev/null and b/ue3/doxygen/classCInstructionWrite.png differ diff --git a/ue3/doxygen/classCMem.html b/ue3/doxygen/classCMem.html new file mode 100644 index 0000000..6cc1e67 --- /dev/null +++ b/ue3/doxygen/classCMem.html @@ -0,0 +1,35 @@ + + +mycpu: CMem Class Reference + + + + + + +

CMem Class Reference

#include <cmem.h> +

+ + +
+


Detailed Description

+Memory definition for CCPU
The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCProgram-members.html b/ue3/doxygen/classCProgram-members.html new file mode 100644 index 0000000..014f9cf --- /dev/null +++ b/ue3/doxygen/classCProgram-members.html @@ -0,0 +1,33 @@ + + +mycpu: Member List + + + + + + +

CProgram Member List

This is the complete list of members for CProgram, including all inherited members.

+ + + + + +
compile(std::istream &in)CProgram
CProgram()CProgram
findLabel(const std::string &label) const CProgram
getLabels() const CProgram [inline]
~CProgram()CProgram


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCProgram.html b/ue3/doxygen/classCProgram.html new file mode 100644 index 0000000..a756aaa --- /dev/null +++ b/ue3/doxygen/classCProgram.html @@ -0,0 +1,234 @@ + + +mycpu: CProgram Class Reference + + + + + + +

CProgram Class Reference

#include <cprogram.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + +

Public Member Functions

 CProgram ()
 Default ctor.
 ~CProgram ()
 Default dtor.
const std::map
+< std::string,
+ unsigned > & 
getLabels () const
 get reference to labels map
unsigned findLabel (const std::string &label) const
 search for label
void compile (std::istream &in)
 create instructions from parsing stream
+


Detailed Description

+CProgram extends std::vector and adds a method for parsing programfile. This adds instances of CInstruction to CProgram itself.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
CProgram::CProgram (  ) 
+
+
+ +

+Default ctor. +

+

Methodname:
CProgram
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + +
CProgram::~CProgram (  ) 
+
+
+ +

+Default dtor. +

+

Methodname:
~CProgram
+
Parameters:
+ + +
- 
+
+
Returns:
-
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + +
const std::map<std::string, unsigned>& CProgram::getLabels (  )  const [inline]
+
+
+ +

+get reference to labels map +

+

Methodname:
getLabels
+
Parameters:
+ + +
- 
+
+
Returns:
reference to labels map
+
Global variables used:
none
+
Exceptions:
+ + +
none 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
unsigned CProgram::findLabel (const std::string &  label  )  const
+
+
+ +

+search for label +

+

Methodname:
findLabel
+
Parameters:
+ + +
label name of label to search for
+
+
Returns:
index of found label in program
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+ +

+
+ + + + + + + + + +
void CProgram::compile (std::istream &  in  ) 
+
+
+ +

+create instructions from parsing stream +

+

Methodname:
compile
+
Parameters:
+ + +
in inputstream to read from
+
+
Returns:
void
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+


The documentation for this class was generated from the following files: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCVectorMem-members.html b/ue3/doxygen/classCVectorMem-members.html new file mode 100644 index 0000000..30a783a --- /dev/null +++ b/ue3/doxygen/classCVectorMem-members.html @@ -0,0 +1,29 @@ + + +mycpu: Member List + + + + + + +

CVectorMem< T, Allocator > Member List

This is the complete list of members for CVectorMem< T, Allocator >, including all inherited members.

+ +
initialize(std::istream &in)CVectorMem< T, Allocator > [inline]


Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/classCVectorMem.html b/ue3/doxygen/classCVectorMem.html new file mode 100644 index 0000000..599c348 --- /dev/null +++ b/ue3/doxygen/classCVectorMem.html @@ -0,0 +1,83 @@ + + +mycpu: CVectorMem< T, Allocator > Class Template Reference + + + + + + +

CVectorMem< T, Allocator > Class Template Reference

#include <cmem.h> +

+ +

+List of all members. + + + + + +

Public Member Functions

void initialize (std::istream &in)
 initialize the vector with the content of istream. istream is read per line. empty lines will add unitialized elements.
+


Detailed Description

+

template<class T, class Allocator = std::allocator<T>>
+ class CVectorMem< T, Allocator >

+ +Extends std::vector template for use as memory for CCPU.

Member Function Documentation

+ +
+
+
+template<class T, class Allocator = std::allocator<T>>
+ + + + + + + + + +
void CVectorMem< T, Allocator >::initialize (std::istream &  in  )  [inline]
+
+
+ +

+initialize the vector with the content of istream. istream is read per line. empty lines will add unitialized elements. +

+

Methodname:
initialize
+
Parameters:
+ + +
in inputstream to read from
+
+
Returns:
void
+
Global variables used:
none
+
Exceptions:
+ + +
std::runtime_error 
+
+
Conditions:
none
+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/cmem_8h-source.html b/ue3/doxygen/cmem_8h-source.html new file mode 100644 index 0000000..6dfeef4 --- /dev/null +++ b/ue3/doxygen/cmem_8h-source.html @@ -0,0 +1,95 @@ + + +mycpu: mycpu/cmem.h Source File + + + + + +

mycpu/cmem.h

00001 
+00008 #ifndef CMEM_H
+00009 #define CMEM_H 1
+00010 
+00011 #include <vector>
+00012 #include <istream>
+00013 #include <sstream>
+00014 #include <stdexcept>
+00015 #include <boost/lexical_cast.hpp>
+00016 #ifdef DEBUG
+00017 # include <iostream>
+00018 # include <iomanip>
+00019 #endif
+00020 #include "cdat.h"
+00021 
+00027 template <class T, class Allocator=std::allocator<T> >
+00028 class CVectorMem
+00029   : public std::vector<T, Allocator>
+00030 {
+00031   public:
+00032     using std::vector<T, Allocator>::size;
+00033     using std::vector<T, Allocator>::at;
+00034 
+00045     void initialize(std::istream& in)
+00046     {
+00047       if (!in.good())
+00048         return;
+00049 
+00050       std::string line;
+00051       unsigned i = 0;
+00052       while (!in.eof() && in.good())
+00053       {
+00054         ++i;
+00055         std::getline(in, line);
+00056 
+00057         /* skip last line if it's empty */
+00058         if (line.empty() && in.eof())
+00059           break;
+00060 
+00061         T value;
+00062         try
+00063         {
+00064           if (!line.empty())
+00065             value = boost::lexical_cast<T>(line);
+00066         }
+00067         catch(boost::bad_lexical_cast& ex)
+00068         {
+00069           std::stringstream sstr;
+00070           sstr << "Unable to convert input (line " << i << "): " << ex.what();
+00071           throw std::runtime_error(sstr.str());
+00072         }
+00073 
+00074         push_back(value);
+00075       }
+00076     }
+00077 
+00078 #if DEBUG
+00079 
+00088     void dump(std::ostream& out)
+00089     {
+00090       out << "[MEMORY DUMP]" << std::endl;
+00091       for(unsigned i = 0; i < size(); ++i)
+00092       {
+00093         out << "[" << std::setw(4) << std::setfill('0') << i << "]  "
+00094             << at(i) << std::endl;
+00095       }
+00096     }
+00097 #endif
+00098 };
+00099 
+00105 typedef CVectorMem<CDat> CMem;
+00106 
+00107 #endif
+00108 
+00109 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/cprogram_8h-source.html b/ue3/doxygen/cprogram_8h-source.html new file mode 100644 index 0000000..dfd39a8 --- /dev/null +++ b/ue3/doxygen/cprogram_8h-source.html @@ -0,0 +1,60 @@ + + +mycpu: mycpu/cprogram.h Source File + + + + + +

mycpu/cprogram.h

00001 
+00008 #ifndef CPROGRAM_H
+00009 #define CPROGRAM_H 1
+00010 
+00011 #include <vector>
+00012 #include <set>
+00013 #include <map>
+00014 #include "cinstruction.h"
+00015 
+00022 class CProgram
+00023   : public std::vector<CInstruction *>
+00024 {
+00025   public:
+00035     CProgram();
+00036 
+00046     ~CProgram();
+00047 
+00057     const std::map<std::string, unsigned>& getLabels() const
+00058     {
+00059       return m_labels;
+00060     }
+00061 
+00071     unsigned findLabel(const std::string& label) const;
+00072 
+00082     void compile(std::istream& in);
+00083 
+00084 #if DEBUG
+00085 
+00094     void dump(std::ostream& out);
+00095 #endif
+00096 
+00097   private:
+00098     /* members */
+00100     std::set<CInstruction *> m_instrset;
+00101     std::map<std::string, unsigned> m_labels;
+00102 };
+00103 
+00104 #endif
+00105 
+00106 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/displays_8h-source.html b/ue3/doxygen/displays_8h-source.html new file mode 100644 index 0000000..7bc4076 --- /dev/null +++ b/ue3/doxygen/displays_8h-source.html @@ -0,0 +1,60 @@ + + +mycpu: mycpu/displays.h Source File + + + + + +

mycpu/displays.h

00001 
+00008 #ifndef DISPLAYS_H
+00009 #define DISPLAYS_H 1
+00010 
+00011 #include <iomanip>
+00012 #include "cdisplay.h"
+00013 
+00020 class CDisplayWDEZ
+00021   : public CDisplay
+00022 {
+00023   public:
+00024     CDisplayWDEZ()
+00025       : CDisplay("wdez")
+00026     {}
+00027 
+00037     void display(const CDat &value)
+00038     {
+00039       std::cout << std::dec << value << std::endl;
+00040     }
+00041 };
+00042 
+00043 /*============================================================================*/
+00044 
+00051 class CDisplayWHEX
+00052   : public CDisplay
+00053 {
+00054   public:
+00055     CDisplayWHEX()
+00056       : CDisplay("whex")
+00057     {}
+00058 
+00068     void display(const CDat &value)
+00069     {
+00070       std::cout << std::hex << value << std::endl;
+00071     }
+00072 };
+00073 
+00074 #endif
+00075 
+00076 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/doxygen.css b/ue3/doxygen/doxygen.css new file mode 100644 index 0000000..c7db1a8 --- /dev/null +++ b/ue3/doxygen/doxygen.css @@ -0,0 +1,358 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} +A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } diff --git a/ue3/doxygen/doxygen.png b/ue3/doxygen/doxygen.png new file mode 100644 index 0000000..f0a274b Binary files /dev/null and b/ue3/doxygen/doxygen.png differ diff --git a/ue3/doxygen/files.html b/ue3/doxygen/files.html new file mode 100644 index 0000000..7921007 --- /dev/null +++ b/ue3/doxygen/files.html @@ -0,0 +1,30 @@ + + +mycpu: File Index + + + + + +

mycpu File List

Here is a list of all documented files with brief descriptions: + + + + + + + + +
mycpu/ccpu.h [code]
mycpu/cdat.h [code]
mycpu/cdisplay.h [code]
mycpu/cinstruction.h [code]
mycpu/cmem.h [code]
mycpu/cprogram.h [code]
mycpu/displays.h [code]
mycpu/instructions.h [code]
+
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/functions.html b/ue3/doxygen/functions.html new file mode 100644 index 0000000..2ec6814 --- /dev/null +++ b/ue3/doxygen/functions.html @@ -0,0 +1,259 @@ + + +mycpu: Class Members + + + + + + + +
+ +
+ +

+Here is a list of all documented class members with links to the class documentation for each member: +

+

- c -

+

- d -

+

- e -

+

- f -

+

- g -

+

- i -

+

- m -

+

- o -

+

- p -

+

- r -

+

- s -

    +
  • setFlagSign() +: CCPU +
  • setFlagZero() +: CCPU +
  • setMemory() +: CCPU +
  • setProgram() +: CCPU +
+

- ~ -

+
Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/functions_func.html b/ue3/doxygen/functions_func.html new file mode 100644 index 0000000..bb8ca9a --- /dev/null +++ b/ue3/doxygen/functions_func.html @@ -0,0 +1,219 @@ + + +mycpu: Class Members - Functions + + + + + + + +
+ +
+ +

+  +

+

- c -

+

- d -

+

- e -

+

- f -

+

- g -

+

- i -

+

- o -

+

- p -

+

- r -

+

- s -

    +
  • setFlagSign() +: CCPU +
  • setFlagZero() +: CCPU +
  • setMemory() +: CCPU +
  • setProgram() +: CCPU +
+

- ~ -

+
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/functions_rela.html b/ue3/doxygen/functions_rela.html new file mode 100644 index 0000000..d7d0fde --- /dev/null +++ b/ue3/doxygen/functions_rela.html @@ -0,0 +1,44 @@ + + +mycpu: Class Members - Related Functions + + + + + + + +  +

+

+
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/functions_vars.html b/ue3/doxygen/functions_vars.html new file mode 100644 index 0000000..5b7e130 --- /dev/null +++ b/ue3/doxygen/functions_vars.html @@ -0,0 +1,71 @@ + + +mycpu: Class Members - Variables + + + + + + + +  +

+

+
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/hierarchy.html b/ue3/doxygen/hierarchy.html new file mode 100644 index 0000000..2fd63a5 --- /dev/null +++ b/ue3/doxygen/hierarchy.html @@ -0,0 +1,58 @@ + + +mycpu: Hierarchical Index + + + + + + +

mycpu Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically: +
Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/index.html b/ue3/doxygen/index.html new file mode 100644 index 0000000..502a5e9 --- /dev/null +++ b/ue3/doxygen/index.html @@ -0,0 +1,22 @@ + + +mycpu: Main Page + + + + + +

mycpu Documentation

+

+


Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/instructions_8h-source.html b/ue3/doxygen/instructions_8h-source.html new file mode 100644 index 0000000..7054830 --- /dev/null +++ b/ue3/doxygen/instructions_8h-source.html @@ -0,0 +1,347 @@ + + +mycpu: mycpu/instructions.h Source File + + + + + +

mycpu/instructions.h

00001 
+00008 #ifndef INSTRUCTIONS_H
+00009 #define INSTRUCTIONS_H 1
+00010 
+00011 #include "cinstruction.h"
+00012 #include "ccpu.h"
+00013 
+00021 class CInstructionInc
+00022  : public CInstruction
+00023 {
+00024   public:
+00025     CInstructionInc()
+00026       : CInstruction("inc")
+00027     {}
+00028 
+00029     CInstructionInc *factory()
+00030     {
+00031       return new CInstructionInc;
+00032     }
+00033 
+00034     void compile(std::list<std::string>& params);
+00035     void execute(CCPU *cpu);
+00036 
+00037   protected:
+00039     unsigned m_regidx1;
+00040 };
+00041 
+00042 /*============================================================================*/
+00043 
+00051 class CInstructionDec
+00052  : public CInstruction
+00053 {
+00054   public:
+00055     CInstructionDec()
+00056       : CInstruction("dec")
+00057     {}
+00058 
+00059     CInstructionDec *factory()
+00060     {
+00061       return new CInstructionDec;
+00062     }
+00063 
+00064     void compile(std::list<std::string>& params);
+00065     void execute(CCPU *cpu);
+00066 
+00067   protected:
+00069     unsigned m_regidx1;
+00070 };
+00071 
+00072 /*============================================================================*/
+00073 
+00081 class CInstructionAdd
+00082  : public CInstruction
+00083 {
+00084   public:
+00085     CInstructionAdd()
+00086       : CInstruction("add")
+00087     {}
+00088 
+00089     CInstructionAdd *factory()
+00090     {
+00091       return new CInstructionAdd;
+00092     }
+00093 
+00094     void compile(std::list<std::string>& params);
+00095     void execute(CCPU *cpu);
+00096 
+00097   protected:
+00099     unsigned m_regidx1;
+00101     unsigned m_regidx2;
+00103     unsigned m_regidx3;
+00104 };
+00105 
+00106 /*============================================================================*/
+00107 
+00115 class CInstructionSub
+00116  : public CInstruction
+00117 {
+00118   public:
+00119     CInstructionSub()
+00120       : CInstruction("sub")
+00121     {}
+00122 
+00123     CInstructionSub *factory()
+00124     {
+00125       return new CInstructionSub;
+00126     }
+00127 
+00128     void compile(std::list<std::string>& params);
+00129     void execute(CCPU *cpu);
+00130 
+00131   protected:
+00133     unsigned m_regidx1;
+00135     unsigned m_regidx2;
+00137     unsigned m_regidx3;
+00138 };
+00139 
+00140 /*============================================================================*/
+00141 
+00149 class CInstructionMul
+00150  : public CInstruction
+00151 {
+00152   public:
+00153     CInstructionMul()
+00154       : CInstruction("mul")
+00155     {}
+00156 
+00157     CInstructionMul *factory()
+00158     {
+00159       return new CInstructionMul;
+00160     }
+00161 
+00162     void compile(std::list<std::string>& params);
+00163     void execute(CCPU *cpu);
+00164 
+00165   protected:
+00167     unsigned m_regidx1;
+00169     unsigned m_regidx2;
+00171     unsigned m_regidx3;
+00172 };
+00173 
+00174 /*============================================================================*/
+00175 
+00183 class CInstructionDiv
+00184  : public CInstruction
+00185 {
+00186   public:
+00187     CInstructionDiv()
+00188       : CInstruction("div")
+00189     {}
+00190 
+00191     CInstructionDiv *factory()
+00192     {
+00193       return new CInstructionDiv;
+00194     }
+00195 
+00196     void compile(std::list<std::string>& params);
+00197     void execute(CCPU *cpu);
+00198 
+00199   protected:
+00201     unsigned m_regidx1;
+00203     unsigned m_regidx2;
+00205     unsigned m_regidx3;
+00206 };
+00207 
+00208 /*============================================================================*/
+00209 
+00217 class CInstructionLoad
+00218  : public CInstruction
+00219 {
+00220   public:
+00221     CInstructionLoad()
+00222       : CInstruction("load")
+00223     {}
+00224 
+00225     CInstructionLoad *factory()
+00226     {
+00227       return new CInstructionLoad;
+00228     }
+00229 
+00230     void compile(std::list<std::string>& params);
+00231     void execute(CCPU *cpu);
+00232 
+00233   protected:
+00235     unsigned m_regidx1;
+00237     unsigned m_regidx2;
+00238 };
+00239 
+00240 /*============================================================================*/
+00241 
+00249 class CInstructionStore
+00250  : public CInstruction
+00251 {
+00252   public:
+00253     CInstructionStore()
+00254       : CInstruction("store")
+00255     {}
+00256 
+00257     CInstructionStore *factory()
+00258     {
+00259       return new CInstructionStore;
+00260     }
+00261 
+00262     void compile(std::list<std::string>& params);
+00263     void execute(CCPU *cpu);
+00264 
+00265   protected:
+00267     unsigned m_regidx1;
+00269     unsigned m_regidx2;
+00270 };
+00271 
+00272 /*============================================================================*/
+00273 
+00281 class CInstructionTest
+00282  : public CInstruction
+00283 {
+00284   public:
+00285     CInstructionTest()
+00286       : CInstruction("test")
+00287     {}
+00288 
+00289     CInstructionTest *factory()
+00290     {
+00291       return new CInstructionTest;
+00292     }
+00293 
+00294     void compile(std::list<std::string>& params);
+00295     void execute(CCPU *cpu);
+00296 
+00297   protected:
+00299     unsigned m_regidx1;
+00300 };
+00301 
+00302 /*============================================================================*/
+00303 
+00310 class CInstructionLabel
+00311  : public CInstruction
+00312 {
+00313   public:
+00314     CInstructionLabel()
+00315       : CInstruction("label")
+00316     {}
+00317 
+00318     CInstructionLabel *factory()
+00319     {
+00320       return new CInstructionLabel;
+00321     }
+00322 
+00323     void compile(std::list<std::string>& params)
+00324     {}
+00325 
+00326     void execute(CCPU *cpu)
+00327     {}
+00328 };
+00329 
+00330 /*============================================================================*/
+00331 
+00339 class CInstructionJumpA
+00340  : public CInstruction
+00341 {
+00342   public:
+00343     CInstructionJumpA()
+00344       : CInstruction("jumpa"), m_addr("")
+00345     {}
+00346 
+00347     CInstructionJumpA *factory()
+00348     {
+00349       return new CInstructionJumpA;
+00350     }
+00351 
+00352     void compile(std::list<std::string>& params);
+00353     void execute(CCPU *cpu);
+00354 
+00355   protected:
+00357     std::string m_addr;
+00358 };
+00359 
+00360 /*============================================================================*/
+00361 
+00369 class CInstructionJumpZ
+00370  : public CInstruction
+00371 {
+00372   public:
+00373     CInstructionJumpZ()
+00374       : CInstruction("jumpz"), m_addr("")
+00375     {}
+00376 
+00377     CInstructionJumpZ *factory()
+00378     {
+00379       return new CInstructionJumpZ;
+00380     }
+00381 
+00382     void compile(std::list<std::string>& params);
+00383     void execute(CCPU *cpu);
+00384 
+00385   protected:
+00387     std::string m_addr;
+00388 };
+00389 
+00390 /*============================================================================*/
+00391 
+00399 class CInstructionJumpS
+00400  : public CInstruction
+00401 {
+00402   public:
+00403     CInstructionJumpS()
+00404       : CInstruction("jumps"), m_addr("")
+00405     {}
+00406 
+00407     CInstructionJumpS *factory()
+00408     {
+00409       return new CInstructionJumpS;
+00410     }
+00411 
+00412     void compile(std::list<std::string>& params);
+00413     void execute(CCPU *cpu);
+00414 
+00415   protected:
+00417     std::string m_addr;
+00418 };
+00419 
+00420 /*============================================================================*/
+00421 
+00429 class CInstructionWrite
+00430  : public CInstruction
+00431 {
+00432   public:
+00433     CInstructionWrite()
+00434       : CInstruction("write"), m_dev("")
+00435     {}
+00436 
+00437     CInstructionWrite *factory()
+00438     {
+00439       return new CInstructionWrite;
+00440     }
+00441 
+00442     void compile(std::list<std::string>& params);
+00443     void execute(CCPU *cpu);
+00444 
+00445   protected:
+00447     unsigned m_regidx1;
+00449     std::string m_dev;
+00450 };
+00451 
+00452 #endif
+00453 
+00454 /* vim: set et sw=2 ts=2: */
+

Generated on Thu May 14 18:19:16 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/namespaces.html b/ue3/doxygen/namespaces.html new file mode 100644 index 0000000..171e4d7 --- /dev/null +++ b/ue3/doxygen/namespaces.html @@ -0,0 +1,23 @@ + + +mycpu: Namespace Index + + + + + +

mycpu Namespace List

Here is a list of all documented namespaces with brief descriptions: + +
stdCPU implementation. Used as a container for memory and instructions. Implements an run method to execute the program (= the instructions)
+
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/namespacestd.html b/ue3/doxygen/namespacestd.html new file mode 100644 index 0000000..29c962a --- /dev/null +++ b/ue3/doxygen/namespacestd.html @@ -0,0 +1,32 @@ + + +mycpu: std Namespace Reference + + + + + +

std Namespace Reference

CPU implementation. Used as a container for memory and instructions. Implements an run method to execute the program (= the instructions). +More... +

+ + +
+


Detailed Description

+CPU implementation. Used as a container for memory and instructions. Implements an run method to execute the program (= the instructions). +

+

Modulname:
ccpu
+
Author:
Guenther Neuwirth (0626638), Manuel Mausz (0728348)
+
Date:
10.05.2009
+
Generated on Thu May 14 18:19:17 2009 for mycpu by  + +doxygen 1.5.3
+ + diff --git a/ue3/doxygen/tab_b.gif b/ue3/doxygen/tab_b.gif new file mode 100644 index 0000000..0d62348 Binary files /dev/null and b/ue3/doxygen/tab_b.gif differ diff --git a/ue3/doxygen/tab_l.gif b/ue3/doxygen/tab_l.gif new file mode 100644 index 0000000..9b1e633 Binary files /dev/null and b/ue3/doxygen/tab_l.gif differ diff --git a/ue3/doxygen/tab_r.gif b/ue3/doxygen/tab_r.gif new file mode 100644 index 0000000..ce9dd9f Binary files /dev/null and b/ue3/doxygen/tab_r.gif differ diff --git a/ue3/doxygen/tabs.css b/ue3/doxygen/tabs.css new file mode 100644 index 0000000..c37faaf --- /dev/null +++ b/ue3/doxygen/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.nav +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/ue3/mycpu/cdisplay.h b/ue3/mycpu/cdisplay.h index 1523f68..82776ee 100644 --- a/ue3/mycpu/cdisplay.h +++ b/ue3/mycpu/cdisplay.h @@ -57,7 +57,7 @@ class CDisplayT } /** - * @method getName + * @method display * @brief prints value to display * @param value value to display * @return - diff --git a/ue3/mycpu/displays.h b/ue3/mycpu/displays.h index 87b9408..d4f3f36 100644 --- a/ue3/mycpu/displays.h +++ b/ue3/mycpu/displays.h @@ -25,6 +25,15 @@ class CDisplayWDEZ : CDisplay("wdez") {} + /** + * @method display + * @brief prints value to display + * @param value value to display + * @return - + * @globalvars none + * @exception none + * @conditions none + */ void display(const CDat &value) { std::cout << std::dec << value << std::endl; @@ -47,6 +56,15 @@ class CDisplayWHEX : CDisplay("whex") {} + /** + * @method display + * @brief prints value to display + * @param value value to display + * @return - + * @globalvars none + * @exception none + * @conditions none + */ void display(const CDat &value) { std::cout << std::hex << value << std::endl; -- cgit v1.2.3