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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [sw/] [iss/] [cpu/] [RegisterFile.cc] - Blame information for rev 199

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 <shawn.tan@aeste.net>
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
  <http://www.gnu.org/licenses/>.
18
*/
19
 
20 199 sybreon
#include <assert.h>
21 198 sybreon
 
22 199 sybreon
#include "RegisterFile.hh"
23
 
24
using namespace std;
25
 
26
namespace aemb {
27
 
28
void RegisterFile::setRegister(const int gpr, const int data)
29 198 sybreon
{
30 199 sybreon
        regfile.at(gpr) = data;
31 198 sybreon
}
32
 
33 199 sybreon
int RegisterFile::getRegister(const int gpr)
34 198 sybreon
{
35 199 sybreon
        return (gpr > 0) ? regfile.at(gpr) : 0;
36 198 sybreon
}
37
 
38 199 sybreon
int RegisterFile::getSpecial(const int sfr)
39 198 sybreon
{
40 199 sybreon
        int tmp;
41
        switch (sfr) {
42
                case SFR_MSR:
43
                        tmp = rsfr;
44
                break;
45
                default: // invalid sfr
46
                        assert(0);
47
                break;
48
        }
49
        return tmp;
50
}
51
 
52
void RegisterFile::setSpecial(const int sfr, const int imm32)
53
{
54
        switch (sfr) {
55
                case SFR_MSR:
56
                        rsfr = imm32;
57
                break;
58
                default: // invalid sfr
59
                        assert(0);
60
                break;
61
        }
62
}
63
 
64
void RegisterFile::reset()
65
{
66
        regfile.clear();
67
        for (int i=0; i<32; ++i) {
68 198 sybreon
        regfile.push_back(0);
69 199 sybreon
        }
70 198 sybreon
}
71
 
72 199 sybreon
RegisterFile::RegisterFile()
73
{
74
}
75
 
76
RegisterFile::~RegisterFile()
77 198 sybreon
{
78
}
79 199 sybreon
 
80
}

powered by: WebSVN 2.1.0

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