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

Subversion Repositories scarm

[/] [scarm/] [trunk/] [src/] [pipeline/] [scEX.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
// scEX.h: interface for the scEX class.
24
//
25
//////////////////////////////////////////////////////////////////////
26
 
27
#include<systemc.h>
28
#include"scTypes.h"
29
#include".\components\alu\scALU.h"
30
#include".\components\barrelshifter\scBarrelShifter.h"
31
 
32
//enum ARI {ARI_ALU, ARI_INC, ARI_REG, ARI_NONE};
33
 
34
class scEX :public sc_module
35
{
36
public: //ports
37
 
38
        sc_in<bool> in_b_Clock;
39
        sc_in<uint32_t> in_n_NPC;
40
        sc_in<bool_t> in_b_Branch;
41
        sc_out<bool_t> out_b_Flush;
42
        sc_in<bool_t>  in_b_MEM;
43
        sc_out<bool_t> out_b_MEM;
44
 
45
//A Bus
46
        sc_in<OPCODE>   in_OP;
47
        sc_in<COND>     in_COND;
48
        sc_in<uint32_t> in_n_A;
49
 
50
//B bus
51
        sc_in<SHIFT>    in_SHIFT;
52
        sc_in<uint32_t> in_n_Dist;
53
    sc_in<uint32_t> in_n_B;
54
 
55
//ALU Bus
56
        sc_out<uint32_t> out_n_ALUOutput;
57
        sc_in<REGS>     in_Rd;
58
        sc_out<REGS>    out_Rd;
59
//      sc_out<uint32_t> out_n_Flag;
60
 
61
                //regs file
62
        sc_outmaster<REGS>   out_REG;
63
        sc_inoutslave<uint32_t> in_n_RegData;
64
private:
65
        sc_signal<OPCODE>   s_OP;
66
        sc_signal<COND>     s_COND;
67
        sc_signal<uint32_t> s_n_A;
68
        sc_signal<SHIFT>    s_SHIFT;
69
        sc_signal<uint32_t> s_n_Dist;
70
        sc_signal<uint32_t> s_n_B;
71
        //should update flag
72
        sc_signal<uint32_t> s_n_Flag;
73
 
74
 
75
private:
76
        scALU inst_ALU;
77
        scBarrelShifter inst_BarrelShifter;
78
 
79
        sc_signal<uint32_t> s_n_B1;
80
    sc_signal<uint32_t> s_n_ALUOutput;
81
public:
82
 
83
        SC_HAS_PROCESS(scEX);
84
        scEX(const sc_module_name name_):sc_module(name_),
85
                inst_ALU("alu"),
86
            inst_BarrelShifter("barrel_shifter")
87
        {
88
           SC_METHOD(entry);
89
           sensitive_pos<<in_b_Clock;
90
           SC_METHOD(output);
91
           sensitive<<s_n_ALUOutput;
92
           //internal links
93
           //A bus is directly linked
94
 
95
           //The barrelshifter is inserted before the ALU in B bus
96
           //For ARM6, there is a Booth Mutiplier which is inserted in A Bus
97
           inst_BarrelShifter(s_n_B,s_SHIFT,s_n_Dist,s_n_B1,
98
                   out_REG,in_n_RegData);
99
 
100
           inst_ALU(s_OP,s_COND,s_n_A,s_n_B1,s_n_ALUOutput,s_n_Flag);
101
        }
102
        virtual ~scEX();
103
 
104
private:
105
        void entry(void);
106
private:
107
        void output();
108
 
109
        uint32_t m_n_ALUOutput;
110
        uint32_t m_nIR;
111
        uint32_t m_nCond;//Control signals
112
};

powered by: WebSVN 2.1.0

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