OpenCores
URL https://opencores.org/ocsvn/scarm/scarm/trunk

Subversion Repositories scarm

[/] [scarm/] [trunk/] [src/] [pipeline/] [scID.h] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 zhong
///////////////////////////////////////////////////////////////////////////////
2
// This program is free software; you can redistribute it and/or
3
// modify it under the terms of the GNU General Public License
4
// as published by the Free Software Foundation; either version 2
5
// of the License, or (at your option) any later version.
6
//
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
// GNU General Public License for more details.
11
//
12
// You should have received a copy of the GNU General Public License
13
// along with this program; if not, write to the Free Software
14
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
//////////////////////////////////////////////////////////////////////
16
 
17
///////////////////////////////////////////////////////////////////              
18
//          
19
//  Original Author: Allen Tao Zhong,
20
//  University of Electronic Science and Technology in China
21
//  email: zhong@opencores.org
22
//  info   This is a SystemC ARM model 
23
//   
24
//
25
///////////////////////////////////////////////////////////////////////////////
26
// scID.h: interface for the scID class.
27
//
28
//////////////////////////////////////////////////////////////////////
29
 
30
#include<systemc.h>
31
#include<sc_mslib.h>
32
#include "scTypes.h"
33
#include ".\components\decoder\scDecoder.h"
34
#include ".\components\registers\scRegisterFile.h"
35
enum B_DRIVE {B_REG, B_IMM1, B_IMM2, B_DIN, B_CPSR, B_SPSR};
36
class scID :public sc_module
37
{
38
public: //ports
39
        sc_in<bool> in_b_Clock;
40
        sc_in<uint32_t> in_n_NPC;
41
        sc_out<uint32_t> out_n_NPC;
42
    sc_in<uint32_t> in_n_Instruction;
43
    sc_out<bool_t>  out_b_Branch;
44
        sc_out<bool_t>  out_b_MEM;
45
 
46
        sc_out<OPCODE>   out_OP;
47
        sc_out<COND>     out_COND;
48
        sc_out<uint32_t> out_n_A;
49
 
50
        sc_out<SHIFT>    out_SHIFT;
51
        sc_out<uint32_t> out_n_Dist;
52
        sc_out<uint32_t> out_n_B;
53
 
54
    sc_out<REGS>   out_Rd;
55
        //regs file
56
        sc_outmaster<REGS>   out_REG;
57
        sc_inoutslave<uint32_t> in_n_RegData;
58
 
59
//      sc_in<uint32_t> in_n_NPC;
60
private:
61
        scDecoder  inst_Decoder;
62
 
63
 
64
 
65
private:
66
        //input
67
        sc_signal<uint32_t>  s_n_IR;
68
    //links
69
 
70
        //output
71
        sc_signal<bool_t>    s_b_Branch;
72
        sc_signal<bool_t>    s_b_MEM;
73
        sc_signal<REGS>      s_Rn;
74
        sc_signal<REGS>      s_Rm;
75
        sc_signal<REGS>      s_Rd;
76
        sc_signal<OPCODE>    s_OP;
77
        sc_signal<COND>      s_COND;
78
        sc_signal<uint32_t>  s_n_Rn;
79
        sc_signal<SHIFT>     s_SHIFT_TYPE;
80
        sc_signal<bool_t>    s_Set;
81
        sc_signal<uint32_t>  s_ShiftDist;
82
    sc_signal<uint32_t>  s_n_Rm;
83
    sc_signal<uint32_t>  s_n_Imm;
84
 public:
85
 
86
        SC_HAS_PROCESS(scID);
87
        scID(const sc_module_name name_):sc_module(name_),
88
                inst_Decoder("decoder")
89
        {
90
           //s_b_MEM=false;
91
           //s_OP=OP_ADD;
92
           SC_METHOD(entry);
93
           sensitive_pos<<in_b_Clock;
94
           SC_METHOD(output);
95
           sensitive<<s_n_IR;
96
           //internal links
97
           inst_Decoder(s_n_IR,
98
                   s_b_Branch,
99
                   s_OP,s_COND,
100
                   s_Rd,s_Rn,
101
                   s_SHIFT_TYPE,s_Set,s_ShiftDist,s_Rm,s_n_Imm,
102
                   out_REG/*CPSR*/,in_n_RegData);
103
 
104
        }
105
        virtual ~scID();
106
 
107
 
108
 
109
private:
110
        void output();
111
//use the fixed field technique
112
 
113
        void entry();
114
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.