- Timestamp:
- Jul 5, 2007, 5:50:19 PM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter.cpp
r2 r42 15 15 16 16 #ifdef SYSTEMC 17 Shifter::Shifter (sc_module_name name ,17 Shifter::Shifter (sc_module_name name 18 18 #else 19 Shifter::Shifter (string name ,19 Shifter::Shifter (string name 20 20 #endif 21 21 #ifdef STATISTICS 22 morpheo::behavioural::Parameters_Statistics param_statistics,22 ,morpheo::behavioural::Parameters_Statistics param_statistics 23 23 #endif 24 morpheo::behavioural::generic::shifter::Parameters param ):24 ,morpheo::behavioural::generic::shifter::Parameters param ): 25 25 _name (name) 26 26 ,_param (param) 27 27 { 28 #ifdef SYSTEMC 29 allocation (); 30 #endif 31 28 32 #ifdef STATISTICS 29 33 // Allocation of statistics … … 31 35 param_statistics , 32 36 param); 33 #endif34 35 #ifdef VHDL_TESTBENCH36 // Creation of a testbench37 // -> port38 // -> clock's signals39 _vhdl_testbench = new Vhdl_Testbench (_name);40 vhdl_testbench_port (*_vhdl_testbench);41 _vhdl_testbench->set_clock ("in_CLOCK",false);42 37 #endif 43 38 … … 48 43 49 44 #ifdef SYSTEMC 50 allocation ();51 52 45 #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) 53 46 SC_METHOD (transition); … … 107 100 #endif 108 101 109 #ifdef VHDL_TESTBENCH110 // generate the test bench111 _vhdl_testbench->generate_file();112 delete _vhdl_testbench;113 #endif114 115 102 #ifdef STATISTICS 116 103 _stat->generate_file(statistics(0)); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_allocation.cpp
r2 r42 17 17 void Shifter::allocation (void) 18 18 { 19 string rename; 19 _component = new Component (); 20 21 Entity * entity = _component->set_entity (_name 22 ,"Shifter" 23 #ifdef POSITION 24 ,COMBINATORY 25 #endif 26 ); 27 28 _interfaces = entity->set_interfaces(); 20 29 21 30 #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) 22 in_CLOCK = new SC_CLOCK ("SC_CLOCK"); 31 { 32 Interface_fifo * interface = _interfaces->set_interface("" 33 #ifdef POSITION 34 , IN 35 , SOUTH 36 , "Generalist interface" 23 37 #endif 24 // Interface "shifter" 25 in_SHIFTER_DATA = new SC_IN (Tdata_t) * [_param._nb_port]; 26 if (_param._shift_value == 0) 27 in_SHIFTER_SHIFT = new SC_IN (Tshift_t) * [_param._nb_port]; 28 if (_param._direction == external_direction) 29 in_SHIFTER_DIRECTION = new SC_IN (Tdirection_t) * [_param._nb_port]; 30 if (_param._rotate == external_rotate) 31 in_SHIFTER_TYPE = new SC_IN (Ttype_t) * [_param._nb_port]; 32 if (_param._carry == external_carry) 33 in_SHIFTER_CARRY = new SC_IN (Tcarry_t) * [_param._nb_port]; 34 if (_param._carry == external_completion) 35 if (_param._type_completion_bool == true) 36 in_SHIFTER_CARRY_IN = new SC_IN (Tcontrol_t) * [_param._nb_port]; 37 else 38 in_SHIFTER_COMPLETION= new SC_IN (Tdata_t) * [_param._nb_port]; 39 out_SHIFTER_DATA = new SC_OUT(Tdata_t) * [_param._nb_port]; 38 ); 39 40 in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_NO); 41 in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_NO); 42 } 43 #endif 40 44 41 for (uint32_t i=0; i<_param._nb_port; i++) 42 { 43 rename = "in_SHIFTER_DATA[" + toString(i) + "]"; 44 in_SHIFTER_DATA [i] = new SC_IN (Tdata_t) (rename.c_str()); 45 { 46 // Interface "shifter" 47 in_SHIFTER_DATA = new SC_IN (Tdata_t) * [_param._nb_port]; 48 if (_param._shift_value == 0) 49 in_SHIFTER_SHIFT = new SC_IN (Tshift_t) * [_param._nb_port]; 50 if (_param._direction == external_direction) 51 in_SHIFTER_DIRECTION = new SC_IN (Tdirection_t) * [_param._nb_port]; 52 if (_param._rotate == external_rotate) 53 in_SHIFTER_TYPE = new SC_IN (Ttype_t) * [_param._nb_port]; 54 if (_param._carry == external_carry) 55 in_SHIFTER_CARRY = new SC_IN (Tcarry_t) * [_param._nb_port]; 56 if (_param._carry == external_completion) 57 if (_param._type_completion_bool == true) 58 in_SHIFTER_CARRY_IN = new SC_IN (Tcontrol_t) * [_param._nb_port]; 59 else 60 in_SHIFTER_COMPLETION= new SC_IN (Tdata_t) * [_param._nb_port]; 61 out_SHIFTER_DATA = new SC_OUT(Tdata_t) * [_param._nb_port]; 62 63 for (uint32_t i=0; i<_param._nb_port; i++) 64 { 65 Interface_fifo * interface = _interfaces->set_interface("shifter_"+toString(i) 66 #ifdef POSITION 67 , IN 68 , SOUTH 69 , "Generalist interface" 70 #endif 71 ); 72 73 in_SHIFTER_DATA [i] = interface->set_signal_in <Tdata_t > ("data" ,_param._size_data); 74 if (_param._shift_value == 0) 75 in_SHIFTER_SHIFT [i] = interface->set_signal_in <Tshift_t > ("shift" ,static_cast<uint32_t>(ceil(log2(_param._size_data)))); 76 if (_param._direction == external_direction) 77 in_SHIFTER_DIRECTION [i] = interface->set_signal_in <Tdirection_t> ("direction" ,1); 78 if (_param._rotate == external_rotate) 79 in_SHIFTER_TYPE [i] = interface->set_signal_in <Ttype_t > ("type" ,1); 80 if (_param._carry == external_carry) 81 in_SHIFTER_CARRY [i] = interface->set_signal_in <Tcarry_t > ("carry" ,1); 82 if (_param._carry == external_completion) 83 if (_param._type_completion_bool == true) 84 in_SHIFTER_CARRY_IN [i] = interface->set_signal_in <Tcontrol_t > ("carry_in" ,1); 85 else 86 in_SHIFTER_COMPLETION [i] = interface->set_signal_in <Tdata_t > ("completion",_param._size_data_completion); 87 out_SHIFTER_DATA [i] = interface->set_signal_out <Tdata_t > ("data" ,_param._size_data); 88 } 89 } 45 90 46 if (_param._shift_value == 0) 47 { 48 rename = "in_SHIFTER_SHIFT[" + toString(i) + "]"; 49 in_SHIFTER_SHIFT [i] = new SC_IN (Tshift_t) (rename.c_str()); 50 } 51 if (_param._direction == external_direction) 52 { 53 rename = "in_SHIFTER_DIRECTION[" + toString(i) + "]"; 54 in_SHIFTER_DIRECTION [i] = new SC_IN (Tdirection_t) (rename.c_str()); 55 } 56 if (_param._rotate == external_rotate) 57 { 58 rename = "in_SHIFTER_TYPE[" + toString(i) + "]"; 59 in_SHIFTER_TYPE [i] = new SC_IN (Ttype_t) (rename.c_str()); 60 } 61 if (_param._carry == external_carry) 62 { 63 rename = "in_SHIFTER_CARRY[" + toString(i) + "]"; 64 in_SHIFTER_CARRY [i] = new SC_IN (Tcarry_t) (rename.c_str()); 65 } 91 #ifdef POSITION 92 _component->generate_file(); 93 #endif 66 94 67 if (_param._carry == external_completion)68 if (_param._type_completion_bool == true)69 {70 rename = "in_SHIFTER_CARRY_IN[" + toString(i) + "]";71 in_SHIFTER_CARRY_IN [i] = new SC_IN (Tcontrol_t) (rename.c_str());72 }73 else74 {75 rename = "in_SHIFTER_COMPLETION[" + toString(i) + "]";76 in_SHIFTER_COMPLETION [i] = new SC_IN (Tdata_t) (rename.c_str());77 }78 79 rename = "out_SHIFTER_DATA[" + toString(i) + "]";80 out_SHIFTER_DATA [i] = new SC_OUT(Tdata_t) (rename.c_str());81 }82 95 }; 83 96 84 97 }; // end namespace shifter 85 98 }; // end namespace generic -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_deallocation.cpp
r2 r42 18 18 { 19 19 #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) 20 delete in_CLOCK;20 delete in_CLOCK; 21 21 #endif 22 22 23 // Interface "shifter" 24 for (uint32_t i=0; i<_param._nb_port; i++) 25 { 26 delete in_SHIFTER_DATA [i]; 27 if (_param._shift_value == 0) 28 delete in_SHIFTER_SHIFT [i]; 29 if (_param._direction == external_direction) 30 delete in_SHIFTER_DIRECTION [i]; 31 if (_param._rotate == external_rotate) 32 delete in_SHIFTER_TYPE [i]; 33 if (_param._carry == external_carry) 34 delete in_SHIFTER_CARRY [i]; 35 if (_param._carry == external_completion) 36 if (_param._type_completion_bool == true) 37 delete in_SHIFTER_CARRY_IN [i]; 38 else 39 delete in_SHIFTER_COMPLETION[i]; 40 delete out_SHIFTER_DATA [i]; 41 } 23 delete [] in_SHIFTER_DATA ; 24 if (_param._shift_value == 0) 25 delete [] in_SHIFTER_SHIFT ; 26 if (_param._direction == external_direction ) 27 delete [] in_SHIFTER_DIRECTION ; 28 if (_param._rotate == external_rotate ) 29 delete [] in_SHIFTER_TYPE ; 30 if (_param._carry == external_carry ) 31 delete [] in_SHIFTER_CARRY ; 32 if (_param._carry == external_completion) 33 if (_param._type_completion_bool == true) 34 delete [] in_SHIFTER_CARRY_IN ; 35 else 36 delete [] in_SHIFTER_COMPLETION; 37 delete [] out_SHIFTER_DATA ; 42 38 43 delete in_SHIFTER_DATA ; 44 if (_param._shift_value == 0) 45 delete in_SHIFTER_SHIFT ; 46 if (_param._direction == external_direction ) 47 delete in_SHIFTER_DIRECTION ; 48 if (_param._rotate == external_rotate ) 49 delete in_SHIFTER_TYPE ; 50 if (_param._carry == external_carry ) 51 delete in_SHIFTER_CARRY ; 52 if (_param._carry == external_completion) 53 if (_param._type_completion_bool == true) 54 delete in_SHIFTER_CARRY_IN ; 55 else 56 delete in_SHIFTER_COMPLETION; 57 delete out_SHIFTER_DATA ; 39 delete _component; 40 58 41 }; 59 42 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_transition.cpp
r2 r42 23 23 24 24 #ifdef VHDL_TESTBENCH 25 vhdl_testbench_transition ( *_vhdl_testbench);25 vhdl_testbench_transition (); 26 26 #endif 27 27 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_vhdl.cpp
r2 r42 18 18 void Shifter::vhdl (void) 19 19 { 20 Vhdl vhdl (_name);20 Vhdl * vhdl = new Vhdl (_name); 21 21 22 vhdl .set_library_work (_name + "_Pack");22 vhdl->set_library_work (_name + "_Pack"); 23 23 24 24 vhdl_port (vhdl); … … 26 26 vhdl_body (vhdl); 27 27 28 vhdl.generate_file(); 28 vhdl->generate_file(); 29 30 delete vhdl; 29 31 }; 30 32 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_vhdl_body.cpp
r2 r42 15 15 16 16 17 void Shifter::vhdl_body (Vhdl & vhdl)17 void Shifter::vhdl_body (Vhdl * & vhdl) 18 18 { 19 19 //uint32_t log2_size_data = static_cast<uint32_t>(ceil(log2(_param._size_data))); 20 20 21 vhdl .set_body ("-- Compute all case of shift");21 vhdl->set_body ("-- Compute all case of shift"); 22 22 23 23 for (uint32_t i=0; i<_param._nb_port; i++) … … 25 25 //-----[ Shift logic Left ]-------------------------------------------- 26 26 if (_param._have_shift_logic_left) 27 vhdl .set_body ("shift_logic_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") sll CONV_INTEGER(shift_"+toString(i)+"));");27 vhdl->set_body ("shift_logic_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) sll CONV_INTEGER(shift_"+toString(i)+"));"); 28 28 //-----[ Shift logic Right ]------------------------------------------- 29 29 if (_param._have_shift_logic_right) 30 vhdl .set_body ("shift_logic_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") srl CONV_INTEGER(shift_"+toString(i)+"));");30 vhdl->set_body ("shift_logic_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) srl CONV_INTEGER(shift_"+toString(i)+"));"); 31 31 //-----[ Shift arithmetic Left ]--------------------------------------- 32 32 if (_param._have_shift_arithmetic_left) 33 vhdl .set_body ("shift_arithmetic_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") sla CONV_INTEGER(shift_"+toString(i)+"));");33 vhdl->set_body ("shift_arithmetic_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) sla CONV_INTEGER(shift_"+toString(i)+"));"); 34 34 //-----[ Shift arithmetic Right ]-------------------------------------- 35 35 if (_param._have_shift_arithmetic_right) 36 vhdl .set_body ("shift_arithmetic_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") sra CONV_INTEGER(shift_"+toString(i)+"));");36 vhdl->set_body ("shift_arithmetic_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) sra CONV_INTEGER(shift_"+toString(i)+"));"); 37 37 //-----[ Rotate Left ]------------------------------------------------- 38 38 if (_param._have_rotate_left) 39 vhdl .set_body ("rotate_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") rol CONV_INTEGER(shift_"+toString(i)+"));");39 vhdl->set_body ("rotate_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) rol CONV_INTEGER(shift_"+toString(i)+"));"); 40 40 //-----[ Rotate Right ]------------------------------------------------ 41 41 if (_param._have_rotate_right) 42 vhdl .set_body ("rotate_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") ror CONV_INTEGER(shift_"+toString(i)+"));");42 vhdl->set_body ("rotate_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) ror CONV_INTEGER(shift_"+toString(i)+"));"); 43 43 } 44 44 45 45 if (_param._size_data_completion > 0) 46 46 { 47 vhdl .set_body ("");48 vhdl .set_body ("-- Mask");47 vhdl->set_body (""); 48 vhdl->set_body ("-- Mask"); 49 49 50 50 for (uint32_t i=0; i<_param._nb_port; i++) … … 53 53 54 54 if (_param._type_completion_bool == true) 55 print_shifter_completion = "in_SHIFTER_ CARRY_IN";55 print_shifter_completion = "in_SHIFTER_"+toString(i)+"_CARRY_IN"; 56 56 else 57 print_shifter_completion = "in_SHIFTER_ COMPLETION";57 print_shifter_completion = "in_SHIFTER_"+toString(i)+"_COMPLETION"; 58 58 59 59 if (_param._size_data == _param._size_data_completion) 60 60 { 61 vhdl .set_body ("shifter_completion_left_"+toString(i)+" <= "+print_shifter_completion+"_"+toString(i)+";");62 vhdl .set_body ("shifter_completion_right_"+toString(i)+" <= "+print_shifter_completion+"_"+toString(i)+";");61 vhdl->set_body ("shifter_completion_left_"+toString(i)+" <= "+print_shifter_completion+";"); 62 vhdl->set_body ("shifter_completion_right_"+toString(i)+" <= "+print_shifter_completion+";"); 63 63 } 64 64 else 65 65 { 66 vhdl .set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data_completion)+" <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";");67 vhdl .set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data_completion )+" <= "+print_shifter_completion+"_"+toString(i)+";");68 69 vhdl .set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data-_param._size_data_completion)+" <= "+print_shifter_completion+"_"+toString(i)+";");70 vhdl .set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-_param._size_data_completion )+" <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";");71 } 72 73 vhdl .set_body ("mask_completion_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) sll CONV_INTEGER(shift_"+toString(i)+"));");74 vhdl .set_body ("mask_completion_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) srl CONV_INTEGER(shift_"+toString(i)+"));");66 vhdl->set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data_completion)+" <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";"); 67 vhdl->set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data_completion )+" <= "+print_shifter_completion+";"); 68 69 vhdl->set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data-_param._size_data_completion)+" <= "+print_shifter_completion+";"); 70 vhdl->set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-_param._size_data_completion )+" <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";"); 71 } 72 73 vhdl->set_body ("mask_completion_left_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) sll CONV_INTEGER(shift_"+toString(i)+"));"); 74 vhdl->set_body ("mask_completion_right_"+toString(i)+" <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) srl CONV_INTEGER(shift_"+toString(i)+"));"); 75 75 } 76 76 } 77 77 78 78 79 vhdl .set_body ("");80 vhdl .set_body ("-- Multiplexor");79 vhdl->set_body (""); 80 vhdl->set_body ("-- Multiplexor"); 81 81 82 82 for (uint32_t i=0; i<_param._nb_port; i++) 83 83 { 84 vhdl .set_body ("out_SHIFTER_DATA_"+toString(i)+"<=");84 vhdl->set_body ("out_SHIFTER_"+toString(i)+"_DATA <="); 85 85 string print_else = " "; 86 86 … … 95 95 { 96 96 have_when = true; 97 print_when += " in_SHIFTER_ DIRECTION_"+toString(i)+"= cst_is_direction_left ";98 print_and = " and "; 99 } 100 if (_param._rotate == external_rotate) 101 { 102 have_when = true; 103 print_when += print_and+" in_SHIFTER_ TYPE_"+toString(i)+"= cst_is_type_shift ";97 print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_left "; 98 print_and = " and "; 99 } 100 if (_param._rotate == external_rotate) 101 { 102 have_when = true; 103 print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift "; 104 104 print_and = " and "; 105 105 } … … 107 107 { 108 108 have_when = true; 109 print_when += print_and+" in_SHIFTER_ CARRY_"+toString(i)+"= cst_is_carry_arithmetic";110 } 111 112 if (have_when) 113 print_when = "when " + print_when; 114 115 vhdl .set_body ("\t"+print_else+" shift_arithmetic_left_"+toString(i)+" "+print_when);109 print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_arithmetic"; 110 } 111 112 if (have_when) 113 print_when = "when " + print_when; 114 115 vhdl->set_body ("\t"+print_else+" shift_arithmetic_left_"+toString(i)+" "+print_when); 116 116 print_else = "else"; 117 117 } … … 126 126 { 127 127 have_when = true; 128 print_when += " in_SHIFTER_ DIRECTION_"+toString(i)+"= cst_is_direction_right";129 print_and = " and "; 130 } 131 if (_param._rotate == external_rotate) 132 { 133 have_when = true; 134 print_when += print_and+" in_SHIFTER_ TYPE_"+toString(i)+"= cst_is_type_shift ";128 print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_right"; 129 print_and = " and "; 130 } 131 if (_param._rotate == external_rotate) 132 { 133 have_when = true; 134 print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift "; 135 135 print_and = " and "; 136 136 } … … 138 138 { 139 139 have_when = true; 140 print_when += print_and+" in_SHIFTER_ CARRY_"+toString(i)+"= cst_is_carry_arithmetic";141 } 142 143 if (have_when) 144 print_when = "when " + print_when; 145 146 vhdl .set_body ("\t"+print_else+" shift_arithmetic_right_"+toString(i)+" "+print_when);140 print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_arithmetic"; 141 } 142 143 if (have_when) 144 print_when = "when " + print_when; 145 146 vhdl->set_body ("\t"+print_else+" shift_arithmetic_right_"+toString(i)+" "+print_when); 147 147 print_else = "else"; 148 148 } … … 157 157 { 158 158 have_when = true; 159 print_when += " in_SHIFTER_ DIRECTION_"+toString(i)+"= cst_is_direction_left ";160 print_and = " and "; 161 } 162 if (_param._rotate == external_rotate) 163 { 164 have_when = true; 165 print_when += print_and+" in_SHIFTER_ TYPE_"+toString(i)+"= cst_is_type_shift ";159 print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_left "; 160 print_and = " and "; 161 } 162 if (_param._rotate == external_rotate) 163 { 164 have_when = true; 165 print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift "; 166 166 print_and = " and "; 167 167 } … … 169 169 { 170 170 have_when = true; 171 print_when += print_and+" in_SHIFTER_ CARRY_"+toString(i)+"= cst_is_carry_logic ";171 print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_logic "; 172 172 } 173 173 … … 182 182 print_expr_completion = "(shift_logic_left_"+toString(i)+" and mask_completion_left_"+toString(i)+" ) or ( shifter_completion_left_"+toString(i)+" and not mask_completion_left_"+toString(i)+" )"; 183 183 184 vhdl .set_body ("\t"+print_else+" "+print_expr_completion+" "+print_when);184 vhdl->set_body ("\t"+print_else+" "+print_expr_completion+" "+print_when); 185 185 print_else = "else"; 186 186 } … … 195 195 { 196 196 have_when = true; 197 print_when += " in_SHIFTER_ DIRECTION_"+toString(i)+"= cst_is_direction_right";198 print_and = " and "; 199 } 200 if (_param._rotate == external_rotate) 201 { 202 have_when = true; 203 print_when += print_and+" in_SHIFTER_ TYPE_"+toString(i)+"= cst_is_type_shift ";197 print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_right"; 198 print_and = " and "; 199 } 200 if (_param._rotate == external_rotate) 201 { 202 have_when = true; 203 print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift "; 204 204 print_and = " and "; 205 205 } … … 207 207 { 208 208 have_when = true; 209 print_when += print_and+" in_SHIFTER_ CARRY_"+toString(i)+"= cst_is_carry_logic ";209 print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_logic "; 210 210 } 211 211 … … 220 220 print_expr_completion = "(shift_logic_right_"+toString(i)+" and mask_completion_right_"+toString(i)+") or ( shifter_completion_right_"+toString(i)+" and not mask_completion_right_"+toString(i)+")"; 221 221 222 vhdl .set_body ("\t"+print_else+" "+print_expr_completion+" "+print_when);222 vhdl->set_body ("\t"+print_else+" "+print_expr_completion+" "+print_when); 223 223 print_else = "else"; 224 224 } … … 233 233 { 234 234 have_when = true; 235 print_when += " in_SHIFTER_ DIRECTION_"+toString(i)+"= cst_is_direction_left ";236 print_and = " and "; 237 } 238 if (_param._rotate == external_rotate) 239 { 240 have_when = true; 241 print_when += print_and+" in_SHIFTER_ TYPE_"+toString(i)+"= cst_is_type_rotate";242 print_and = " and "; 243 } 244 245 if (have_when) 246 print_when = "when " + print_when; 247 248 vhdl .set_body ("\t"+print_else+" rotate_left_"+toString(i)+" "+print_when);235 print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_left "; 236 print_and = " and "; 237 } 238 if (_param._rotate == external_rotate) 239 { 240 have_when = true; 241 print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_rotate"; 242 print_and = " and "; 243 } 244 245 if (have_when) 246 print_when = "when " + print_when; 247 248 vhdl->set_body ("\t"+print_else+" rotate_left_"+toString(i)+" "+print_when); 249 249 print_else = "else"; 250 250 } … … 259 259 { 260 260 have_when = true; 261 print_when += " in_SHIFTER_ DIRECTION_"+toString(i)+"= cst_is_direction_right";262 print_and = " and "; 263 } 264 if (_param._rotate == external_rotate) 265 { 266 have_when = true; 267 print_when += print_and+" in_SHIFTER_ TYPE_"+toString(i)+"= cst_is_type_rotate";268 print_and = " and "; 269 } 270 271 if (have_when) 272 print_when = "when " + print_when; 273 274 vhdl .set_body ("\t"+print_else+" rotate_right_"+toString(i)+" "+print_when);275 print_else = "else"; 276 } 277 vhdl .set_body (";");261 print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_right"; 262 print_and = " and "; 263 } 264 if (_param._rotate == external_rotate) 265 { 266 have_when = true; 267 print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_rotate"; 268 print_and = " and "; 269 } 270 271 if (have_when) 272 print_when = "when " + print_when; 273 274 vhdl->set_body ("\t"+print_else+" rotate_right_"+toString(i)+" "+print_when); 275 print_else = "else"; 276 } 277 vhdl->set_body (";"); 278 278 } 279 279 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_vhdl_declaration.cpp
r2 r42 15 15 16 16 17 void Shifter::vhdl_declaration (Vhdl & vhdl)17 void Shifter::vhdl_declaration (Vhdl * & vhdl) 18 18 { 19 19 uint32_t log2_size_data = static_cast<uint32_t>(ceil(log2(_param._size_data))); 20 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')");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 28 29 29 for (uint32_t i=0; i<_param._nb_port; i++) 30 30 { 31 31 if (_param._shift_value != 0) 32 vhdl .set_constant("shift_"+toString(i),log2_size_data, _param._shift_value);32 vhdl->set_constant("shift_"+toString(i),log2_size_data, _param._shift_value); 33 33 else 34 vhdl .set_alias ("shift_"+toString(i),std_logic(log2_size_data), "in_SHIFTER_SHIFT_"+toString(i),std_logic_range(log2_size_data));34 vhdl->set_alias ("shift_"+toString(i),std_logic(log2_size_data), "in_SHIFTER_"+toString(i)+"_SHIFT",std_logic_range(log2_size_data)); 35 35 36 36 if (_param._size_data_completion > 0) 37 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);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 42 } 43 43 44 44 //-----[ Shift logic Left ]-------------------------------------------- 45 45 if (_param._have_shift_logic_left) 46 vhdl .set_signal ("shift_logic_left_"+toString(i)+" ",_param._size_data);46 vhdl->set_signal ("shift_logic_left_"+toString(i)+" ",_param._size_data); 47 47 48 48 //-----[ Shift logic Right ]------------------------------------------- 49 49 if (_param._have_shift_logic_right) 50 vhdl .set_signal ("shift_logic_right_"+toString(i)+" ",_param._size_data);50 vhdl->set_signal ("shift_logic_right_"+toString(i)+" ",_param._size_data); 51 51 52 52 //-----[ Shift arithmetic Left ]--------------------------------------- 53 53 if (_param._have_shift_arithmetic_left) 54 vhdl .set_signal ("shift_arithmetic_left_"+toString(i)+" ",_param._size_data);54 vhdl->set_signal ("shift_arithmetic_left_"+toString(i)+" ",_param._size_data); 55 55 56 56 //-----[ Shift arithmetic Right ]-------------------------------------- 57 57 if (_param._have_shift_arithmetic_right) 58 vhdl .set_signal ("shift_arithmetic_right_"+toString(i)+"",_param._size_data);58 vhdl->set_signal ("shift_arithmetic_right_"+toString(i)+"",_param._size_data); 59 59 60 60 //-----[ Rotate Left ]------------------------------------------------- 61 61 if (_param._have_rotate_left) 62 vhdl .set_signal ("rotate_left_"+toString(i)+" ",_param._size_data);62 vhdl->set_signal ("rotate_left_"+toString(i)+" ",_param._size_data); 63 63 64 64 //-----[ Rotate Right ]------------------------------------------------ 65 65 if (_param._have_rotate_right) 66 vhdl .set_signal ("rotate_right_"+toString(i)+" ",_param._size_data);66 vhdl->set_signal ("rotate_right_"+toString(i)+" ",_param._size_data); 67 67 } 68 68 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_vhdl_port.cpp
r2 r42 15 15 16 16 17 void Shifter::vhdl_port (Vhdl & vhdl)17 void Shifter::vhdl_port (Vhdl * & vhdl) 18 18 { 19 for (uint32_t i=0; i<_param._nb_port; i++) 20 { 21 vhdl.set_port (" in_SHIFTER_DATA_"+toString(i)+" ", IN, _param._size_data); 22 if (_param._shift_value == 0) 23 vhdl.set_port (" in_SHIFTER_SHIFT_"+toString(i)+" ", IN, static_cast<uint32_t>(ceil(log2(_param._size_data)))); 24 if (_param._direction == external_direction) 25 vhdl.set_port (" in_SHIFTER_DIRECTION_"+toString(i)+" ", IN, 1); 26 if (_param._rotate == external_rotate) 27 vhdl.set_port (" in_SHIFTER_TYPE_"+toString(i)+" ", IN, 1); 28 if (_param._carry == external_carry) 29 vhdl.set_port (" in_SHIFTER_CARRY_"+toString(i)+" ", IN, 1); 30 if (_param._carry == external_completion) 31 if (_param._type_completion_bool == true) 32 vhdl.set_port (" in_SHIFTER_CARRY_IN_"+toString(i)+" ", IN, 1); 33 else 34 vhdl.set_port (" in_SHIFTER_COMPLETION_"+toString(i)+"", IN, _param._size_data_completion); 35 36 vhdl.set_port ("out_SHIFTER_DATA_"+toString(i)+" ",OUT, _param._size_data); 37 } 19 _interfaces->set_port(vhdl); 38 20 }; 39 21 }; // end namespace shifter -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_vhdl_testbench_transition.cpp
r2 r42 15 15 16 16 17 void Shifter::vhdl_testbench_transition ( Vhdl_Testbench & vhdl_testbench)17 void Shifter::vhdl_testbench_transition (void) 18 18 { 19 #ifndef SYSTEMCASS_SPECIFIC 20 sc_cycle(0); 21 #endif 19 sc_start(0); 22 20 23 // In order with file Shifter_vhdl_testbench_port.cpp 24 25 for (uint32_t i=0; i<_param._nb_port; i++) 26 { 27 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_DATA [i])); 28 if (_param._shift_value == 0) 29 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_SHIFT [i])); 30 if (_param._direction == external_direction) 31 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_DIRECTION [i])); 32 if (_param._rotate == external_rotate) 33 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_TYPE [i])); 34 if (_param._carry == external_carry) 35 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_CARRY [i])); 36 if (_param._carry == external_completion) 37 if (_param._type_completion_bool == true) 38 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_CARRY_IN [i])); 39 else 40 vhdl_testbench.add_input (PORT_READ( in_SHIFTER_COMPLETION[i])); 41 vhdl_testbench.add_output (PORT_READ(out_SHIFTER_DATA [i])); 42 } 43 44 // add_test : 45 // - True : the cycle must be compare with the output of systemC 46 // - False : no test 47 vhdl_testbench.add_test(true); 48 49 vhdl_testbench.new_cycle (); // always at the end 21 _interfaces->testbench(); 50 22 }; 51 23
Note: See TracChangeset
for help on using the changeset viewer.