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

Subversion Repositories scarm

[/] [scarm/] [trunk/] [src/] [scB.cpp] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 zhong
// scB.cpp: implementation of the scB class.
2
//
3
//////////////////////////////////////////////////////////////////////
4
 
5
#include "scB.h"
6
 
7
//////////////////////////////////////////////////////////////////////
8
// Construction/Destruction
9
//////////////////////////////////////////////////////////////////////
10
 
11
scB::scB(uint32_t i)
12
{
13
  ir.offset=i;
14
  ir.link=(i>>24);
15
  ir.pad =(i>>25);
16
  ir.cond=(i>>28);
17
}
18
 
19
scB::~scB()
20
{
21
 
22
}
23
const char * scB::kind_string_b="B";
24
const char * scB::kind_string_bl="BL";
25
const char * scB::kind()
26
{
27
        if(ir.link==1)
28
        {
29
                return kind_string_bl;
30
                cout<<"link"<<endl;
31
        }
32
        else
33
                return kind_string_b;
34
}
35
 
36
uint32_t scB::A()
37
{
38
 
39
  return R_PC;
40
}
41
 
42
REGS scB::Rd()
43
{
44
  return R_PC;
45
}
46
 
47
bool scB::is_shift()
48
{
49
  return true;
50
}
51
 
52
bool scB::is_ls()
53
{
54
  return false;
55
}
56
 
57
bool scB::is_word()
58
{
59
  return true;
60
}
61
 
62
bool scB::is_mult()
63
{
64
  return false;
65
}
66
 
67
bool scB::is_rs()
68
{
69
  return false;
70
}
71
 
72
uint32_t scB::B()
73
{
74
  //24bit  offset Sign extension
75
  uint32_t temp=ir.offset;
76
  if((temp&(0x00800000))!=0)
77
  {
78
     temp=(temp|0xFF000000);
79
  }
80
  return temp;
81
}
82
 
83
uint32_t scB::dist()
84
{
85
  return 2;
86
}
87
 
88
OPCODE scB::op()
89
{
90
  return OP_ADD;
91
}
92
 
93
SHIFT scB::shift_type()
94
{
95
  return S_LSL;
96
}
97
 
98
COND scB::cond()
99
{
100
  return COND(ir.cond);
101
}
102
 
103
bool scB::is_imm()
104
{
105
  return true;
106
}
107
 
108
bool scB::wb()
109
{
110
 return ir.link;
111
}
112
 
113
REGS scB::Rn()
114
{
115
  return R_PC;
116
}
117
 
118
bool scB::pre()
119
{
120
  return 0;
121
}
122
 
123
bool scB::load()
124
{
125
  return false;
126
}
127
 
128
bool scB::is_branch()
129
{
130
 return true;
131
}
132
 
133
bool scB::set( )
134
{
135
 return false;
136
}
137
 
138
bool scB::is_link()
139
{
140
  return ir.link;
141
}

powered by: WebSVN 2.1.0

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