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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [sw/] [iss/] [cpu/] [RegisterFile.hh] - Blame information for rev 200

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

Line No. Rev Author Line
1 198 sybreon
/*!
2
  AEMB INSTRUCTION SET SIMULATOR
3
  Copyright (C) 2009 Shawn Tan 
4
 
5
  This program is free software: you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
7
  the Free Software Foundation, either version 3 of the License, or
8
  (at your option) any later version.
9
 
10
  This program is distributed in the hope that it will be useful, but
11
  WITHOUT ANY WARRANTY; without even the implied warranty of
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
  General Public License for more details.
14
 
15
  You should have received a copy of the GNU General Public License
16
  along with this program.  If not, see
17
  .
18
*/
19
 
20
#ifndef _AEMBREGISTERGP_H_
21
#define _AEMBREGISTERGP_H_
22
 
23
#include 
24
 
25
using std::vector;
26
 
27 199 sybreon
namespace aemb {
28
 
29 198 sybreon
/**
30 199 sybreon
 * List of special function registers
31
 */
32
typedef enum
33
{
34
        SFR_PC = 0,
35
        SFR_MSR = 1,
36
        SFR_EAR = 3,
37
        SFR_ESR = 5,
38
} SpecialRegs;
39
 
40
/**
41 198 sybreon
   Behavioral class for the general purpose register file that can
42
   only be read from and written to. It has internal mechanisms to
43
   check for data hazards.
44
*/
45
 
46 199 sybreon
class RegisterFile
47 198 sybreon
{
48
        vector regfile; ///< internal general purpose register file
49 199 sybreon
        int rsfr;
50 198 sybreon
public:
51 199 sybreon
 
52
        void reset();
53
 
54 198 sybreon
        /**
55
         * Put a value into a register.
56 199 sybreon
         * @param gpr Register number [0:31].
57 198 sybreon
         * @param data Register data to write
58 199 sybreon
         */
59
 
60
        void setRegister(const int gpr, const int data);
61
 
62 198 sybreon
        /**
63
         * Get a value from a register.
64 199 sybreon
         * @param gpr Register number [0:31].
65 198 sybreon
         * @return Value of the register.
66 199 sybreon
         */
67
 
68
        int getRegister(const int gpr);
69
 
70
        /**
71
         * Get the value of a special register.
72
         * @param sfr Special register number
73
         * @return Special register value
74
         */
75
 
76
        int getSpecial(const int sfr);
77
 
78
        /**
79
         * Set the value of a special register
80
         * @param sfr Special register number
81
         * @param imm32 Special register value
82
         */
83
 
84
        void setSpecial(const int sfr, const int imm32);
85
 
86
        int clrSpecial(const int imm14);
87
        int setSpecial(const int imm14);
88 198 sybreon
 
89 199 sybreon
        RegisterFile();
90
        ~RegisterFile();
91 198 sybreon
};
92
 
93 199 sybreon
}
94
#endif

powered by: WebSVN 2.1.0

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