1 | /* |
---|
2 | * $Id: Shifter_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Generic/Shifter/include/Shifter.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace generic { |
---|
13 | namespace shifter { |
---|
14 | |
---|
15 | |
---|
16 | void Shifter::allocation (void) |
---|
17 | { |
---|
18 | _component = new Component (_usage); |
---|
19 | |
---|
20 | Entity * entity = _component->set_entity (_name |
---|
21 | ,"Shifter" |
---|
22 | #ifdef POSITION |
---|
23 | ,COMBINATORY |
---|
24 | #endif |
---|
25 | ); |
---|
26 | |
---|
27 | _interfaces = entity->set_interfaces(); |
---|
28 | |
---|
29 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
30 | { |
---|
31 | Interface_fifo * interface = _interfaces->set_interface("" |
---|
32 | #ifdef POSITION |
---|
33 | , IN |
---|
34 | , SOUTH |
---|
35 | , "Generalist interface" |
---|
36 | #endif |
---|
37 | ); |
---|
38 | |
---|
39 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_NO); |
---|
40 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_NO); |
---|
41 | } |
---|
42 | #endif |
---|
43 | |
---|
44 | { |
---|
45 | // Interface "shifter" |
---|
46 | in_SHIFTER_DATA = new SC_IN (Tdata_t) * [_param->_nb_port]; |
---|
47 | if (_param->_shift_value == 0) |
---|
48 | in_SHIFTER_SHIFT = new SC_IN (Tshift_t) * [_param->_nb_port]; |
---|
49 | if (_param->_direction == external_direction) |
---|
50 | in_SHIFTER_DIRECTION = new SC_IN (Tdirection_t) * [_param->_nb_port]; |
---|
51 | if (_param->_rotate == external_rotate) |
---|
52 | in_SHIFTER_TYPE = new SC_IN (Ttype_t) * [_param->_nb_port]; |
---|
53 | if (_param->_carry == external_carry) |
---|
54 | in_SHIFTER_CARRY = new SC_IN (Tcarry_t) * [_param->_nb_port]; |
---|
55 | if (_param->_carry == external_completion) |
---|
56 | if (_param->_type_completion_bool == true) |
---|
57 | in_SHIFTER_CARRY_IN = new SC_IN (Tcontrol_t) * [_param->_nb_port]; |
---|
58 | else |
---|
59 | in_SHIFTER_COMPLETION= new SC_IN (Tdata_t) * [_param->_nb_port]; |
---|
60 | out_SHIFTER_DATA = new SC_OUT(Tdata_t) * [_param->_nb_port]; |
---|
61 | |
---|
62 | for (uint32_t i=0; i<_param->_nb_port; i++) |
---|
63 | { |
---|
64 | Interface_fifo * interface = _interfaces->set_interface("shifter_"+toString(i) |
---|
65 | #ifdef POSITION |
---|
66 | , IN |
---|
67 | , SOUTH |
---|
68 | , "Generalist interface" |
---|
69 | #endif |
---|
70 | ); |
---|
71 | |
---|
72 | in_SHIFTER_DATA [i] = interface->set_signal_in <Tdata_t > ("data" ,_param->_size_data); |
---|
73 | if (_param->_shift_value == 0) |
---|
74 | in_SHIFTER_SHIFT [i] = interface->set_signal_in <Tshift_t > ("shift" ,static_cast<uint32_t>(ceil(log2(_param->_size_data)))); |
---|
75 | if (_param->_direction == external_direction) |
---|
76 | in_SHIFTER_DIRECTION [i] = interface->set_signal_in <Tdirection_t> ("direction" ,1); |
---|
77 | if (_param->_rotate == external_rotate) |
---|
78 | in_SHIFTER_TYPE [i] = interface->set_signal_in <Ttype_t > ("type" ,1); |
---|
79 | if (_param->_carry == external_carry) |
---|
80 | in_SHIFTER_CARRY [i] = interface->set_signal_in <Tcarry_t > ("carry" ,1); |
---|
81 | if (_param->_carry == external_completion) |
---|
82 | if (_param->_type_completion_bool == true) |
---|
83 | in_SHIFTER_CARRY_IN [i] = interface->set_signal_in <Tcontrol_t > ("carry_in" ,1); |
---|
84 | else |
---|
85 | in_SHIFTER_COMPLETION [i] = interface->set_signal_in <Tdata_t > ("completion",_param->_size_data_completion); |
---|
86 | out_SHIFTER_DATA [i] = interface->set_signal_out <Tdata_t > ("data" ,_param->_size_data); |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | #ifdef POSITION |
---|
91 | if (usage_is_set(_usage,USE_POSITION)) |
---|
92 | _component->generate_file(); |
---|
93 | #endif |
---|
94 | |
---|
95 | }; |
---|
96 | |
---|
97 | }; // end namespace shifter |
---|
98 | }; // end namespace generic |
---|
99 | }; // end namespace behavioural |
---|
100 | }; // end namespace morpheo |
---|