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

Subversion Repositories scarm

[/] [scarm/] [trunk/] [src/] [scBarrelShifter.h] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 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
 
27
/*****************************************************************************
28
 
29
  scBarrelShifter.h: interface for the scBarrelShifter class.
30
 
31
  Original Author: Allen Tao Zhong, University of Electronic Science and
32
                   Technology in China
33
 
34
 *****************************************************************************/
35
#ifndef scBarrelShifter_H
36
#define scBarrelShifter_H
37
 
38
 
39
#include"scTypes.h"
40
#include<systemc.h>
41
#include<sc_mslib.h>
42
#include "scRegisterFile.h"
43
#include"scARMInstruction.h"
44
//////////////////////////////////////
45
//
46
//  parameters of barrelshifter
47
//
48
////////////////////////////////////////
49
 
50
 enum SHIFT {S_LSL = 0, S_LSR = 1, S_ASR = 2, S_ROR, S_RRX, S_ASL} ;
51
//control signals for barrel shifter
52
 
53
 
54
 
55
//////////////////////////////
56
//the interface of barrelshifter
57
//////////////////////////////
58
 
59
class scBarrelShifter:public sc_module
60
{
61
public://ports
62
 
63
     sc_in<uint32_t> in_n_Val;
64
         sc_in<SHIFT>  in_SHIFT_TYPE;
65
         sc_in<uint32_t>  in_n_Dist;
66
         sc_out<uint32_t> out_n_NewVal;
67
         sc_out<bool>     out_b_Carry;
68
         sc_outmaster<bool>      out_b_RW;
69
         sc_outmaster<REGS>    out_CPSR;
70
         sc_inoutslave<uint32_t>  inout_n_Flag;
71
 
72
public:
73
        SC_HAS_PROCESS(scBarrelShifter);//
74
        scBarrelShifter(sc_module_name name) : sc_module(name)
75
    {
76
 
77
        SC_METHOD(entry);
78
                sensitive<<in_n_Val<<in_SHIFT_TYPE<<in_n_Dist;
79
 
80
    }
81
private://data
82
        uint32_t m_nShiftCarryBit;
83
 
84
 
85
        uint32_t m_nShiftType;
86
        uint32_t m_nShiftDist;
87
private:
88
 
89
        void entry(void);
90
 
91
uint32_t Shift(uint32_t nVal, enum SHIFT type, int nDist);// behavoir implementation
92
 
93
};
94
 
95
 
96
#endif

powered by: WebSVN 2.1.0

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