module.hh

来自「一个mips虚拟机非常好代码,使用C++来编写的,希望大家多学学,」· HH 代码 · 共 70 行

HH
70
字号
#ifndef module_hh_included#define module_hh_included#include "object.hh"#include "simarg.hh"#include "serial.hh"// BasicModule builds some infrastructure shared by the Sulima class and the// hardware modules (see below.) In particular, it gets a name N and a Tcl// namespace "sim::T".class BasicModule    : public Object{private:    // Module name.    const char *name_str;public:    // Constructors, etc.    explicit BasicModule(const char *name);    virtual ~BasicModule();    // Attribute access.    const char *name() const	{ return name_str; }    // Logging support. See sulima/log.cc    void log(char c) const;    void msg(char c) const;    void log(const char *templ, ...) const;    void msg(const char *templ, ...) const;    // Interfaces used to define Tcl objects in the module namespace.    //void define(const char *nm, bool &var, bool init, bool ro = false);    void define(const char *nm, int &var,  int  init = 0, bool ro = false);    //void define(const char *nm, long &var, long init, bool ro = false);    void define(const char *nm, char *&var,		const char *init = "", bool ro = false);    void define(const char *nm, SimArg (*fn)(const SimArgs &));    void define(const char *nm,		Object *obj, SimArg (Object::*fn)(const SimArgs &));};// Module adds serialization support to BasicModule and implements// the actual Tcl interfaces install_module and reset_all.class Module    : public virtual Serializable, public BasicModule{public:    // Constructors, etc.    explicit Module(const char *n)	: BasicModule(n) { }    explicit Module(const SimArgs &args);    explicit Module(Checkpoint &cp);    // Serialization support.    void checkpoint(Checkpoint &cp, bool parent = false) const;    // Simulator interfaces.    virtual void reset(bool warm) = 0;    // Tcl interfaces.    static SimArg install_module(const SimArgs &args);    static SimArg reset_all(const SimArgs &args);};// Search the object list for a module with the given name.Module *find_module(const char *name);#endif // module_hh_included

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?