| 10 |
#include "internal_reg.h" |
#include "internal_reg.h" |
| 11 |
#include "mplexer.h" |
#include "mplexer.h" |
| 12 |
#include "cache.h" |
#include "cache.h" |
| 13 |
|
#include "sum.h" |
| 14 |
|
|
| 15 |
|
// processor status register |
| 16 |
|
class PSR { |
| 17 |
|
private: |
| 18 |
|
// CWP - current window pointer |
| 19 |
|
unsigned int CWP : 5; |
| 20 |
|
|
| 21 |
|
// ET - traps enabled - NOT USED in SmArc |
| 22 |
|
unsigned int ET : 1; |
| 23 |
|
|
| 24 |
|
// PS - previous state (?) (user/supervisor mode) |
| 25 |
|
// NOT USED in SmArc |
| 26 |
|
unsigned int PS : 1; |
| 27 |
|
|
| 28 |
|
// S - state (?) (user/supervisor mode) |
| 29 |
|
// NOT USED in SmArc |
| 30 |
|
unsigned int S : 1; |
| 31 |
|
|
| 32 |
|
// PIL - interrupt mask - NOT USED in SmArc |
| 33 |
|
unsigned int PIL : 4; |
| 34 |
|
|
| 35 |
|
// EF - enable ftp - NOT USED in SmArc (i'm not sure) |
| 36 |
|
unsigned int EF : 1; |
| 37 |
|
|
| 38 |
|
// EC - enable coprocessor - NOT USED in SmArc (i'm not sure) |
| 39 |
|
unsigned int EC : 1; |
| 40 |
|
|
| 41 |
|
// C - carry flag |
| 42 |
|
unsigned int C : 1; |
| 43 |
|
|
| 44 |
|
// V - overflow flag |
| 45 |
|
unsigned int V : 1; |
| 46 |
|
|
| 47 |
|
// Z - zero flag |
| 48 |
|
unsigned int Z : 1; |
| 49 |
|
|
| 50 |
|
// N - negative flag |
| 51 |
|
unsigned int N : 1; |
| 52 |
|
|
| 53 |
|
// VER - version |
| 54 |
|
unsigned int VER : 4; |
| 55 |
|
|
| 56 |
|
// IMPL - implementation |
| 57 |
|
unsigned int IMPL : 4; |
| 58 |
|
|
| 59 |
|
public: |
| 60 |
|
PSR( void ) |
| 61 |
|
: |
| 62 |
|
// FIXME: is this right? |
| 63 |
|
CWP(0), |
| 64 |
|
|
| 65 |
|
// traps disabled |
| 66 |
|
ET(0), |
| 67 |
|
|
| 68 |
|
// supervisor mode on |
| 69 |
|
PS(1), S(1), |
| 70 |
|
|
| 71 |
|
// traps mask set to 0 |
| 72 |
|
PIL(0), |
| 73 |
|
|
| 74 |
|
// flp and coprocessor disabled |
| 75 |
|
EF(0), EC(0), |
| 76 |
|
|
| 77 |
|
// N, Z, V, C - cleared |
| 78 |
|
C(0),V(0),Z(0),N(0), |
| 79 |
|
|
| 80 |
|
// version and implementation set to 1 |
| 81 |
|
// FIXME: better ideas? |
| 82 |
|
VER(1), IMPL(1) {}; |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
friend class processor; |
| 86 |
|
}; |
| 87 |
|
|
| 88 |
class processor { |
class processor { |
| 89 |
private: |
private: |
| 90 |
|
PSR psr; |
| 91 |
|
|
| 92 |
// phase 1. IF (instruction fetch) |
// phase 1. IF (instruction fetch) |
| 93 |
internal_reg nPC; |
internal_reg nPC; |
| 94 |
cache ICache; |
cache ICache; |
| 119 |
unsigned char ppOP; |
unsigned char ppOP; |
| 120 |
internal_reg pT, D; |
internal_reg pT, D; |
| 121 |
internal_reg ppDR; |
internal_reg ppDR; |
| 122 |
mplexer Mpx9 |
mplexer Mpx9; |
| 123 |
|
|
| 124 |
public: |
public: |
| 125 |
}; |
}; |