1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: RegisterFile_Monolithic_transition.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace generic { |
---|
14 | namespace registerfile { |
---|
15 | namespace registerfile_monolithic { |
---|
16 | void RegisterFile_Monolithic::transition (void) |
---|
17 | { |
---|
18 | log_printf(FUNC,RegisterFile,"transition","Begin"); |
---|
19 | |
---|
20 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
21 | { |
---|
22 | // Have a write? |
---|
23 | if ( PORT_READ(in_WRITE_VAL[i]) == true) |
---|
24 | { |
---|
25 | #ifdef STATISTICS |
---|
26 | (*_stat_nb_write) ++; |
---|
27 | #endif |
---|
28 | |
---|
29 | Taddress_t address; |
---|
30 | if (_param->_have_port_address) |
---|
31 | address = PORT_READ(in_WRITE_ADDRESS[i]); |
---|
32 | else |
---|
33 | address = 0; |
---|
34 | |
---|
35 | Tdata_t data = PORT_READ(in_WRITE_DATA [i]); |
---|
36 | |
---|
37 | log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
38 | |
---|
39 | // Write in registerFile |
---|
40 | reg_DATA[address] = data; |
---|
41 | } |
---|
42 | } |
---|
43 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
44 | { |
---|
45 | // Have a read_write? |
---|
46 | if (PORT_READ(in_READ_WRITE_VAL[i]) == true) |
---|
47 | { |
---|
48 | if (PORT_READ(in_READ_WRITE_RW [i]) == RW_WRITE) |
---|
49 | { |
---|
50 | #ifdef STATISTICS |
---|
51 | (*_stat_nb_write) ++; |
---|
52 | #endif |
---|
53 | |
---|
54 | Taddress_t address; |
---|
55 | if (_param->_have_port_address) |
---|
56 | address = PORT_READ(in_READ_WRITE_ADDRESS[i]); |
---|
57 | else |
---|
58 | address = 0; |
---|
59 | Tdata_t data = PORT_READ(in_READ_WRITE_WDATA [i]); |
---|
60 | |
---|
61 | log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
62 | |
---|
63 | // Write in registerFile |
---|
64 | reg_DATA[address] = data; |
---|
65 | } |
---|
66 | #ifdef STATISTICS |
---|
67 | else |
---|
68 | { |
---|
69 | (*_stat_nb_read) ++; |
---|
70 | } |
---|
71 | #endif |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | #ifdef STATISTICS |
---|
76 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
77 | if ( PORT_READ(in_READ_VAL [i]) == 1) |
---|
78 | (*_stat_nb_read) ++; |
---|
79 | #endif |
---|
80 | |
---|
81 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
82 | end_cycle(); |
---|
83 | #endif |
---|
84 | log_printf(FUNC,RegisterFile,"transition","End"); |
---|
85 | }; |
---|
86 | |
---|
87 | }; // end namespace registerfile_monolithic |
---|
88 | }; // end namespace registerfile |
---|
89 | }; // end namespace generic |
---|
90 | }; // end namespace behavioural |
---|
91 | }; // end namespace morpheo |
---|
92 | #endif |
---|