| 9 |
|
|
| 10 |
#include "internal_reg.h" |
#include "internal_reg.h" |
| 11 |
#include "mplexer.h" |
#include "mplexer.h" |
| 12 |
|
#include "cache.h" |
| 13 |
|
|
| 14 |
class processor { |
class processor { |
| 15 |
private: |
private: |
| 16 |
// phase 1. IF (instruction fetch) |
// phase 1. IF (instruction fetch) |
| 17 |
internal_reg nPC; |
internal_reg nPC; |
| 18 |
// I Cache |
cache ICache; |
| 19 |
|
|
| 20 |
// phase 2. ID (instruction decode) |
// phase 2. ID (instruction decode) |
| 21 |
internal_reg PC, IR; |
internal_reg PC, IR; |
| 24 |
mplexer Mpx3; |
mplexer Mpx3; |
| 25 |
|
|
| 26 |
// phase 3. EX/AC (execution/address calculation) |
// phase 3. EX/AC (execution/address calculation) |
| 27 |
unsigned long OP; |
unsigned char OP; |
| 28 |
internal_reg pPC, A1, A2, R; |
internal_reg pPC, A1, A2, R; |
| 29 |
internal_reg DR; |
internal_reg DR; |
| 30 |
mplexer Mpx4, Mpx5; |
mplexer Mpx4, Mpx5; |
| 33 |
// ALU |
// ALU |
| 34 |
|
|
| 35 |
// phase 4. MA (memory access) |
// phase 4. MA (memory access) |
| 36 |
unsigned long pOP; |
unsigned char pOP; |
| 37 |
internal_reg T, pR; |
internal_reg T, pR; |
| 38 |
internal_reg pDR; |
internal_reg pDR; |
| 39 |
mplexer Mpx8; |
mplexer Mpx8; |
| 40 |
// D Cache |
cache DCache; |
| 41 |
|
|
| 42 |
// phase 5. WB |
// phase 5. WB |
| 43 |
unsigned long ppOP; |
unsigned char ppOP; |
| 44 |
internal_reg pT, D; |
internal_reg pT, D; |
| 45 |
internal_reg ppDR; |
internal_reg ppDR; |
| 46 |
mplexer Mpx9 |
mplexer Mpx9 |