Changeset 88 for trunk/IPs/systemC/processor/Morpheo/Behavioural/src
- Timestamp:
- Dec 10, 2008, 7:31:39 PM (16 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/src
- Files:
-
- 11 added
- 2 deleted
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_generate_file.cpp
r81 r88 8 8 9 9 #include "Behavioural/include/Component.h" 10 #include "Common/include/Environment.h" 10 11 11 12 namespace morpheo { 12 13 namespace behavioural { 13 14 15 #undef FUNCTION 16 #define FUNCTION "Component::generate_file" 14 17 void Component::generate_file (void) 15 18 { … … 18 21 try 19 22 { 23 directory(); 24 20 25 XML xml = toXML(); 21 26 22 xml.filename_extension (" pos");27 xml.filename_extension (".pos"); 23 28 24 xml.generate_file( "ISO-8859-1");29 xml.generate_file(MORPHEO_POSITION,"ISO-8859-1"); 25 30 26 31 } 27 32 catch (ErrorMorpheo e) 28 33 { 29 throw (ErrorMorpheo ("Component \""+_entity->get_name()+"\" have a bad mapping : "+e.what()));34 throw ERRORMORPHEO(FUNCTION,toString(_("Component \"%s\" have a bad mapping : %s\n")),_entity->get_name().c_str(),e.what().c_str()); 30 35 } 31 36 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_port_map.cpp
r82 r88 20 20 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 21 21 22 // log_printf( NONE,Behavioural,FUNCTION,"Map %s.%s with %s.%s",22 // log_printf(INFO,Behavioural,FUNCTION,"Map %s.%s with %s.%s", 23 23 // component_src.c_str(), 24 24 // port_src.c_str(), -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_test_map.cpp
r82 r88 15 15 bool Component::test_map (bool recursive) 16 16 { 17 log_printf( NONE,Behavioural,FUNCTION, "Test port map and interface.");17 log_printf(INFO,Behavioural,FUNCTION, "Test port map and interface."); 18 18 return test_map (0, recursive); 19 19 } … … 23 23 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 24 24 25 std::string tab = std::string(depth,' \t');25 std::string tab = std::string(depth,' '); 26 26 std::string name = _entity->get_name(); 27 27 bool test_ok = true; … … 30 30 if (is_behavioural) 31 31 { 32 log_printf( NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str());32 log_printf(INFO,Interface,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str()); 33 33 } 34 34 else 35 35 { 36 log_printf( NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str());36 log_printf(INFO,Interface,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str()); 37 37 } 38 38 39 39 40 // log_printf( NONE,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str());40 // log_printf(INFO,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str()); 41 41 42 42 test_ok &= _entity->test_map(depth+1,true,is_behavioural); 43 43 44 // log_printf( NONE,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str());44 // log_printf(INFO,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str()); 45 45 46 46 for (std::list<Tcomponent_t *>::iterator i= _list_component->begin(); … … 72 72 // bool Component::test_equi (bool recursive) 73 73 // { 74 // log_printf( NONE,Behavioural,FUNCTION, "Test port equi and interface.");74 // log_printf(INFO,Behavioural,FUNCTION, "Test port equi and interface."); 75 75 // return test_equi (0, recursive); 76 76 // } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_test_map.cpp
r82 r88 18 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 19 20 std::string tab = std::string(depth,' \t');21 log_printf( NONE,Behavioural,FUNCTION,"%s* Entity \"%s\"",tab.c_str(),_name.c_str());20 std::string tab = std::string(depth,' '); 21 log_printf(INFO,Interface,FUNCTION,"%s* Entity \"%s\"",tab.c_str(),_name.c_str()); 22 22 23 23 bool _return = _interfaces->test_map(depth+1,top_level, is_behavioural); … … 42 42 43 43 // std::string tab = std::string(depth,'\t'); 44 // log_printf( NONE,Behavioural,FUNCTION, "%s* Entity \"%s\"",tab.c_str(),_name.c_str());44 // log_printf(INFO,Behavioural,FUNCTION, "%s* Entity \"%s\"",tab.c_str(),_name.c_str()); 45 45 46 46 // bool _return = _interfaces->test_equi(depth+1); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_testbench_test.cpp
r81 r88 13 13 14 14 std::string Interface_fifo::testbench_test (Vhdl * & vhdl, 15 16 15 std::string counter_name, 16 std::string reset_name ) 17 17 { 18 18 log_printf(FUNC,Behavioural,"testbench_test","Begin"); … … 27 27 vhdl->set_body(""); 28 28 29 test_name = testbench_test_name (vhdl);29 test_name = testbench_test_name (vhdl); 30 30 std::string test_name_tmp = test_name+"_tmp"; 31 31 std::string test_name_ok = testbench_test_ok (vhdl); … … 54 54 vhdl->set_body(test_name + " <= '1' when ("+reset_name+" = '0') else "+test_name_tmp+";"); 55 55 56 #ifdef VHDL_TESTBENCH_ASSERT57 if (_list_cycle->empty()== false)58 {59 vhdl->set_body("");60 vhdl->set_body("-- Assert ...");61 vhdl->set_body("");56 // #ifdef VHDL_TESTBENCH_ASSERT 57 // if (_list_cycle->empty()== false) 58 // { 59 // vhdl->set_body(""); 60 // vhdl->set_body("-- Assert ..."); 61 // vhdl->set_body(""); 62 62 63 uint32_t j = 0;64 std::list<uint32_t>::iterator i = _list_cycle->begin();63 // uint32_t j = 0; 64 // std::list<uint32_t>::iterator i = _list_cycle->begin(); 65 65 66 while (i != _list_cycle->end())67 {68 vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '1')) report \"***** <"+_name+"> Test number "+toString(j)+" is OK *****\" severity NOTE;");69 vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '0')) report \"@@@@@ <"+_name+"> Test number "+toString(j)+" is KO !!! @@@@@\" severity NOTE;");70 j++;71 ++i;72 }66 // while (i != _list_cycle->end()) 67 // { 68 // vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '1')) report \"***** <"+_name+"> Test number "+toString(j)+" is OK *****\" severity NOTE;"); 69 // vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '0')) report \"@@@@@ <"+_name+"> Test number "+toString(j)+" is KO !!! @@@@@\" severity NOTE;"); 70 // j++; 71 // ++i; 72 // } 73 73 74 vhdl->set_body("");75 }76 #endif74 // vhdl->set_body(""); 75 // } 76 // #endif 77 77 } 78 78 … … 80 80 81 81 return test_name; 82 83 82 }; 84 83 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_set_signal.cpp
r81 r88 11 11 namespace behavioural { 12 12 13 Signal * Interface::set_signal (std::string 13 Signal * Interface::set_signal (std::string name , 14 14 direction_t direction, 15 15 uint32_t size , … … 19 19 20 20 std::string signame = signal_name(_name, name, direction); 21 21 22 22 Signal * sig = new Signal (signame, direction, size, presence_port); 23 23 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_test_map.cpp
r82 r88 18 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 19 20 std::string tab = std::string(depth,' \t');20 std::string tab = std::string(depth,' '); 21 21 bool _return = true; 22 22 23 log_printf( NONE,Behavioural,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str());23 log_printf(INFO,Interface,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str()); 24 24 25 25 for (std::list<Signal*>::iterator i = _list_signal->begin(); … … 42 42 // bool _return = true; 43 43 44 // log_printf( NONE,Behavioural,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str());44 // log_printf(INFO,Behavioural,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str()); 45 45 46 46 // for (std::list<Signal*>::iterator i = _list_signal->begin(); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_test_map.cpp
r82 r88 18 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 19 20 std::string tab = std::string(depth,' \t');20 std::string tab = std::string(depth,' '); 21 21 22 22 bool _return = true; 23 23 24 log_printf( NONE,Behavioural,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str());24 log_printf(INFO,Interface,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str()); 25 25 26 26 for (std::list<Interface_fifo*>::iterator i = _list_interface->begin(); … … 44 44 // bool _return = true; 45 45 46 // log_printf( NONE,Behavioural,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str());46 // log_printf(INFO,Behavioural,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str()); 47 47 48 48 // for (std::list<Interface_fifo*>::iterator i = _list_interface->begin(); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_testbench_generate_file.cpp
r81 r88 17 17 log_printf(FUNC,Behavioural,"generate_file","Begin"); 18 18 19 Vhdl * vhdl = new Vhdl(_name+"_Testbench");20 std::string 21 Signal * clock = this->get_clock();22 Signal * reset = this->get_reset();23 std::string 24 std::string 25 uint32_t cycle = this->get_cycle();19 Vhdl * vhdl = new Vhdl(_name+"_Testbench"); 20 std::string counter = "counter"; 21 Signal * clock = this->get_clock(); 22 Signal * reset = this->get_reset(); 23 std::string clock_name = clock->get_name(); 24 std::string reset_name = reset->get_name(); 25 uint32_t cycle = this->get_cycle(); 26 26 27 27 vhdl->set_signal (clock_name, 1, 0); … … 87 87 vhdl->set_body("\t\t\t"+counter+" <= "+counter+"+1;"); 88 88 vhdl->set_body(""); 89 vhdl->set_body("\t\t\tassert not ("+counter+" >= "+toString(cycle)+") report \"Test OK\" severity FAILURE;");90 vhdl->set_body("\t\t\tassert not ("+test_name+" = '0') report \"Test KO\" severity FAILURE;");91 92 89 #ifdef VHDL_TESTBENCH_ASSERT 93 vhdl->set_body("\t\t\t-- Assert ...");94 90 for (uint32_t cpt=0; cpt<=cycle; cpt++) 95 91 vhdl->set_body("\t\t\tassert not ("+counter+" = "+toString(cpt)+") report \"===== Test number "+toString(cpt)+" =====\" severity NOTE;"); 92 93 for (std::list<Interface_fifo*>::iterator it=_list_interface->begin(); 94 it!=_list_interface->end(); 95 ++it) 96 { 97 Vhdl * vhdl_assert = new Vhdl(""); 98 99 (*it)->testbench_assert (vhdl_assert,counter); 100 101 vhdl->set_body(vhdl_assert); 102 103 delete vhdl_assert; 104 } 96 105 #endif 97 106 98 107 vhdl->set_body(""); 108 vhdl->set_body("\t\t\tassert not ("+counter+" >= "+toString(cycle)+") report \"Test OK\" severity FAILURE;"); 109 vhdl->set_body("\t\t\tassert not ("+test_name+" = '0') report \"Test KO\" severity FAILURE;"); 99 110 vhdl->set_body("\t\tend if;"); 100 111 vhdl->set_body("\tend if;"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Parameters_test.cpp
r82 r88 23 23 24 24 if (x.have_error()) 25 throw (ErrorMorpheo ("Error(s) in parameters"));25 throw ERRORMORPHEO (FUNCTION,_("Error(s) in parameters\n")); 26 26 27 27 log_printf(FUNC,Behavioural,FUNCTION,"End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/SPR_access_mode_implement_group.cpp
r81 r88 28 28 for (uint32_t i=16; i<=18; i++) 29 29 _spr_generic [GROUP_SYSTEM_AND_CONTROL ][ i]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE; 30 _spr_generic [GROUP_SYSTEM_AND_CONTROL ][ 19]._user_access_mode = SPR_ACCESS_MODE_READ_ONLY; 31 _spr_generic [GROUP_SYSTEM_AND_CONTROL ][ 19]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE; 30 32 _spr_generic [GROUP_SYSTEM_AND_CONTROL ][ 20]._user_access_mode = SPR_ACCESS_MODE_READ_ONLY_COND; 31 33 _spr_generic [GROUP_SYSTEM_AND_CONTROL ][ 20]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE; … … 77 79 78 80 _spr_generic [GROUP_DCACHE ][ 0]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE; 79 for (uint32_t i= 0; i<=5; i++)81 for (uint32_t i=1; i<=5; i++) 80 82 { 81 83 _spr_generic [GROUP_DCACHE ][ i]._supervisor_access_mode = SPR_ACCESS_MODE_WRITE_ONLY; … … 91 93 92 94 _spr_generic [GROUP_ICACHE ][ 0]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE; 93 for (uint32_t i= 0; i<=3; i++)95 for (uint32_t i=1; i<=3; i++) 94 96 { 95 97 _spr_generic [GROUP_ICACHE ][ i]._supervisor_access_mode = SPR_ACCESS_MODE_WRITE_ONLY; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/SPR_access_mode_read_write.cpp
r81 r88 1 1 #include "Behavioural/include/SPR_access_mode.h" 2 3 #include "Common/include/Debug.h" 2 4 3 5 namespace morpheo { … … 14 16 bool SPR_access_mode::read (spr_address_t address, Tcontrol_t SM, Tcontrol_t SUMRA) 15 17 { 16 if (not valid(address)) 18 // log_printf(TRACE,true,"SPR_access_mode::read","address [%d][%d]",address._group,address._register); 19 // log_printf(TRACE,true,"SPR_access_mode::read","sm : %d",SM ); 20 // log_printf(TRACE,true,"SPR_access_mode::read","sumra : %d",SUMRA); 21 22 if (not exist(address)) 17 23 return false; 18 24 19 25 spr_access_mode_t mode = _spr_generic [address._group][address._register]; 26 27 // log_printf(TRACE,true,"SPR_access_mode::read","kernel : %d",(int)mode._supervisor_access_mode); 28 // log_printf(TRACE,true,"SPR_access_mode::read","user : %d",(int)mode._supervisor_access_mode); 20 29 21 30 return (((SM == 1) and ( (mode._supervisor_access_mode == SPR_ACCESS_MODE_READ_ONLY ) or … … 28 37 bool SPR_access_mode::write(spr_address_t address, Tcontrol_t SM, Tcontrol_t SUMRA) 29 38 { 30 if (not valid(address))39 if (not exist(address)) 31 40 return false; 32 41 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_link.cpp
r82 r88 51 51 // if (destination_have_multi_producer) 52 52 // // throw (ERRORMORPHEO (FUNCTION,"Signal \""+_name+"\" can't been linked with signal \""+signal_dest->get_name()+"\" : destination have multi producer.")); 53 // log_printf( NONE,Behavioural,FUNCTION,"Signal \"%s\" can't been linked with signal \"%s\" : destination have multi producer.",_name.c_str(),signal_dest->get_name().c_str());53 // log_printf(INFO,Behavioural,FUNCTION,"Signal \"%s\" can't been linked with signal \"%s\" : destination have multi producer.",_name.c_str(),signal_dest->get_name().c_str()); 54 54 55 55 // update info source -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_test_map.cpp
r82 r88 19 19 20 20 std::string str = ""; 21 std::string tab = std::string(depth,' \t');21 std::string tab = std::string(depth,' '); 22 22 bool _return = true; 23 23 24 // log_printf( NONE,Behavioural,FUNCTION, "%s* Signal \"%s\"",tab.c_str(),_name.c_str());25 // log_printf( NONE,Behavioural,FUNCTION, "%s%d - %d - %d",tab.c_str(),24 // log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\"",tab.c_str(),_name.c_str()); 25 // log_printf(INFO,Behavioural,FUNCTION, "%s%d - %d - %d",tab.c_str(), 26 26 // _is_map_as_toplevel_dest, 27 27 // _is_map_as_component_src, 28 28 // _is_map_as_component_dest); 29 // log_printf( NONE,Behavioural,FUNCTION, "%stop_level %d, is_behavioural %d",tab.c_str(),29 // log_printf(INFO,Behavioural,FUNCTION, "%stop_level %d, is_behavioural %d",tab.c_str(), 30 30 // top_level, 31 31 // is_behavioural); … … 143 143 if (_return == false) 144 144 { 145 log_printf(NONE,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());146 147 145 #ifndef DEBUG 148 146 std::cerr << str << std::endl; 147 #else 148 log_printf(INFO,Interface,FUNCTION, "%s* %s",tab.c_str(),str.c_str()); 149 149 #endif 150 150 } 151 151 else 152 152 { 153 // log_printf( NONE,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());153 // log_printf(INFO,Interface,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str()); 154 154 } 155 155 … … 173 173 // if (_return == false) 174 174 // { 175 // log_printf( NONE,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());175 // log_printf(INFO,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str()); 176 176 177 177 // #ifndef DEBUG … … 181 181 // else 182 182 // { 183 // // log_printf( NONE,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());183 // // log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str()); 184 184 // } 185 185 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_binary_tree.cpp
r81 r88 21 21 Stat_binary_tree:: Stat_binary_tree (counter_t cst) 22 22 { 23 _root = NULL; 24 _left = NULL; 25 _right = NULL; 23 _root = NULL; 24 _left = NULL; 25 _right = NULL; 26 _data_type = NONE; 26 27 27 data_t data; 28 data.cst = cst; 29 _data_type = CONSTANT; 30 _data = data; 31 32 // Stat_binary_tree(CONSTANT, data); 28 change_type (cst); 33 29 } 34 30 35 31 Stat_binary_tree:: Stat_binary_tree (counter_t * var) 36 32 { 37 _root = NULL; 38 _left = NULL; 39 _right = NULL; 33 _root = NULL; 34 _left = NULL; 35 _right = NULL; 36 _data_type = NONE; 40 37 41 data_t data; 42 data.var = var; 43 _data_type = VARIABLE; 44 _data = data; 45 46 // Stat_binary_tree(VARIABLE, data); 38 change_type (var); 47 39 } 48 40 49 41 Stat_binary_tree:: Stat_binary_tree (operator_t op) 50 42 { 51 _root = NULL; 52 _left = NULL; 53 _right = NULL; 43 _root = NULL; 44 _left = NULL; 45 _right = NULL; 46 _data_type = NONE; 54 47 55 data_t data; 56 data.op = op; 57 _data_type = ((op == inc) or (op == dec))?OPERATOR_UNARY:OPERATOR_BINARY; 58 _data = data; 48 change_type (op); 49 } 59 50 51 Stat_binary_tree:: Stat_binary_tree (std::string expr, 52 std::map<std::string, counter_t*> * operand) 53 { 54 _root = NULL; 55 _left = NULL; 56 _right = NULL; 57 _data_type = NONE; 58 59 import (expr, operand); 60 60 } 61 61 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_binary_tree_valid.cpp
r81 r88 4 4 namespace morpheo { 5 5 namespace behavioural { 6 6 7 bool Stat_binary_tree::valid (void) 7 8 { 9 if (_data_type == NONE) 10 return false; 11 8 12 if ((_data_type == VARIABLE) or 9 13 (_data_type == CONSTANT)) 10 14 return ((_left == NULL) and 11 12 15 (_right == NULL) ); 16 13 17 if (_data_type == OPERATOR_UNARY) 14 18 return ((_right == NULL) and 15 16 19 (_left != NULL) and 20 (_left->valid())); 17 21 18 22 if (_data_type == OPERATOR_BINARY) 19 23 return ((_left != NULL ) and 20 21 22 24 (_left ->valid()) and 25 (_right != NULL ) and 26 (_right->valid())); 23 27 24 28 return false; 25 29 } 30 31 void Stat_binary_tree::print (uint32_t depth) 32 { 33 std::string tab = std::string(depth,'\t'); 34 std::string sep = " "; 35 if (_data_type == NONE) 36 { 37 std::cout << tab << "<node> NONE (error)" << std::endl; 38 39 if (_left != NULL) 40 _left ->print(depth+1); 41 if (_right != NULL) 42 _right->print(depth+1); 43 } 44 45 if ((_data_type == VARIABLE) or 46 (_data_type == CONSTANT)) 47 { 48 std::cout << tab << "<leaf>" 49 << " " 50 << ((_left == NULL)?"left == NULL ":"left != NULL (error)") 51 << " " 52 << ((_right == NULL)?"right == NULL ":"right != NULL (error)") 53 << std::endl; 54 55 if (_left != NULL) 56 _left ->print(depth+1); 57 if (_right != NULL) 58 _right->print(depth+1); 59 } 60 61 if (_data_type == OPERATOR_UNARY) 62 { 63 std::cout << tab << "<unary>" 64 << " " 65 << ((_left == NULL)?"left == NULL (error)":"left != NULL ") 66 << " " 67 << ((_right == NULL)?"right == NULL ":"right != NULL (error)") 68 << std::endl; 69 70 if (_left != NULL) 71 _left ->print(depth+1); 72 if (_right != NULL) 73 _right->print(depth+1); 74 } 75 76 if (_data_type == OPERATOR_BINARY) 77 { 78 std::cout << tab << "<binary>" 79 << " " 80 << ((_left == NULL)?"left == NULL (error)":"left != NULL ") 81 << " " 82 << ((_right == NULL)?"right == NULL (error)":"right != NULL ") 83 << std::endl; 84 85 if (_left != NULL) 86 _left ->print(depth+1); 87 if (_right != NULL) 88 _right->print(depth+1); 89 } 90 } 91 26 92 }; 27 93 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_generate_file.cpp
r81 r88 2 2 #include "Behavioural/include/Stat.h" 3 3 #include "Behavioural/include/Version.h" 4 #include "Common/include/Environment.h" 4 5 5 6 namespace morpheo { … … 8 9 void Stat::generate_file (void) 9 10 { 11 directory(); 12 10 13 std::string body = print(1); 11 14 … … 26 29 xml->balise_close(); 27 30 28 xml->filename_extension (" stat");29 xml->generate_file( );31 xml->filename_extension (".stat"); 32 xml->generate_file(MORPHEO_STATISTICS); 30 33 31 34 delete xml; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_have_counter.cpp
r81 r88 10 10 i!= _list_operand->end(); 11 11 ++i) 12 if (i->second.type == TYPE_COUNTER) 13 return true; 14 12 { 13 if (i->second.type == TYPE_COUNTER) 14 return true; 15 } 15 16 return false; 16 17 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_print.cpp
r81 r88 7 7 std::string Stat::print (uint32_t depth) 8 8 { 9 // log_printf(TRACE,Behavioural,"Stat::print","Component name : %s",_name_component.c_str()); 10 // log_printf(TRACE,Behavioural,"Stat::print","Instance name : %s",_name_instance .c_str()); 11 9 12 end_simulation(); 10 13 … … 21 24 stat != _list_stat->end(); 22 25 stat ++) 23 xml.text((*stat)->print(1)); 24 26 { 27 xml.text((*stat)->print(1)); 28 } 25 29 26 30 // Test special case … … 63 67 ++operand) 64 68 { 65 if (operand->second.type == TYPE_COUNTER)69 if (operand->second.type == TYPE_COUNTER) 66 70 { 67 71 xml.singleton_begin(operand->second.name); … … 80 84 } 81 85 } 86 82 87 xml.balise_close(); 83 88 84 89 return xml.get_body(depth); 85 90 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_string2tree.cpp
r81 r88 5 5 namespace behavioural { 6 6 7 #define string2operator(x) (x=="+")?add:((x=="-")?sub:((x=="*")?mul:((x=="/" )?div:((x=="++")?inc:dec))))8 9 7 Stat_binary_tree * Stat::string2tree (std::string expr) 10 8 { 11 const std::string delims (" "); // délimiteur : " " 12 const std::string numbers ("0123456789"); // délimiteur : " " 13 std::string::size_type index_begin, index_end; 9 std::map<std::string, counter_t*> * operand = new std::map<std::string, counter_t*>; 14 10 15 Stat_binary_tree * tree = NULL; 11 for (std::map<std::string, var_t>::iterator it = _list_operand->begin(); 12 it != _list_operand->end(); 13 ++ it) 14 (*operand) [it->first] = it->second.counter; 16 15 17 index_begin = expr.find_first_not_of(delims);16 Stat_binary_tree * tree = new Stat_binary_tree(expr,operand); 18 17 19 while (index_begin != std::string::npos) 20 { 21 index_end = expr.find_first_of(delims, index_begin); 22 23 if (index_end == std::string::npos) 24 { 25 index_end = expr.length(); 26 } 27 28 std::string str = expr.substr(index_begin, index_end-index_begin); 29 30 // 3 possibilités : 31 // * operator 32 // * constante 33 // * variable 34 { 35 // Test constantes 36 std::string::size_type index = str.find_first_not_of(numbers); 37 if (index == std::string::npos) 38 { 39 // std::cout << " * c'est une constante." << std::endl; 40 41 if (tree==NULL) 42 tree = new Stat_binary_tree (atoi(str.c_str())); 43 else 44 tree = tree->insert_tree (atoi(str.c_str())); 45 } 46 else 47 { 48 // Test variables 49 std::map<std::string, var_t>::iterator it = _list_operand->find(str); 50 if (it != _list_operand->end()) 51 { 52 // std::cout << " * c'est une variable." << std::endl; 53 54 if (tree==NULL) 55 tree = new Stat_binary_tree (it->second.counter); 56 else 57 tree = tree->insert_tree (it->second.counter); 58 } 59 else 60 { 61 if ((str == "+") or 62 (str == "-") or 63 (str == "*") or 64 (str == "/")) 65 { 66 // std::cout << " * c'est un operator à 2 opérandes." << std::endl; 67 68 // if (tree==NULL) 69 // tree = new Stat_binary_tree (morpheo::string2operator[str].second); 70 // else 71 // tree->insert_tree (morpheo::string2operator[str].second); 72 if (tree==NULL) 73 tree = new Stat_binary_tree (string2operator(str)); 74 else 75 tree = tree->insert_tree (string2operator(str)); 76 } 77 else 78 { 79 if ((str == "++") or 80 (str == "--")) 81 { 82 // std::cout << " * c'est un operator à 1 opérande." << std::endl; 83 84 // if (tree==NULL) 85 // tree = new Stat_binary_tree (string2operator[str.c_str()]); 86 // else 87 // tree->insert_tree (string2operator[str.c_str()]); 88 89 if (tree==NULL) 90 tree = new Stat_binary_tree (string2operator(str)); 91 else 92 tree = tree->insert_tree (string2operator(str)); 93 94 } 95 else 96 { 97 // std::cout << " * c'est autre chose." << std::endl; 98 str = "expression '"+str+"' doesn't a constant, a declarated variable or an operator."; 99 throw(ERRORMORPHEO("Stat::string2tree",_(str.c_str()))); 100 } 101 } 102 } 103 } 104 } 105 106 index_begin = expr.find_first_not_of(delims, index_end); 107 108 if (index_begin != std::string::npos) 109 tree = tree->goto_next_root(); 110 } 111 112 if (tree == NULL) 113 throw (ERRORMORPHEO("Stat::string2tree",_("the tree generated is empty."))); 114 115 // std::cout << "<Stat::string2tree> goto_top_level" << std::endl; 116 117 tree = tree->goto_top_level(); 118 119 // std::cout << "<Stat::string2tree> valid" << std::endl; 120 121 if (not tree->valid()) 122 throw (ERRORMORPHEO("Stat::string2tree",_("the tree generated is invalid."))); 123 124 // std::cout << "<Stat::string2tree> End" << std::endl; 18 delete operand; 125 19 126 20 return tree; 127 128 21 } 129 22 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Usage.cpp
r81 r88 20 20 return ((usage & flag) != 0); 21 21 } 22 22 #undef FUNCTION 23 #define FUNCTION "usage_environment" 23 24 void usage_environment (Tusage_t usage) 24 25 { 25 26 #ifndef SYSTEMC 26 27 if (usage_is_set(usage,USE_SYSTEMC)) 27 throw E rrorMorpheo(_("Component use the flag \"USE_SYSTEMC\", but the macro's compiler \"SYSTEMC\" is unset."));28 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_SYSTEMC\", but the macro's compiler \"SYSTEMC\" is unset.\n")); 28 29 #endif 29 30 #ifndef VHDL 30 31 if (usage_is_set(usage,USE_VHDL)) 31 throw E rrorMorpheo(_("Component use the flag \"USE_VHDL\", but the macro's compiler \"VHDL\" is unset."));32 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_VHDL\", but the macro's compiler \"VHDL\" is unset.\n")); 32 33 #endif 33 34 #ifndef VHDL_TESTBENCH 34 35 if (usage_is_set(usage,USE_VHDL_TESTBENCH)) 35 throw E rrorMorpheo(_("Component use the flag \"USE_VHDL_TESTBENCH\", but the macro's compiler \"VHDL_TESTBENCH\" is unset."));36 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_VHDL_TESTBENCH\", but the macro's compiler \"VHDL_TESTBENCH\" is unset.\n")); 36 37 #endif 37 38 #ifndef VHDL_TESTBENCH_ASSERT 38 39 if (usage_is_set(usage,USE_VHDL_TESTBENCH_ASSERT)) 39 throw E rrorMorpheo(_("Component use the flag \"USE_VHDL_TESTBENCH_ASSERT\", but the macro's compiler \"VHDL_TESTBENCH_ASSERT\" is unset."));40 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_VHDL_TESTBENCH_ASSERT\", but the macro's compiler \"VHDL_TESTBENCH_ASSERT\" is unset.\n")); 40 41 #endif 41 42 #ifndef POSITION 42 43 if (usage_is_set(usage,USE_POSITION)) 43 throw E rrorMorpheo(_("Component use the flag \"USE_POSITION\", but the macro's compiler \"POSITION\" is unset."));44 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_POSITION\", but the macro's compiler \"POSITION\" is unset.\n")); 44 45 #endif 45 46 #ifndef STATISTICS 46 47 if (usage_is_set(usage,USE_STATISTICS)) 47 throw E rrorMorpheo(_("Component use the flag \"USE_STATISTICS\", but the macro's compiler \"STATISTICS\" is unset."));48 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_STATISTICS\", but the macro's compiler \"STATISTICS\" is unset.\n")); 48 49 #endif 49 50 #ifndef INFORMATION 50 51 if (usage_is_set(usage,USE_INFORMATION)) 51 throw E rrorMorpheo(_("Component use the flag \"USE_INFORMATION\", but the macro's compiler \"INFORMATION\" is unset."));52 throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_INFORMATION\", but the macro's compiler \"INFORMATION\" is unset.\n")); 52 53 #endif 53 54 … … 56 57 57 58 if (usage_is_set(usage,USE_STATISTICS) and not usage_is_set(usage,USE_SYSTEMC)) 58 throw E rrorMorpheo(_("Usage flags conflit : to use the statistics, you must set flag USE_SYSTEMC"));59 throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the statistics, you must set flag USE_SYSTEMC\n")); 59 60 60 61 if (usage_is_set(usage,USE_INFORMATION) and not usage_is_set(usage,USE_STATISTICS)) 61 throw E rrorMorpheo(_("Usage flags conflit : to use the information, you must set flag USE_STATISTICS"));62 throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the information, you must set flag USE_STATISTICS\n")); 62 63 63 64 if (usage_is_set(usage,USE_VHDL_TESTBENCH) and not usage_is_set(usage,USE_SYSTEMC)) 64 throw E rrorMorpheo(_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_SYSTEMC"));65 throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_SYSTEMC\n")); 65 66 66 67 if (usage_is_set(usage,USE_VHDL_TESTBENCH) and not usage_is_set(usage,USE_VHDL)) 67 throw E rrorMorpheo(_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_VHDL"));68 throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_VHDL\n")); 68 69 69 70 if (usage_is_set(usage,USE_VHDL_TESTBENCH_ASSERT) and not usage_is_set(usage,USE_VHDL_TESTBENCH)) 70 throw E rrorMorpheo(_("Usage flags conflit : to use an assert in vhdl's test bench, you must set flag USE_VHDL_TESTBENCH"));71 throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use an assert in vhdl's test bench, you must set flag USE_VHDL_TESTBENCH\n")); 71 72 } 72 73 … … 96 97 usage = usage_set(usage,USE_INFORMATION); 97 98 #endif 98 99 usage = usage_set(usage,USE_HEADER); 99 100 #ifdef DEBUG 100 101 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_generate_file_model.cpp
r81 r88 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 #include "Common/include/Environment.h" 11 12 #include <sstream> 12 13 #include <fstream> … … 19 20 log_printf(FUNC,Behavioural,"generate_file_model","Begin"); 20 21 21 std::string filename = _name + ".vhdl"; 22 directory(); 23 24 std::string filename = MORPHEO_VHDL + "/" + _name + ".vhdl"; 22 25 23 log_printf(TRACE,Behavioural,"generate_file_model","print %s",filename.c_str()); 24 std::cout << "Generate file \""<< filename << "\"" << std::endl; 26 msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str()); 25 27 26 28 log_printf(TRACE,Behavioural,"generate_file_model","declaration"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_generate_file_package.cpp
r81 r88 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 #include "Common/include/Environment.h" 11 12 #include <sstream> 12 13 #include <fstream> … … 19 20 log_printf(FUNC,Behavioural,"generate_file_package","Begin"); 20 21 22 directory(); 23 21 24 std::string name = _name + "_Pack"; 22 std::string filename = name + ".vhdl";25 std::string filename = MORPHEO_VHDL + "/" + name + ".vhdl"; 23 26 24 std::cout << "Generate file \""<< filename << "\"" << std::endl;27 msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str()); 25 28 26 29 std::ofstream file; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_header.cpp
r85 r88 32 32 text += "-- "+toString(_("File : ")) + filename +"\n"; 33 33 text += "-- "+toString(_("Date : ")) + ctime (¤t_time ); 34 text += "-- "+toString(_("Morpheo version : ")) + MORPHEO_ VERSION+"\n";34 text += "-- "+toString(_("Morpheo version : ")) + MORPHEO_HEADER +"\n"; 35 35 text += "-- "+toString(_("Comment : ")) + _("it's a autogenerated file, don't modify") +"\n"; 36 36 text += "-------------------------------------------------------------------------------\n"; … … 38 38 log_printf(FUNC,Behavioural,FUNCTION,"End"); 39 39 40 return text .str();40 return text; 41 41 }; 42 42 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_set_body.cpp
r81 r88 17 17 #undef FUNCTION 18 18 #define FUNCTION "Vhdl::set_body" 19 void Vhdl::set_body (std::string text)19 void Vhdl::set_body (std::string text) 20 20 { 21 21 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 22 22 set_list(_list_body, text); 23 log_printf(FUNC,Behavioural,FUNCTION,"End"); 24 }; 25 26 #undef FUNCTION 27 #define FUNCTION "Vhdl::set_body" 28 void Vhdl::set_body (Vhdl * vhdl) 29 { 30 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 31 32 for (std::list<std::string>::iterator it=vhdl->_list_body.begin(); 33 it!=vhdl->_list_body.end(); 34 ++it) 35 set_list(_list_body, *it); 36 23 37 log_printf(FUNC,Behavioural,FUNCTION,"End"); 24 38 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML.cpp
r81 r88 17 17 { 18 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 _filename_extension=" xml";19 _filename_extension=".xml"; 20 20 log_printf(FUNC,Behavioural,FUNCTION,"End"); 21 21 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_generate_file.cpp
r81 r88 7 7 8 8 #include "Behavioural/include/XML.h" 9 #include "Common/include/ErrorMorpheo.h" 9 10 #include <fstream> 10 11 … … 14 15 #undef FUNCTION 15 16 #define FUNCTION "XML::generate_file" 16 void XML::generate_file (std::string encoding)17 void XML::generate_file (std::string dirname, std::string encoding) 17 18 { 18 19 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); … … 20 21 header (encoding); 21 22 22 std::string filename = _name + "."+ _filename_extension;23 std::string filename = dirname + "/" + _name + _filename_extension; 23 24 24 std::cout << "Generate file \""<< filename << "\"" << std::endl;25 msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str()); 25 26 26 27 std::ofstream file; 27 file.open(filename.c_str(),std::ios::out | std::ios::trunc); 28 file.open(filename.c_str() ,std::ios::out | std::ios::trunc); 29 30 if (!file) 31 throw ERRORMORPHEO(FUNCTION,toString(_("Error opening \"%s\" file.\n"),filename.c_str())); 28 32 29 33 file << get_body(); … … 34 38 }; 35 39 36 void XML::generate_file ( void)40 void XML::generate_file (std::string dirname) 37 41 { 38 42 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 39 generate_file( "UTF-8");43 generate_file(dirname,"UTF-8"); 40 44 log_printf(FUNC,Behavioural,FUNCTION,"End"); 41 45 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_get_body.cpp
r83 r88 24 24 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 25 25 26 std::string body 27 std::string tab ulation= indent(depth);26 std::string body = _body; 27 std::string tab = indent(depth); 28 28 29 // body.insert(0,tabulation);29 body.insert(0,tab); 30 30 for (size_t pos=body.find('\n',0); (pos<body.length()-1); pos=body.find('\n',++pos)) 31 body.insert(++pos,tab ulation);31 body.insert(++pos,tab); 32 32 33 33 log_printf(FUNC,Behavioural,FUNCTION,"End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_header.cpp
r85 r88 26 26 str += "\n"; 27 27 str += "<!--\n"; 28 str += "\t"+toString(_("File : ")) + _name +"."+_filename_extension + "\n";28 str += "\t"+toString(_("File : ")) + _name + _filename_extension + "\n"; 29 29 str += "\t"+toString(_("Date : ")) + ctime (¤t_time ); 30 str += "\t"+toString(_("Morpheo version : ")) + MORPHEO_ VERSION+"\n";30 str += "\t"+toString(_("Morpheo version : ")) + MORPHEO_HEADER +"\n"; 31 31 str += "\t"+toString(_("Comment : ")) + toString(_("it's a autogenerated file, don't modify")) +"\n"; 32 32 str += "-->\n"; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_insert_XML.cpp
r81 r88 13 13 #undef FUNCTION 14 14 #define FUNCTION "XML::insert_XML" 15 bool XML::insert_XML (XML xml )15 bool XML::insert_XML (XML xml, uint32_t offset_depth) 16 16 { 17 17 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 18 18 //return text (xml.get_body()); 19 _body += xml.get_body(depth() );19 _body += xml.get_body(depth()+offset_depth); 20 20 log_printf(FUNC,Behavioural,FUNCTION,"End"); 21 21 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_text.cpp
r81 r88 16 16 { 17 17 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 18 _body += indent()+text; // +"\n";18 _body += text; // +"\n"; 19 19 log_printf(FUNC,Behavioural,FUNCTION,"End"); 20 20
Note: See TracChangeset
for help on using the changeset viewer.