📄 pipelinedoc.h
字号:
// PipelineDoc.h : interface of the CPipelineDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_PIPELINEDOC_H__1950BE64_1555_4B23_95B4_72F56D3BC5CF__INCLUDED_)
#define AFX_PIPELINEDOC_H__1950BE64_1555_4B23_95B4_72F56D3BC5CF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define FUNC(x) (x>>26)
#define RS(x) ((x>>21)%32)
#define RT(x) ((x>>16)%32)
#define RD(x) ((x>>11)%32)
#define IMM(x) (x%65536)
#define MAX_SIZE 1000
struct instruction_state
{
unsigned long pc;
int number;
int normal[5];
int instruction[MAX_SIZE];
};
enum FORWARDING
{
FORWARD,NON_FORWARD
};
enum BRANCH
{
FLUSH,PREDICTED_TAKEN,PREDICTED_UNTAKEN,DELAYED_BRANCH
};
struct IF_ID
{
unsigned long IR;
unsigned long NPC;
};
struct ID_EX
{
unsigned long IR;
long A;
long B;
long ALUOutput;
unsigned long NPC;
long Imm;
long cond;
};
struct EX_MEM
{
unsigned long IR;
long ALUOutput;
long cond;
long A;
long B;
};
struct MEM_WB
{
unsigned long IR;
long ALUOutput;
long LMD;
};
class CPipelineDoc : public CDocument
{
protected: // create from serialization only
CPipelineDoc();
DECLARE_DYNCREATE(CPipelineDoc)
// Attributes
public:
int cycle;
int Icon_Rec[1000][1000];
bool GoodFile;
bool set_OK;
unsigned long IM[1000];
char attr[1000][20];
long DM[1000];
long REG[32];
unsigned long pc;
unsigned int data_stall;
bool load_stall;
IF_ID if_id;
ID_EX id_ex;
EX_MEM ex_mem;
MEM_WB mem_wb;
FORWARDING forwarding;
BRANCH branching;
instruction_state states;
void IF_STEP();
void IDD_STEP();
void EX_STEP();
void MEM_STEP();
bool WB_STEP();
void fetch_a();
void fetch_b();
inline void set_forward()
{
forwarding=FORWARD;
};
inline void clear_forward()
{
forwarding=NON_FORWARD;
};
inline void set_branch_untaken()
{
branching=PREDICTED_UNTAKEN;
};
inline void set_branch_taken()
{
branching=PREDICTED_TAKEN;
};
inline void set_branch_delay()
{
branching=DELAYED_BRANCH;
};
public:
bool readfile(LPCTSTR filename);
int chartoint(char *str);
bool translate(unsigned long *im,char *str);
void uptolow(char *str);
void standard(char *str);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPipelineDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
//}}AFX_VIRTUAL
// Implementation
public:
int strategy;
int mode;
void clear();
virtual ~CPipelineDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CPipelineDoc)
afx_msg void OnStep();
afx_msg void OnDataSet();
afx_msg void OnReset();
afx_msg void OnDelay();
afx_msg void OnFlush();
afx_msg void OnTaken();
afx_msg void OnNotTaken();
afx_msg void OnForward();
afx_msg void OnNoForward();
afx_msg void OnUpdateDelay(CCmdUI* pCmdUI);
afx_msg void OnUpdateFlush(CCmdUI* pCmdUI);
afx_msg void OnUpdateForward(CCmdUI* pCmdUI);
afx_msg void OnUpdateNoForward(CCmdUI* pCmdUI);
afx_msg void OnUpdateNotTaken(CCmdUI* pCmdUI);
afx_msg void OnUpdateTaken(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PIPELINEDOC_H__1950BE64_1555_4B23_95B4_72F56D3BC5CF__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -