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

Subversion Repositories scarm

[/] [scarm/] [trunk/] [src/] [scNPC.cpp] - Blame information for rev 10

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

Line No. Rev Author Line
1 5 zhong
// scNPC.cpp: implementation of the scNPC class.
2
//
3
//////////////////////////////////////////////////////////////////////
4
 
5
#include "scNPC.h"
6
 
7
//////////////////////////////////////////////////////////////////////
8
// Construction/Destruction
9
//////////////////////////////////////////////////////////////////////
10
 
11
scNPC::scNPC(sc_module_name name_):sc_module(name_)
12
{
13
       m_b_start=1;
14
           m_b_branch=0;
15
           m_nNPC=0;
16
           SC_METHOD(next_pc);
17
              sensitive<<in_b_Clock;
18
           SC_METHOD(write_pc);
19
           SC_METHOD(delay1);
20
           SC_METHOD(delay2);
21
           SC_METHOD(delay3);
22
}
23
 
24
scNPC::~scNPC()
25
{
26
 
27
}
28
 
29
void scNPC::next_pc()
30
{
31
   m_b_B=in_b_B;
32
   m_n_B=in_n_B;
33
   m_PC=in_PC;
34
 
35
      trigger1_npc.notify(SC_ZERO_TIME);
36
 
37
 
38
}
39
 
40
void scNPC::write_pc()
41
{
42
        next_trigger(trigger);
43
 
44
        out_b_RW_PC=1;// 0-Read  1-Write
45
    out_REG_PC=R_PC;
46
        out_n_NPC=m_nNPC;
47
}
48
 
49
void scNPC::delay1 ()
50
{
51
        next_trigger(trigger1_npc);
52
 
53
    trigger2_npc.notify(SC_ZERO_TIME);
54
}
55
 
56
void scNPC::delay2()
57
{
58
        next_trigger(trigger2_npc);
59
 
60
   trigger3_npc.notify(SC_ZERO_TIME);
61
}
62
 
63
void scNPC::delay3()
64
{
65
        next_trigger(trigger3_npc);
66
if(in_b_hold==0)
67
{
68
        if(m_b_B==0){
69
 
70
                m_nNPC=m_PC+4;
71
        }
72
        else
73
        {
74
                m_nNPC=m_n_B;
75
 
76
        }
77
 
78
 
79
        //cout<<"bengin write pc"<<endl;
80
 
81
        inout_n_Data_PC=m_nNPC;
82
 
83
       trigger.notify(SC_ZERO_TIME);
84
        //cout<<"endl write pc"<<endl;
85
}
86
 
87
}

powered by: WebSVN 2.1.0

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