1 | #ifdef VHDL |
---|
2 | /* |
---|
3 | * $Id: Shifter_vhdl_declaration.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/Shifter/include/Shifter.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace generic { |
---|
14 | namespace shifter { |
---|
15 | |
---|
16 | |
---|
17 | void Shifter::vhdl_declaration (Vhdl * & vhdl) |
---|
18 | { |
---|
19 | uint32_t log2_size_data = static_cast<uint32_t>(ceil(log2(_param._size_data))); |
---|
20 | |
---|
21 | vhdl->set_constant("cst_is_direction_left ",1,_left ); |
---|
22 | vhdl->set_constant("cst_is_direction_right ",1,_right ); |
---|
23 | vhdl->set_constant("cst_is_type_shift ",1,_shift ); |
---|
24 | vhdl->set_constant("cst_is_type_rotate ",1,_rotate ); |
---|
25 | vhdl->set_constant("cst_is_carry_arithmetic",1,_arithmetic); |
---|
26 | vhdl->set_constant("cst_is_carry_logic ",1,_logic ); |
---|
27 | vhdl->set_constant("cst_completion ",_param._size_data,"(others => '1')"); |
---|
28 | |
---|
29 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
30 | { |
---|
31 | if (_param._shift_value != 0) |
---|
32 | vhdl->set_constant("shift_"+toString(i),log2_size_data, _param._shift_value); |
---|
33 | else |
---|
34 | vhdl->set_alias ("shift_"+toString(i),std_logic(log2_size_data), "in_SHIFTER_"+toString(i)+"_SHIFT",std_logic_range(log2_size_data)); |
---|
35 | |
---|
36 | if (_param._size_data_completion > 0) |
---|
37 | { |
---|
38 | vhdl->set_signal ("shifter_completion_left_"+toString(i)+" ",_param._size_data); |
---|
39 | vhdl->set_signal ("shifter_completion_right_"+toString(i)+"",_param._size_data); |
---|
40 | vhdl->set_signal ("mask_completion_left_"+toString(i)+" ",_param._size_data); |
---|
41 | vhdl->set_signal ("mask_completion_right_"+toString(i)+" ",_param._size_data); |
---|
42 | } |
---|
43 | |
---|
44 | //-----[ Shift logic Left ]-------------------------------------------- |
---|
45 | if (_param._have_shift_logic_left) |
---|
46 | vhdl->set_signal ("shift_logic_left_"+toString(i)+" ",_param._size_data); |
---|
47 | |
---|
48 | //-----[ Shift logic Right ]------------------------------------------- |
---|
49 | if (_param._have_shift_logic_right) |
---|
50 | vhdl->set_signal ("shift_logic_right_"+toString(i)+" ",_param._size_data); |
---|
51 | |
---|
52 | //-----[ Shift arithmetic Left ]--------------------------------------- |
---|
53 | if (_param._have_shift_arithmetic_left) |
---|
54 | vhdl->set_signal ("shift_arithmetic_left_"+toString(i)+" ",_param._size_data); |
---|
55 | |
---|
56 | //-----[ Shift arithmetic Right ]-------------------------------------- |
---|
57 | if (_param._have_shift_arithmetic_right) |
---|
58 | vhdl->set_signal ("shift_arithmetic_right_"+toString(i)+"",_param._size_data); |
---|
59 | |
---|
60 | //-----[ Rotate Left ]------------------------------------------------- |
---|
61 | if (_param._have_rotate_left) |
---|
62 | vhdl->set_signal ("rotate_left_"+toString(i)+" ",_param._size_data); |
---|
63 | |
---|
64 | //-----[ Rotate Right ]------------------------------------------------ |
---|
65 | if (_param._have_rotate_right) |
---|
66 | vhdl->set_signal ("rotate_right_"+toString(i)+" ",_param._size_data); |
---|
67 | } |
---|
68 | }; |
---|
69 | |
---|
70 | }; // end namespace shifter |
---|
71 | }; // end namespace generic |
---|
72 | }; // end namespace behavioural |
---|
73 | }; // end namespace morpheo |
---|
74 | #endif |
---|