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

Subversion Repositories scarm

[/] [scarm/] [trunk/] [src/] [scALU.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,I "stole" some codes from 
23
//       "swarm" , author Michael Dales (michael@dcs.gla.ac.uk)
24
//  scALU.h: interface for the scALU class.
25
//
26
//////////////////////////////////////////////////////////////////////
27
 
28
#ifndef ALU_H
29
#define ALU_H
30
#include"scTypes.h"
31
#include<systemc.h>
32
#include<sc_mslib.h>
33
enum ALU_AI {AI_NORM = 0, AI_HACK, AI_MAGIC, AI_MULT_LO, AI_MULT_HI};
34
enum ALU_BI {BI_NORM = 0, BI_HACK, BI_NULL, BI_MULT_LO, BI_MULT_HI};
35
enum COND {C_EQ = 0x0, C_NE = 0x1, C_CS = 0x2, C_CC = 0x3,
36
           C_MI = 0x4, C_PL = 0x5, C_VS = 0x6, C_VC = 0x7,
37
           C_HI = 0x8, C_LS = 0x9, C_GE = 0xA, C_LT = 0xB,
38
           C_GT = 0xC, C_LE = 0xD, C_AL = 0xE, C_NV = 0xF};
39
enum OPCODE {OP_AND = 0x00, OP_EOR = 0x01, OP_SUB = 0x02, OP_RSB = 0x03,
40
             OP_ADD = 0x04, OP_ADC = 0x05, OP_SBC = 0x06, OP_RSC = 0x07,
41
             OP_TST = 0x08, OP_TEQ = 0x09, OP_CMP = 0x0A, OP_CMN = 0x0B,
42
             OP_ORR = 0x0C, OP_MOV = 0x0D, OP_BIC = 0x0E, OP_MVN = 0x0F};
43
 
44
class scALU:public sc_module
45
{
46
public://ports
47
 
48
 
49
        sc_in<OPCODE>    in_OP;
50
        sc_in<uint32_t>  in_n_A;
51
        sc_in<uint32_t>  in_n_B;
52
    sc_out<uint32_t> out_n_Out;
53
        sc_inout<uint32_t> inout_n_Flag;
54
public:
55
        void display();
56
        SC_HAS_PROCESS(scALU);
57
        scALU(sc_module_name name) : sc_module(name)
58
    {
59
       SC_METHOD(entry);
60
           sensitive<<in_n_A<<in_n_B<<in_OP;
61
    }
62
        virtual ~scALU();
63
private://implementation 
64
        void entry(void);
65
 typedef uint32_t alu_fn(uint32_t a, uint32_t b, uint32_t* cont);
66
 
67
           alu_fn and_op;
68
           alu_fn eor_op;
69
           alu_fn sub_op;
70
           alu_fn rsb_op;
71
           alu_fn add_op;
72
           alu_fn adc_op;
73
           alu_fn sbc_op;
74
           alu_fn rsc_op;
75
           alu_fn tst_op;
76
           alu_fn teq_op;
77
           alu_fn cmp_op;
78
           alu_fn cmn_op;
79
           alu_fn orr_op;
80
           alu_fn mov_op;
81
           alu_fn bic_op;
82
           alu_fn mvn_op;
83
 
84
};
85
#endif

powered by: WebSVN 2.1.0

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