1 |
5 |
zhong |
// scMEM.h: interface for the scMEM class.
|
2 |
|
|
/* -------------------
|
3 |
|
|
begin : Oct 2 2002
|
4 |
|
|
copyright : (C) 2002 UESTC
|
5 |
|
|
author : Zhong Tao
|
6 |
|
|
email : zhong@opencores.org
|
7 |
|
|
***************************************************************************/
|
8 |
|
|
|
9 |
|
|
/***************************************************************************
|
10 |
|
|
* *
|
11 |
|
|
* This program is free software; you can redistribute it and/or modify *
|
12 |
|
|
* it under the terms of the GNU General Public License as published by *
|
13 |
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
14 |
|
|
* (at your option) any later version. *
|
15 |
|
|
* *
|
16 |
|
|
***************************************************************************/
|
17 |
|
|
#if !defined(AFX_SCMEM_H__D38D2414_AB4A_11D6_BB1E_000000000000__INCLUDED_)
|
18 |
|
|
#define AFX_SCMEM_H__D38D2414_AB4A_11D6_BB1E_000000000000__INCLUDED_
|
19 |
|
|
|
20 |
|
|
#if _MSC_VER > 1000
|
21 |
|
|
#pragma once
|
22 |
|
|
#endif // _MSC_VER > 1000
|
23 |
|
|
#include <systemc.h>
|
24 |
|
|
#include "scTypes.h"
|
25 |
|
|
|
26 |
|
|
#include "scRegisterFile.h"
|
27 |
|
|
class scMEM : public sc_module
|
28 |
|
|
{
|
29 |
|
|
public:
|
30 |
|
|
sc_in<bool> in_b_Clock;
|
31 |
|
|
sc_in<bool> in_interrupt;
|
32 |
|
|
sc_in<bool> in_b_branch_taken;
|
33 |
|
|
sc_in<bool> in_b_excute;
|
34 |
|
|
sc_out<bool> out_b_excute;
|
35 |
|
|
//sc_out<bool> out_b_flush;
|
36 |
|
|
//access memory
|
37 |
|
|
sc_outmaster<bool> out_b_nRW;
|
38 |
|
|
sc_outmaster<uint32_t> out_n_Addr;// address bus
|
39 |
|
|
sc_inoutslave<uint32_t> inout_n_Data; //Instruction bus
|
40 |
|
|
//access regs
|
41 |
|
|
sc_outmaster<bool> out_b_nRW_reg;
|
42 |
|
|
sc_outmaster<REGS> out_n_Addr_reg;// address bus
|
43 |
|
|
sc_inoutslave<uint32_t> inout_n_Data_reg; //Instruction bus
|
44 |
|
|
//EX to MEM
|
45 |
|
|
sc_in<REGS> in_Rd;
|
46 |
|
|
sc_in<bool> in_b_write_Rd;
|
47 |
|
|
sc_in<REGS> in_Rn; //Reg
|
48 |
|
|
sc_in<uint32_t> in_n_Rn;//data
|
49 |
|
|
sc_in<bool> in_b_ls;
|
50 |
|
|
sc_in<bool> in_is_mrt;
|
51 |
|
|
sc_in<bool> in_b_Pre;// alter base reg before?
|
52 |
|
|
sc_in<bool> in_b_Load;// load or store
|
53 |
|
|
sc_in<bool> in_b_WB; //if i should write back to base reg?
|
54 |
|
|
sc_in<uint32_t> in_n_Result;//result
|
55 |
|
|
sc_in<uint32_t> in_n_Rd;//write to memory from source Rd
|
56 |
|
|
//MEM to WB
|
57 |
|
|
sc_out<bool> out_b_W_Rd;
|
58 |
|
|
sc_out<bool> out_b_WB;
|
59 |
|
|
sc_out<REGS> out_Rd;//target
|
60 |
|
|
sc_out<uint32_t> out_n_Result;
|
61 |
|
|
sc_out<REGS> out_Rn;//write-back register
|
62 |
|
|
sc_out<uint32_t> out_n_Rn; //write-back data
|
63 |
|
|
|
64 |
|
|
public:
|
65 |
|
|
void write_mem();
|
66 |
|
|
void delta_delay1();
|
67 |
|
|
|
68 |
|
|
void dump(uint32_t);
|
69 |
|
|
void entry();
|
70 |
|
|
SC_HAS_PROCESS(scMEM);
|
71 |
|
|
scMEM(sc_module_name);
|
72 |
|
|
virtual ~scMEM();
|
73 |
|
|
private:
|
74 |
|
|
sc_event trigger,trigger_mem;
|
75 |
|
|
REGS m_Rd;
|
76 |
|
|
REGS m_Rn;
|
77 |
|
|
bool m_b_W_Rd,m_b_WB,m_interrupt,m_b_is_mrt;
|
78 |
|
|
|
79 |
|
|
uint32_t m_n_Result,m_n_Rn,m_n_Rd,m_n_Addr;
|
80 |
|
|
bool m_b_excute,m_b_ls,m_b_Load;
|
81 |
|
|
};
|
82 |
|
|
|
83 |
|
|
#endif // !defined(AFX_SCMEM_H__D38D2414_AB4A_11D6_BB1E_000000000000__INCLUDED_)
|