1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id$ |
---|
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 | void RegisterFile_Monolithic::allocation (void) |
---|
18 | { |
---|
19 | #ifdef POSITION |
---|
20 | _position = new Position (); |
---|
21 | |
---|
22 | Entity * entity = _position->set_entity (_name , |
---|
23 | "RegisterFile_Monolithic", |
---|
24 | REGISTER ); |
---|
25 | |
---|
26 | _interfaces = entity->set_interfaces(); |
---|
27 | #else |
---|
28 | _interfaces = new Interfaces(); |
---|
29 | #endif |
---|
30 | |
---|
31 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
32 | Interface * interface_ = _interfaces->set_interface("", IN ,SOUTH, "Generalist interface"); |
---|
33 | |
---|
34 | in_CLOCK = interface_->set_signal_clk ("clock" ,1); |
---|
35 | in_NRESET = interface_->set_signal_in <Tcontrol_t> ("nreset",1); |
---|
36 | |
---|
37 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
38 | |
---|
39 | in_READ_VAL = new SC_IN (Tcontrol_t) * [_param._nb_port_read]; |
---|
40 | out_READ_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_port_read]; |
---|
41 | in_READ_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_port_read]; |
---|
42 | out_READ_DATA = new SC_OUT(Tdata_t ) * [_param._nb_port_read]; |
---|
43 | |
---|
44 | for (uint32_t i=0; i<_param._nb_port_read; i++) |
---|
45 | { |
---|
46 | Interface_fifo * interface_read = _interfaces->set_interface("read_"+toString(i), IN ,WEST, "Interface Read"); |
---|
47 | |
---|
48 | in_READ_VAL [i] = interface_read->set_signal_valack_in ("val" , VAL); |
---|
49 | out_READ_ACK [i] = interface_read->set_signal_valack_out ("ack" , ACK); |
---|
50 | in_READ_ADDRESS [i] = interface_read->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(log2(_param._nb_word))); |
---|
51 | out_READ_DATA [i] = interface_read->set_signal_out <Tdata_t > ("data" , _param._size_word); |
---|
52 | } |
---|
53 | |
---|
54 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
55 | |
---|
56 | in_WRITE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_port_write]; |
---|
57 | out_WRITE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_port_write]; |
---|
58 | in_WRITE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_port_write]; |
---|
59 | in_WRITE_DATA = new SC_IN (Tdata_t ) * [_param._nb_port_write]; |
---|
60 | |
---|
61 | for (uint32_t i=0; i<_param._nb_port_write; i++) |
---|
62 | { |
---|
63 | Interface_fifo * interface_write = _interfaces->set_interface("write_"+toString(i), IN ,EAST, "Interface Write"); |
---|
64 | |
---|
65 | in_WRITE_VAL [i] = interface_write->set_signal_valack_in ("val" , VAL); |
---|
66 | out_WRITE_ACK [i] = interface_write->set_signal_valack_out ("ack" , ACK); |
---|
67 | in_WRITE_ADDRESS [i] = interface_write->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(log2(_param._nb_word))); |
---|
68 | in_WRITE_DATA [i] = interface_write->set_signal_in <Tdata_t > ("data" , _param._size_word); |
---|
69 | } |
---|
70 | |
---|
71 | // ----- Register |
---|
72 | reg_DATA = new SC_REGISTER (Tdata_t) * [_param._nb_word]; |
---|
73 | |
---|
74 | for (uint32_t i=0; i<_param._nb_word; i++) |
---|
75 | { |
---|
76 | string rename = "reg_DATA[" + toString(i) + "]"; |
---|
77 | reg_DATA [i] = new SC_REGISTER (Tdata_t) (rename.c_str()); |
---|
78 | } |
---|
79 | |
---|
80 | #ifdef POSITION |
---|
81 | _position->generate_file(); |
---|
82 | #endif |
---|
83 | }; |
---|
84 | |
---|
85 | }; // end namespace registerfile_monolithic |
---|
86 | }; // end namespace registerfile |
---|
87 | }; // end namespace generic |
---|
88 | }; // end namespace behavioural |
---|
89 | }; // end namespace morpheo |
---|
90 | #endif |
---|