1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: RegisterFile_Monolithic_genMealy_read.cpp 123 2009-06-08 20:43:30Z 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 | |
---|
17 | #undef FUNCTION |
---|
18 | #define FUNCTION "RegisterFile_Monolithic::genMealy_read" |
---|
19 | void RegisterFile_Monolithic::genMealy_read (void) |
---|
20 | { |
---|
21 | log_begin(RegisterFile_Monolithic,FUNCTION); |
---|
22 | log_function(RegisterFile_Monolithic,FUNCTION,_name.c_str()); |
---|
23 | |
---|
24 | if (PORT_READ(in_NRESET)) |
---|
25 | { |
---|
26 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
27 | { |
---|
28 | // Have a write? |
---|
29 | if ( PORT_READ(in_READ_VAL [i]) == 1) |
---|
30 | { |
---|
31 | Taddress_t address; |
---|
32 | if (_param->_have_port_address) |
---|
33 | address = PORT_READ(in_READ_ADDRESS[i]); |
---|
34 | else |
---|
35 | address = 0; |
---|
36 | Tdata_t data = reg_DATA[address]; |
---|
37 | |
---|
38 | log_printf(TRACE,RegisterFile,FUNCTION," * [%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
39 | |
---|
40 | // Write in registerFile |
---|
41 | PORT_WRITE(out_READ_DATA[i],data); |
---|
42 | } |
---|
43 | else |
---|
44 | { |
---|
45 | //log_printf(TRACE,RegisterFile,FUNCTION,"Read [%d] : No transaction",i); |
---|
46 | PORT_WRITE(out_READ_DATA[i],0); |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
51 | { |
---|
52 | Tdata_t data; |
---|
53 | |
---|
54 | // Have a write? |
---|
55 | if ( (PORT_READ(in_READ_WRITE_VAL [i]) == 1) and |
---|
56 | (PORT_READ(in_READ_WRITE_RW [i]) == RW_READ) |
---|
57 | ) |
---|
58 | { |
---|
59 | Taddress_t address; |
---|
60 | if (_param->_have_port_address) |
---|
61 | address = PORT_READ(in_READ_WRITE_ADDRESS[i]); |
---|
62 | else |
---|
63 | address = 0; |
---|
64 | |
---|
65 | data = reg_DATA[address]; |
---|
66 | |
---|
67 | log_printf(TRACE,RegisterFile,FUNCTION," * [%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
68 | } |
---|
69 | else |
---|
70 | { |
---|
71 | //log_printf(TRACE,RegisterFile,FUNCTION,"Read [%d] : No transaction",i); |
---|
72 | data = 0; |
---|
73 | } |
---|
74 | |
---|
75 | PORT_WRITE(out_READ_WRITE_RDATA[i],data); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | log_end(RegisterFile_Monolithic,FUNCTION); |
---|
80 | }; |
---|
81 | |
---|
82 | }; // end namespace registerfile_monolithic |
---|
83 | }; // end namespace registerfile |
---|
84 | }; // end namespace generic |
---|
85 | }; // end namespace behavioural |
---|
86 | }; // end namespace morpheo |
---|
87 | #endif |
---|