1 | #ifdef SYSTEMC |
---|
2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
3 | /* |
---|
4 | * $Id: RegisterFile_Multi_Banked_partial_crossbar_genMealy_write.cpp 106 2009-02-09 22:55:26Z rosiere $ |
---|
5 | * |
---|
6 | * [ Description ] |
---|
7 | * |
---|
8 | */ |
---|
9 | |
---|
10 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace generic { |
---|
15 | namespace registerfile { |
---|
16 | namespace registerfile_multi_banked { |
---|
17 | |
---|
18 | |
---|
19 | #undef FUNCTION |
---|
20 | #define FUNCTION "RegisterFile_Multi_Banked::partial_crossbar_genMealy_write" |
---|
21 | void RegisterFile_Multi_Banked::partial_crossbar_genMealy_write (void) |
---|
22 | { |
---|
23 | log_begin(RegisterFile_Multi_Banked,FUNCTION); |
---|
24 | log_function(RegisterFile_Multi_Banked,FUNCTION,_name.c_str()); |
---|
25 | |
---|
26 | bool write_port_use [_param->_nb_bank][_param->_nb_port_write_by_bank]; |
---|
27 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
28 | for (uint32_t j=0; j<_param->_nb_port_write_by_bank; j++) |
---|
29 | write_port_use [i][j]=false; |
---|
30 | |
---|
31 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
32 | { |
---|
33 | bool val = PORT_READ(in_WRITE_VAL [i]); |
---|
34 | bool ack = false; |
---|
35 | |
---|
36 | log_printf(TRACE,RegisterFile_Multi_Banked,FUNCTION," * write [%d] : %d",i,val); |
---|
37 | |
---|
38 | if (val == true) |
---|
39 | { |
---|
40 | val = false; |
---|
41 | // Compute the adress of the bank |
---|
42 | Taddress_t address; |
---|
43 | if (_param->_have_port_address == true) |
---|
44 | address = PORT_READ(in_WRITE_ADDRESS[i]); |
---|
45 | else |
---|
46 | address = 0; |
---|
47 | log_printf(TRACE,RegisterFile_Multi_Banked,FUNCTION," * address : %d",address); |
---|
48 | Taddress_t bank = address_bank (address); |
---|
49 | log_printf(TRACE,RegisterFile_Multi_Banked,FUNCTION," * bank : %d",bank ); |
---|
50 | |
---|
51 | // // Search loop |
---|
52 | // for (uint32_t j=0; j<_param->_nb_port_write_by_bank; j++) |
---|
53 | // { |
---|
54 | uint32_t j = _param->_link_port_write_to_bank_write [i]; |
---|
55 | |
---|
56 | // find a unbusy port on this bank |
---|
57 | if (write_port_use[bank][j] == false) |
---|
58 | { |
---|
59 | // find !!! |
---|
60 | write_port_use[bank][j] = true; |
---|
61 | val = true; |
---|
62 | ack = true; |
---|
63 | |
---|
64 | Taddress_t num_reg = address_num_reg (address); |
---|
65 | |
---|
66 | log_printf(TRACE,RegisterFile_Multi_Banked,FUNCTION," * num_reg : %d",num_reg); |
---|
67 | log_printf(TRACE,RegisterFile_Multi_Banked,FUNCTION," * bank_port : %d",j ); |
---|
68 | |
---|
69 | internal_WRITE_NUM_REG [i] = num_reg; |
---|
70 | |
---|
71 | // break; |
---|
72 | } |
---|
73 | // } |
---|
74 | |
---|
75 | internal_WRITE_BANK [i] = bank; |
---|
76 | } |
---|
77 | |
---|
78 | internal_WRITE_VAL [i] = val; |
---|
79 | |
---|
80 | // Write output |
---|
81 | PORT_WRITE(out_WRITE_ACK [i], ack); |
---|
82 | } |
---|
83 | |
---|
84 | log_end(RegisterFile_Multi_Banked,FUNCTION); |
---|
85 | }; |
---|
86 | |
---|
87 | }; // end namespace registerfile_multi_banked |
---|
88 | }; // end namespace registerfile |
---|
89 | }; // end namespace generic |
---|
90 | |
---|
91 | }; // end namespace behavioural |
---|
92 | }; // end namespace morpheo |
---|
93 | #endif |
---|
94 | //#endif |
---|