Changeset 42 for trunk/IPs/systemC/processor/Morpheo/Behavioural/src
- Timestamp:
- Jul 5, 2007, 5:50:19 PM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/src
- Files:
-
- 22 added
- 18 deleted
- 37 edited
- 11 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component.cpp
r38 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 Position::Position(void)13 Component::Component (void) 15 14 { 16 log_printf(FUNC,Behavioural," Position","Begin");15 log_printf(FUNC,Behavioural,"Component","Begin"); 17 16 _list_component = new list<Entity *>; 18 log_printf(FUNC,Behavioural," Position","End");17 log_printf(FUNC,Behavioural,"Component","End"); 19 18 }; 20 19 21 Position::Position (const Position & position)20 Component::Component (const Component & component) 22 21 { 23 log_printf(FUNC,Behavioural," Position(copy)","Begin");24 _entity = position._entity ;25 _list_component = position._list_component;26 log_printf(FUNC,Behavioural," Position(copy)","End");22 log_printf(FUNC,Behavioural,"Component (copy)","Begin"); 23 _entity = component._entity ; 24 _list_component = component._list_component; 25 log_printf(FUNC,Behavioural,"Component (copy)","End"); 27 26 }; 28 27 29 Position::~Position()28 Component::~Component () 30 29 { 31 log_printf(FUNC,Behavioural,"~ Position","Begin");30 log_printf(FUNC,Behavioural,"~Component","Begin"); 32 31 delete _entity; 33 34 // if (_list_component->empty()== false)35 // {36 // list<Entity *>::iterator i = _list_component->begin();37 38 // while (i != _list_component->end())39 // {40 // delete (*i);41 // ++i;42 // }43 // }44 45 32 delete _list_component; 46 log_printf(FUNC,Behavioural,"~ Position","End");33 log_printf(FUNC,Behavioural,"~Component","End"); 47 34 }; 48 35 … … 50 37 }; // end namespace behavioural 51 38 }; // end namespace morpheo 52 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_find_entity.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 Entity * Position::find_entity (string name)13 Entity * Component::find_entity (string name) 15 14 { 16 15 17 if (_entity-> _name== name)16 if (_entity->get_name() == name) 18 17 return _entity; 19 18 else … … 24 23 while (i != _list_component->end()) 25 24 { 26 if ((*i)-> _name== name)25 if ((*i)->get_name() == name) 27 26 { 28 27 return *i; … … 38 37 }; // end namespace behavioural 39 38 }; // end namespace morpheo 40 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_generate_file.cpp
r31 r42 7 7 */ 8 8 9 #include "Behavioural/include/ Position.h"9 #include "Behavioural/include/Component.h" 10 10 11 11 namespace morpheo { 12 12 namespace behavioural { 13 13 14 void Position::generate_file (void)14 void Component::generate_file (void) 15 15 { 16 16 try … … 25 25 catch (ErrorMorpheo e) 26 26 { 27 throw (ErrorMorpheo (" Position \""+_entity->_name+"\" have a bad mapping : "+e.what()));27 throw (ErrorMorpheo ("Component \""+_entity->get_name()+"\" have a bad mapping : "+e.what())); 28 28 } 29 29 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_get_component.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 string Position::get_component (void)13 string Component::get_component (void) 15 14 { 16 15 uint32_t depth = 0; … … 49 48 }; // end namespace behavioural 50 49 }; // end namespace morpheo 51 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_get_entity.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 string Position::get_entity (void)13 string Component::get_entity (void) 15 14 { 16 15 ostringstream text; … … 21 20 }; // end namespace behavioural 22 21 }; // end namespace morpheo 23 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_port_map.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 void Position::port_map (string component1,15 string signal1,16 string component2,17 string signal2)13 void Component::port_map (string component_src , 14 string port_src , 15 string component_dest, 16 string port_dest ) 18 17 { 19 Entity * entity1 = find_entity(component1);18 string name_entity = _entity->get_name(); 20 19 21 if (entity1 == NULL)22 throw (ErrorMorpheo ("Position \""+_entity->_name+"\", port map with unknow component \""+component1+"\"."));20 // First entity 21 Entity * entity_dest = find_entity(component_dest); 23 22 24 bool is_top_level1 = _entity->_name == component1; 23 if (entity_dest == NULL) 24 throw (ErrorMorpheo ("Component \""+name_entity+"\", port map with unknow component \""+component_dest+"\".")); 25 25 26 Interface * interface1 = find_interface (signal1, entity1);26 Signal * signal_dest = entity_dest->find_signal (port_dest); 27 27 28 if ( interface1== NULL)29 throw (ErrorMorpheo (" Position \""+_entity->_name+"\", port map with component \""+component1+"\" and a unknow port \""+signal1+"\"."));28 if (signal_dest == NULL) 29 throw (ErrorMorpheo ("Component \""+name_entity+"\", port map with component \""+component_dest+"\" and a unknow signal \""+port_dest+"\".")); 30 30 31 Entity * entity2 = find_entity(component2); 31 // Second entity 32 Entity * entity_src = find_entity(component_src); 32 33 33 if (entity 2== NULL)34 throw (ErrorMorpheo (" Position \""+_entity->_name+"\", port map with unknow component \""+component2+"\"."));34 if (entity_src == NULL) 35 throw (ErrorMorpheo ("Component \""+name_entity+"\", port map with unknow component \""+component_src+"\".")); 35 36 36 bool is_top_level2 = _entity->_name == component2;37 Signal * signal_src = entity_src->find_signal (port_src); 37 38 38 Interface * interface2 = find_interface (signal2, entity2); 39 if (signal_src == NULL) 40 throw (ErrorMorpheo ("Component \""+name_entity+"\", port map with component \""+component_src+"\" and a unknow signal \""+port_src+"\".")); 39 41 40 if (interface2 == NULL) 41 throw (ErrorMorpheo ("Position \""+_entity->_name+"\", port map with component \""+component2+"\" and a unknow port \""+signal2+"\".")); 42 43 // all is ok 44 if (is_top_level1 == false) 45 interface1->port_map(static_cast<void *>(entity2 ), 46 static_cast<void *>(interface2)); 47 48 if (is_top_level2 == false) 49 interface2->port_map(static_cast<void *>(entity1 ), 50 static_cast<void *>(interface1)); 51 42 // If all is ok, mapping 43 signal_src ->link (signal_dest); 44 signal_dest->mapping(signal_src ); 52 45 }; 53 46 54 47 }; // end namespace behavioural 55 48 }; // end namespace morpheo 56 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_print.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 … … 14 13 15 14 ostream& operator<< (ostream& output_stream, 16 morpheo::behavioural:: Position& x)15 morpheo::behavioural::Component & x) 17 16 { 18 17 output_stream << x.get_entity () << endl; … … 23 22 }; // end namespace behavioural 24 23 }; // end namespace morpheo 25 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_set_component.cpp
r38 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 void Position::set_component (Position * position, 15 uint32_t pos_x , 16 uint32_t pos_y , 17 uint32_t size_x , 18 uint32_t size_y ) 13 void Component::set_component (Component * component 14 #ifdef POSITION 15 ,uint32_t pos_x 16 ,uint32_t pos_y 17 ,uint32_t size_x 18 ,uint32_t size_y 19 #endif 20 ) 19 21 { 20 Entity * entity = position->_entity;22 Entity * entity = component->_entity; 21 23 22 24 _list_component->push_back(entity); 23 25 26 #ifdef POSITION 24 27 entity->mapping( pos_x, pos_y, size_x, size_y); 28 #endif 25 29 }; 26 30 27 31 }; // end namespace behavioural 28 32 }; // end namespace morpheo 29 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_set_entity.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 7 6 */ 8 7 9 #include "Behavioural/include/ Position.h"8 #include "Behavioural/include/Component.h" 10 9 11 10 namespace morpheo { 12 11 namespace behavioural { 13 12 14 Entity * Position::set_entity (string name , 15 string type , 16 schema_t schema ) 13 Entity * Component::set_entity (string name 14 ,string type 15 #ifdef POSITION 16 ,schema_t schema 17 #endif 18 ) 17 19 { 18 Entity * entity = new Entity (name , 19 type , 20 schema ); 20 Entity * entity = new Entity (name 21 ,type 22 #ifdef POSITION 23 ,schema 24 #endif 25 ); 21 26 _entity = entity; 22 27 … … 26 31 }; // end namespace behavioural 27 32 }; // end namespace morpheo 28 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_toXML.cpp
r31 r42 7 7 */ 8 8 9 #include "Behavioural/include/ Position.h"9 #include "Behavioural/include/Component.h" 10 10 11 11 namespace morpheo { 12 12 namespace behavioural { 13 13 14 XML Position::toXML (void)14 XML Component::toXML (void) 15 15 { 16 XML xml (_entity-> _name);16 XML xml (_entity->get_name()); 17 17 18 18 xml.balise_open ("description"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity.cpp
r41 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 12 11 namespace behavioural { 13 12 14 Entity::Entity (string name , 15 string type , 16 schema_t schema): 17 _name (name ), 18 _type (type ), 19 _schema (schema ) 13 Entity::Entity ( string name 14 ,string type 15 #ifdef POSITION 16 ,schema_t schema 17 #endif 18 ): 19 _name (name ) 20 ,_type (type ) 21 #ifdef POSITION 22 ,_schema (schema ) 23 #endif 20 24 { 21 25 log_printf(FUNC,Behavioural,"Entity","Begin"); 22 26 _interfaces = new Interfaces (name); 27 #ifdef POSITION 23 28 _is_map = false; 29 #endif 24 30 log_printf(FUNC,Behavioural,"Entity","End"); 25 31 }; 26 32 27 33 Entity::Entity (const Entity & entity): 28 _name (entity._name ), 29 _type (entity._type ), 30 _schema (entity._schema ) 34 _name (entity._name ) 35 ,_type (entity._type ) 36 #ifdef POSITION 37 ,_schema (entity._schema ) 38 #endif 31 39 { 32 40 log_printf(FUNC,Behavioural,"Entity (copy)","Begin"); 41 _interfaces = entity._interfaces; 42 #ifdef POSITION 33 43 _is_map = entity._is_map ; 34 _interfaces = entity._interfaces;35 44 _comment = entity._comment ; 45 #endif 36 46 log_printf(FUNC,Behavioural,"Entity (copy)","End"); 37 47 }; … … 43 53 log_printf(FUNC,Behavioural,"~Entity","End"); 44 54 }; 45 46 55 47 56 }; // end namespace behavioural 48 57 }; // end namespace morpheo 49 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_find_interface.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 19 18 }; // end namespace behavioural 20 19 }; // end namespace morpheo 21 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_get_interfaces.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 20 19 }; 21 20 21 Interfaces * Entity::get_interfaces_list (void) 22 { 23 return _interfaces; 24 }; 25 26 22 27 }; // end namespace behavioural 23 28 }; // end namespace morpheo 24 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_print.cpp
r31 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 16 15 morpheo::behavioural::Entity & x) 17 16 { 17 #ifdef POSITION 18 18 output_stream << x._name + "\t"+x._type+"\t"+toString(x._schema) << endl; 19 19 output_stream << x.get_comment() << endl; 20 #else 21 output_stream << x._name + "\t"+x._type<< endl; 22 #endif 20 23 output_stream << x.get_interfaces() << endl; 21 24 return output_stream; … … 24 27 }; // end namespace behavioural 25 28 }; // end namespace morpheo 26 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_set_interfaces.cpp
r41 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 19 18 }; // end namespace behavioural 20 19 }; // end namespace morpheo 21 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface.cpp
r41 r42 11 11 namespace behavioural { 12 12 13 Interface::Interface (string name , 14 direction_t direction , 15 localisation_t localisation ): 16 _name (name ), 17 _direction (direction ), 18 _localisation (localisation) 13 Interface::Interface (string name 14 #ifdef POSITION 15 ,direction_t direction 16 ,localisation_t localisation 17 #endif 18 ): 19 _name (name ) 20 #ifdef POSITION 21 ,_direction (direction ) 22 ,_localisation (localisation) 23 #endif 19 24 { 20 25 log_printf(FUNC,Behavioural,"Interface","Begin"); 21 26 22 _comment = "";23 27 _list_signal = new (list<Signal*>); 24 28 25 29 #ifdef POSITION 30 _comment = ""; 26 31 _is_map = false; 27 32 _entity_map = NULL; … … 37 42 38 43 Interface::Interface (const Interface & interface): 39 _name (interface._name ), 40 _direction (interface._direction ), 41 _localisation (interface._localisation) 44 _name (interface._name ) 45 #ifdef POSITION 46 ,_direction (interface._direction ) 47 ,_localisation (interface._localisation) 48 #endif 42 49 { 43 50 log_printf(FUNC,Behavioural,"Interface (copy)","Begin"); 44 _comment = interface._comment ;45 51 _list_signal = interface._list_signal; 46 52 #ifdef POSITION 53 _comment = interface._comment ; 47 54 _is_map = interface._is_map ; 48 55 _entity_map = interface._entity_map ; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo.cpp
r41 r42 11 11 namespace behavioural { 12 12 13 Interface_fifo::Interface_fifo (string name , 14 direction_t direction , 15 localisation_t localisation): 16 Interface (name , 17 direction , 18 localisation) 13 Interface_fifo::Interface_fifo (string name 14 #ifdef POSITION 15 ,direction_t direction 16 ,localisation_t localisation 17 #endif 18 ): 19 Interface (name 20 #ifdef POSITION 21 ,direction 22 ,localisation 23 #endif 24 ) 19 25 { 20 26 log_printf(FUNC,Behavioural,"Interface_fifo","Begin"); … … 32 38 33 39 Interface_fifo::Interface_fifo (const Interface_fifo & interface_fifo) : 34 Interface (interface_fifo._name , 35 interface_fifo._direction , 36 interface_fifo._localisation) 40 Interface (interface_fifo._name 41 #ifdef POSITION 42 ,interface_fifo._direction 43 ,interface_fifo._localisation 44 #endif 45 ) 37 46 { 38 47 log_printf(FUNC,Behavioural,"Interface_fifo (copy)","Begin"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_get_cycle.cpp
r41 r42 17 17 if (_test_exhaustive == true) 18 18 return Interface::get_cycle(); 19 20 return _list_cycle->back(); 19 20 if (_list_cycle->empty() == true) 21 return 0; 22 else 23 return _list_cycle->back(); 21 24 }; 22 25 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_testbench_test.cpp
r41 r42 13 13 14 14 string Interface_fifo::testbench_test (Vhdl * & vhdl, 15 string counter_name) 15 string counter_name, 16 string reset_name ) 16 17 { 17 18 log_printf(FUNC,Behavioural,"testbench_test","Begin"); … … 19 20 20 21 if (_test_exhaustive == true) 21 test_name = Interface::testbench_test(vhdl,counter_name );22 test_name = Interface::testbench_test(vhdl,counter_name,reset_name); 22 23 else 23 24 { … … 26 27 vhdl->set_body(""); 27 28 28 test_name = testbench_test_name (vhdl); 29 string test_name_ok = testbench_test_ok (vhdl); 29 test_name = testbench_test_name (vhdl); 30 string test_name_tmp = test_name+"_tmp"; 31 string test_name_ok = testbench_test_ok (vhdl); 32 string test_transaction = testbench_test_transaction (vhdl); 33 34 vhdl->set_signal(test_name_tmp,1); 30 35 31 36 if (_list_cycle->empty()== false) 32 37 { 33 38 vhdl->set_body ("with "+counter_name+" select"); 34 vhdl->set_body ("\t"+test_name +" <=");39 vhdl->set_body ("\t"+test_name_tmp+" <="); 35 40 36 41 list<uint32_t>::iterator i = _list_cycle->begin(); … … 38 43 while (i != _list_cycle->end()) 39 44 { 40 vhdl->set_body ("\t"+test_ name_ok+" when "+toString(*i)+",");45 vhdl->set_body ("\t"+test_transaction+" and "+test_name_ok+" when "+toString(*i)+","); 41 46 ++i; 42 47 } 43 vhdl->set_body ("\t '1'when others;");48 vhdl->set_body ("\tnot "+test_transaction+" when others;"); 44 49 } 50 else 51 vhdl->set_body (test_name_tmp+" <= not "+test_transaction+";"); 52 53 vhdl->set_body(""); 54 vhdl->set_body(test_name + " <= '1' when ("+reset_name+" = '0') else "+test_name_tmp+";"); 55 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 63 uint32_t j = 0; 64 list<uint32_t>::iterator i = _list_cycle->begin(); 65 66 while (i != _list_cycle->end()) 67 { 68 vhdl->set_body("assert not ( ("+counter_name+" = "+toString(*i)+")) report \"***** <"+_name+"> interface's test number "+toString(j)+" *****\" severity NOTE;"); 69 j++; 70 ++i; 71 } 72 73 vhdl->set_body(""); 74 } 75 #endif 45 76 } 46 77 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_testbench_transaction.cpp
r40 r42 1 #ifdef VHDL_TESTBENCH 1 2 /* 2 3 * $Id$ … … 48 49 }; // end namespace behavioural 49 50 }; // end namespace morpheo 51 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_get_clock.cpp
r41 r42 13 13 namespace behavioural { 14 14 15 stringInterface::get_clock (void)15 Signal * Interface::get_clock (void) 16 16 { 17 string clock = "";17 Signal * clock = NULL; 18 18 19 19 if (not _list_signal->empty()) … … 23 23 while (i != _list_signal->end()) 24 24 { 25 string str= (*i)->get_clock ();25 Signal * sig = (*i)->get_clock (); 26 26 27 if (s tr != "")27 if (sig != NULL) 28 28 { 29 if (clock != "")29 if (clock != NULL) 30 30 throw ErrorMorpheo ("<Interface.get_clock> : find too many clock."); 31 clock = s tr;31 clock = sig; 32 32 } 33 33 ++i; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_get_comment.cpp
r38 r42 1 #ifdef POSITION 1 2 /* 2 3 * $Id$ … … 22 23 }; // end namespace behavioural 23 24 }; // end namespace morpheo 25 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_get_signal.cpp
r41 r42 69 69 #endif 70 70 71 list<Signal *> * Interface::get_signal_list (void) 72 { 73 return _list_signal; 74 } 75 71 76 }; // end namespace behavioural 72 77 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_port_map.cpp
r38 r42 1 #ifdef POSITION2 1 /* 3 2 * $Id$ … … 13 12 namespace behavioural { 14 13 15 void Interface::port_map (void * entity, 16 void * interface) 17 { 18 log_printf(FUNC,Behavioural,"port_map","Begin"); 19 _is_map = true ; 20 _entity_map = entity ; 21 _interface_map = interface; 22 log_printf(FUNC,Behavioural,"port_map","End"); 23 }; 14 // void Interface::port_map (void * entity, 15 // void * interface) 16 // { 17 // log_printf(FUNC,Behavioural,"port_map","Begin"); 18 // #ifdef POSITION 19 // _is_map = true ; 20 // _entity_map = entity ; 21 // _interface_map = interface; 22 // #endif 23 // log_printf(FUNC,Behavioural,"port_map","End"); 24 // }; 24 25 25 26 }; // end namespace behavioural 26 27 }; // end namespace morpheo 27 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_print.cpp
r41 r42 16 16 { 17 17 log_printf(FUNC,Behavioural,"operator<<","Begin"); 18 #ifdef POSITION 18 19 output_stream << x._name + "\t"+toString(x._localisation)+"\t"+toString(x._direction) << endl; 19 20 output_stream << x.get_comment() << endl; 21 #else 22 output_stream << x._name << endl; 23 #endif 20 24 output_stream << x.get_signal () << endl; 21 25 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_set_comment.cpp
r38 r42 1 #ifdef POSITION 1 2 /* 2 3 * $Id$ … … 21 22 }; // end namespace behavioural 22 23 }; // end namespace morpheo 24 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_set_signal.cpp
r41 r42 20 20 string signame = signal_name(_name, name, direction); 21 21 22 Signal * sig = new Signal (signame , 23 direction , 24 size , 25 presence_port); 22 Signal * sig = new Signal (signame, direction, size, presence_port); 26 23 27 24 _list_signal->push_back (sig); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_testbench_body.cpp
r41 r42 14 14 15 15 void Interface::testbench_body (Vhdl * & vhdl, 16 string counter_name) 16 string counter_name, 17 string reset_name ) 17 18 { 18 19 log_printf(FUNC,Behavioural,"testbench_body","Begin"); … … 28 29 while (i != _list_signal->end()) 29 30 { 30 (*i)->testbench_body(vhdl, counter_name );31 (*i)->testbench_body(vhdl, counter_name, reset_name); 31 32 ++i; 32 33 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_testbench_test.cpp
r41 r42 14 14 15 15 string Interface::testbench_test (Vhdl * & vhdl, 16 string counter_name) 16 string counter_name, 17 string reset_name ) 17 18 { 18 19 log_printf(FUNC,Behavioural,"testbench_test","Begin"); … … 25 26 string test_name_ok = testbench_test_ok (vhdl); 26 27 27 vhdl->set_body(test_name + " <= "+test_name_ok+";");28 vhdl->set_body(test_name + " <= '1' when ("+reset_name+" = '0') else "+test_name_ok+";"); 28 29 29 30 log_printf(FUNC,Behavioural,"testbench_test","End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_testbench_test_name.cpp
r41 r42 49 49 }; 50 50 51 string Interface::testbench_test_transaction_name (Vhdl * & vhdl) 52 { 53 log_printf(FUNC,Behavioural,"testbench_test_transaction_name","Begin"); 54 55 string name; 56 57 name = "interface_"; 58 if (_name != "") 59 name += _name + "_"; 60 name += "test_transaction"; 61 62 vhdl->set_signal(name,1); 63 64 log_printf(FUNC,Behavioural,"testbench_test_transaction_name","End"); 65 66 return name; 67 }; 68 51 69 }; // end namespace behavioural 52 70 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_testbench_test_ok.cpp
r41 r42 20 20 21 21 vhdl->set_body(test_name + " <= '1' when true"); 22 22 23 // set all condition 23 24 if (_list_signal->empty()== false) … … 31 32 } 32 33 } 33 vhdl->set_body(" else '0';");34 vhdl->set_body("\telse '0';"); 34 35 vhdl->set_body(""); 35 36 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_toXML.cpp
r38 r42 1 #ifdef POSITION 1 2 /* 2 3 * $Id$ … … 43 44 }; 44 45 45 #ifdef POSITION46 46 XML Interface::toXML_mapping (void) 47 47 { … … 55 55 xml.singleton_begin ("port_map"); 56 56 xml. attribut ("name" ,_name ); 57 xml. attribut ("component",(static_cast<Entity *>(_entity_map ))-> _name);58 xml. attribut ("port" ,(static_cast<Interface *>(_interface_map))-> _name);57 xml. attribut ("component",(static_cast<Entity *>(_entity_map ))->get_name()); 58 xml. attribut ("port" ,(static_cast<Interface *>(_interface_map))->get_name()); 59 59 xml.singleton_end (); 60 60 … … 63 63 return xml; 64 64 }; 65 #endif66 65 }; // end namespace behavioural 67 66 }; // end namespace morpheo 67 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_find_interface.cpp
r40 r42 15 15 if (_list_interface->empty()== false) 16 16 { 17 list<Interface_fifo*>::iterator i 17 list<Interface_fifo*>::iterator i = _list_interface->begin(); 18 18 19 19 while (i != _list_interface->end()) 20 20 { 21 if ((*i)-> _name== name)21 if ((*i)->get_name() == name) 22 22 return (*i); 23 23 ++i; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_get_clock.cpp
r41 r42 13 13 namespace behavioural { 14 14 15 stringInterfaces::get_clock (void)15 Signal * Interfaces::get_clock (void) 16 16 { 17 string clock = "";17 Signal * clock = NULL; 18 18 19 19 if (not _list_interface->empty()) 20 20 { 21 list<Interface_fifo*>::iterator i 21 list<Interface_fifo*>::iterator i = _list_interface->begin(); 22 22 23 23 while (i != _list_interface->end()) 24 24 { 25 string str= (*i)->get_clock ();25 Signal * sig = (*i)->get_clock (); 26 26 27 if (s tr != "")27 if (sig != NULL) 28 28 { 29 if (clock != "")29 if (clock != NULL) 30 30 throw ErrorMorpheo ("<Interfaces.get_clock> : find too many clock."); 31 clock = s tr;31 clock = sig; 32 32 } 33 33 ++i; … … 35 35 } 36 36 37 if (clock == "")37 if (clock == NULL) 38 38 throw ErrorMorpheo ("<Interfaces.get_clock> : no clock find."); 39 39 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_get_interface.cpp
r40 r42 47 47 }; 48 48 49 list<Interface_fifo*>* Interfaces::get_interface_list (void) 50 { 51 return _list_interface; 52 }; 53 49 54 }; // end namespace behavioural 50 55 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_set_interface.cpp
r40 r42 11 11 namespace behavioural { 12 12 13 Interface_fifo * Interfaces::set_interface (string name , 14 direction_t direction , 15 localisation_t localisation) 13 Interface_fifo * Interfaces::set_interface (string name 14 #ifdef POSITION 15 ,direction_t direction 16 ,localisation_t localisation 17 #endif 18 ) 16 19 { 17 Interface_fifo * interface = new Interface_fifo (name, direction, localisation); 20 Interface_fifo * interface = new Interface_fifo (name 21 #ifdef POSITION 22 ,direction 23 ,localisation 24 #endif 25 ); 18 26 19 27 _list_interface->push_back (interface); … … 22 30 }; 23 31 32 #ifdef POSITION 24 33 Interface_fifo * Interfaces::set_interface (string name , 25 34 direction_t direction , … … 33 42 return interface; 34 43 }; 35 44 #endif 36 45 37 46 }; // end namespace behavioural -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_testbench_body.cpp
r41 r42 14 14 15 15 string Interfaces::testbench_body (Vhdl * & vhdl, 16 string counter_name) 16 string counter_name, 17 string reset_name ) 17 18 { 18 19 log_printf(FUNC,Behavioural,"testbench_body","Begin"); … … 28 29 while (i != _list_interface->end()) 29 30 { 30 (*i)->testbench_body(vhdl, counter_name );31 string str = (*i)->testbench_test(vhdl, counter_name );31 (*i)->testbench_body(vhdl, counter_name, reset_name); 32 string str = (*i)->testbench_test(vhdl, counter_name, reset_name); 32 33 33 34 test += " and "+str; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_testbench_generate_file.cpp
r41 r42 19 19 Vhdl * vhdl = new Vhdl(_name+"_Testbench"); 20 20 string counter = "counter"; 21 string clock = this->get_clock(); 21 Signal * clock = this->get_clock(); 22 Signal * reset = this->get_reset(); 23 string clock_name = clock->get_name(); 24 string reset_name = reset->get_name(); 22 25 uint32_t cycle = this->get_cycle(); 23 26 24 vhdl ->set_signal (counter, "natural", "0"); 25 vhdl ->set_signal (clock , 1 , 0); // modif Signal_set_signal 27 vhdl->set_signal (clock_name, 1, 0); 28 vhdl->set_signal (reset_name, 1, 0); 29 vhdl->set_signal (counter, "natural"); 26 30 this->set_signal (vhdl); 27 31 28 32 vhdl->set_body(""); 29 33 vhdl->set_body("------------------------------------------------------"); 30 vhdl->set_body("-- Component ");34 vhdl->set_body("-- Component - Intanciation"); 31 35 vhdl->set_body("------------------------------------------------------"); 32 36 vhdl->set_body(""); … … 54 58 delete list_signal; 55 59 56 vhdl->set_body(""); 57 vhdl->set_body("------------------------------------------------------"); 58 vhdl->set_body("-- Port's affectation"); 59 vhdl->set_body("------------------------------------------------------"); 60 vhdl->set_body(""); 61 string test_name = this->testbench_body(vhdl,counter); 60 string test_name = this->testbench_body(vhdl,counter, reset_name); 62 61 63 62 vhdl->set_body(""); 64 63 vhdl->set_body("------------------------------------------------------"); 65 vhdl->set_body("-- process clock");64 vhdl->set_body("-- reset"); 66 65 vhdl->set_body("------------------------------------------------------"); 67 66 vhdl->set_body(""); 68 vhdl->set_body(clock+" <= not "+clock+" after 50 ns;"); 67 vhdl->set_body("-- if the systemC simulate have multiple reset, we make the last"); 68 vhdl->set_body(reset_name+" <= '1' after 150 ns;"); 69 69 70 vhdl->set_body(""); 70 vhdl->set_body("process ("+clock+")"); 71 vhdl->set_body("------------------------------------------------------"); 72 vhdl->set_body("-- process clock_name"); 73 vhdl->set_body("------------------------------------------------------"); 74 vhdl->set_body(""); 75 vhdl->set_body(clock_name+" <= not "+clock_name+" after 50 ns;"); 76 vhdl->set_body(""); 77 vhdl->set_body("process ("+clock_name+")"); 71 78 vhdl->set_body("begin"); 72 vhdl->set_body("\tif "+clock+"'event and "+clock+" = '1' then"); 73 vhdl->set_body("\t\t"+counter+" <= "+counter+"+1;"); 79 vhdl->set_body("\tif ("+clock_name+"'event and "+clock_name+" = '1') then"); 74 80 vhdl->set_body(""); 75 vhdl->set_body("\t\tassert ("+test_name+" = '1') report \"Test KO\" severity FAILURE;"); 76 vhdl->set_body("\t\tassert not ("+counter+" = "+toString(cycle)+") report \"Test OK\" severity FAILURE;"); 81 vhdl->set_body("\t\tif ("+reset_name+" = '0') then"); 77 82 vhdl->set_body(""); 83 vhdl->set_body("\t\t\t"+counter+" <= "+toString(reset->get_reset_cycle(true))+";"); 84 vhdl->set_body(""); 85 vhdl->set_body("\t\telse"); 86 vhdl->set_body(""); 87 vhdl->set_body("\t\t\t"+counter+" <= "+counter+"+1;"); 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 #ifdef VHDL_TESTBENCH_ASSERT 93 vhdl->set_body("\t\t\t-- Assert ..."); 94 for (uint32_t cpt=0; cpt<=cycle; cpt++) 95 vhdl->set_body("\t\t\tassert not ("+counter+" = "+toString(cpt)+") report \"===== Test number "+toString(cpt)+" =====\" severity NOTE;"); 96 #endif 97 98 vhdl->set_body(""); 99 vhdl->set_body("\t\tend if;"); 78 100 vhdl->set_body("\tend if;"); 79 101 vhdl->set_body("end process;"); 80 102 81 vhdl->generate_file(); 103 104 vhdl->generate_file(false,true); 82 105 83 106 delete vhdl; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_toXML.cpp
r40 r42 1 #ifdef POSITION 1 2 /* 2 3 * $Id$ … … 29 30 }; 30 31 31 #ifdef POSITION32 32 XML Interfaces::toXML_mapping (void) 33 33 { … … 47 47 return xml; 48 48 }; 49 #endif50 49 }; // end namespace behavioural 51 50 }; // end namespace morpheo 51 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal.cpp
r40 r42 18 18 _direction (direction ), 19 19 _size (size ), 20 _presence_port ( presence_port)20 _presence_port ((direction==INTERNAL)?PORT_VHDL_NO_TESTBENCH_NO:presence_port) 21 21 { 22 22 log_printf(FUNC,Behavioural,"Signal","Begin"); 23 _is_allocate = false; 24 _is_map = false; 25 _signal = NULL; 26 _sc_signal = NULL; 27 _sc_signal_map = NULL; 28 _type_info = UNKNOW; 23 29 #ifdef VHDL_TESTBENCH 24 _signal = NULL; 25 _type_info = UNKNOW; 26 _list_value = new list<string>; 30 _list_value = new list<string>; 27 31 #endif 28 32 log_printf(FUNC,Behavioural,"Signal","End"); … … 36 40 { 37 41 log_printf(FUNC,Behavioural,"Signal (copy)","Begin"); 42 _is_allocate= signal._is_allocate; 43 _is_map = signal._is_map ; 44 _sc_signal = signal._sc_signal ; 45 _sc_signal_map = signal._sc_signal_map; 46 _type_info = signal._type_info ; 38 47 #ifdef VHDL_TESTBENCH 39 _signal = signal._signal ;40 _type_info = signal._type_info ;41 48 _list_value = signal._list_value; 42 49 #endif … … 47 54 { 48 55 log_printf(FUNC,Behavioural,"~Signal","Begin"); 56 57 // if (_is_allocate == true) 58 // switch (_direction) 59 // { 60 // case IN : 61 // { 62 // switch (_type_info) 63 // { 64 // case BOOL : {delete (static_cast<sc_in <bool > *>(_sc_signal)); break;} 65 // case UINT8_T : {delete (static_cast<sc_in <uint8_t > *>(_sc_signal)); break;} 66 // case UINT16_T : {delete (static_cast<sc_in <uint16_t> *>(_sc_signal)); break;} 67 // case UINT32_T : {delete (static_cast<sc_in <uint32_t> *>(_sc_signal)); break;} 68 // case UINT64_T : {delete (static_cast<sc_in <uint64_t> *>(_sc_signal)); break;} 69 // default : {throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.")); break;} 70 // } 71 // break; 72 // } 73 // case OUT : 74 // { 75 // switch (_type_info) 76 // { 77 // case BOOL : {delete (static_cast<sc_out <bool > *>(_sc_signal)); break;} 78 // case UINT8_T : {delete (static_cast<sc_out <uint8_t > *>(_sc_signal)); break;} 79 // case UINT16_T : {delete (static_cast<sc_out <uint16_t> *>(_sc_signal)); break;} 80 // case UINT32_T : {delete (static_cast<sc_out <uint32_t> *>(_sc_signal)); break;} 81 // case UINT64_T : {delete (static_cast<sc_out <uint64_t> *>(_sc_signal)); break;} 82 // default : {throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.")); break;} 83 // } 84 // break; 85 // } 86 // case INTERNAL : 87 // { 88 // switch (_type_info) 89 // { 90 // case BOOL : {delete (static_cast<sc_sc_signal <bool > *>(_sc_signal)); break;} 91 // case UINT8_T : {delete (static_cast<sc_sc_signal <uint8_t > *>(_sc_signal)); break;} 92 // case UINT16_T : {delete (static_cast<sc_sc_signal <uint16_t> *>(_sc_signal)); break;} 93 // case UINT32_T : {delete (static_cast<sc_sc_signal <uint32_t> *>(_sc_signal)); break;} 94 // case UINT64_T : {delete (static_cast<sc_sc_signal <uint64_t> *>(_sc_signal)); break;} 95 // default : {throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.")); break;} 96 // } 97 // break; 98 // } 99 // default : {throw (ErrorMorpheo ("Signal \""+_name+"\" : direction unknow.")); break;} 100 // } 101 49 102 #ifdef VHDL_TESTBENCH 50 103 delete _list_value; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_get_clock.cpp
r41 r42 13 13 namespace behavioural { 14 14 15 stringSignal::get_clock (void)15 Signal * Signal::get_clock (void) 16 16 { 17 17 if ((_presence_port == CLOCK_VHDL_YES) or 18 18 (_presence_port == CLOCK_VHDL_NO )) 19 return _name;19 return this; 20 20 else 21 return "";21 return NULL; 22 22 }; 23 23 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_get_name_vhdl.cpp
r41 r42 1 # ifdef VHDL_TESTBENCH1 # ifdef VHDL_TESTBENCH 2 2 /* 3 3 * $Id$ … … 17 17 if ((_presence_port == PORT_VHDL_YES_TESTBENCH_YES) or 18 18 (_presence_port == PORT_VHDL_YES_TESTBENCH_NO ) or 19 (_presence_port == CLOCK_VHDL_YES)) 19 (_presence_port == CLOCK_VHDL_YES) or 20 (_presence_port == RESET_VHDL_YES)) 20 21 list_signal->push_back(_name); 21 22 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_print.cpp
r40 r42 21 21 << toString(x._presence_port); 22 22 23 // #ifdef VHDL_TESTBENCH24 // if (x._list_value->empty()== false)25 // {26 // list<string>::iterator i = x._list_value->begin();27 28 // while (i != x._list_value->end())29 // {30 // output_stream << "\n\t" << *i ;31 // ++i;32 // }33 // }34 // #endif35 36 23 log_printf(FUNC,Behavioural,"operator<<","End"); 37 24 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_set_port.cpp
r41 r42 19 19 if ((_presence_port == PORT_VHDL_YES_TESTBENCH_YES) or 20 20 (_presence_port == PORT_VHDL_YES_TESTBENCH_NO ) or 21 (_presence_port == CLOCK_VHDL_YES)) 21 (_presence_port == CLOCK_VHDL_YES) or 22 (_presence_port == RESET_VHDL_YES)) 22 23 vhdl->set_port (_name,_direction,_size); 23 24 … … 30 31 log_printf(FUNC,Behavioural,"set_signal (Vhdl)","Begin"); 31 32 32 if ((_presence_port == PORT_VHDL_YES_TESTBENCH_YES) or 33 (_presence_port == PORT_VHDL_NO_TESTBENCH_YES )// or 34 // (_presence_port == CLOCK_VHDL_YES) or 35 // (_presence_port == CLOCK_VHDL_NO ) 33 if ( (_presence_port == PORT_VHDL_YES_TESTBENCH_YES) 34 or (_presence_port == PORT_VHDL_NO_TESTBENCH_YES ) 35 // or (_presence_port == CLOCK_VHDL_YES) 36 // or (_presence_port == CLOCK_VHDL_NO ) 37 // or (_presence_port == RESET_VHDL_YES) 38 // or (_presence_port == RESET_VHDL_NO ) 36 39 ) 37 40 vhdl->set_signal (_name ,_size); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_testbench.cpp
r41 r42 18 18 19 19 if ((_presence_port == PORT_VHDL_YES_TESTBENCH_YES) or 20 (_presence_port == PORT_VHDL_NO_TESTBENCH_YES )) 20 (_presence_port == PORT_VHDL_NO_TESTBENCH_YES ) or 21 (_presence_port == RESET_VHDL_YES ) or 22 (_presence_port == RESET_VHDL_NO ) ) 21 23 { 22 24 string str; … … 32 34 case IN : {str = toBase2 (value); break;} 33 35 case OUT : {str = toBase2 (value); break;} 34 // case INOUT: {break;}36 default : {break;} 35 37 } 36 38 break; … … 44 46 case IN : {str = toBase2 (value,_size); break;} 45 47 case OUT : {str = toBase2 (value,_size); break;} 46 // case INOUT: {break;}48 default : {break;} 47 49 } 48 50 break; … … 56 58 case IN : {str = toBase2 (value,_size); break;} 57 59 case OUT : {str = toBase2 (value,_size); break;} 58 // case INOUT: {break;}60 default : {break;} 59 61 } 60 62 break; … … 68 70 case IN : {str = toBase2 (value,_size); break;} 69 71 case OUT : {str = toBase2 (value,_size); break;} 70 // case INOUT: {break;}72 default : {break;} 71 73 } 72 74 break; … … 80 82 case IN : {str = toBase2 (value,_size); break;} 81 83 case OUT : {str = toBase2 (value,_size); break;} 82 // case INOUT: {break;}84 default : {break;} 83 85 } 84 86 break; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_testbench_body.cpp
r41 r42 13 13 14 14 void Signal::testbench_body (Vhdl * & vhdl, 15 string counter_name) 15 string counter_name, 16 string reset_name ) 16 17 { 17 18 log_printf(FUNC,Behavioural,"testbench_body","Begin"); 18 19 19 20 // _list_value is empty if we don't trace 20 if (_list_value->empty()== false)21 {22 string separator;23 if (_size == 1)24 separator = "\'";25 else26 separator = "\"";27 21 28 string signame = (_direction==OUT)?(_name+"_test"):_name; 29 30 vhdl->set_body (""); 31 vhdl->set_body ("with "+counter_name+" select"); 32 vhdl->set_body ("\t"+signame+" <="); 33 34 uint32_t cpt = 0; 35 list<string>::iterator i = _list_value->begin(); 36 37 while (i != _list_value->end()) 38 { 39 list<string>::iterator j = i; 40 41 ++i; 42 43 if (i != _list_value->end()) 22 if ((_presence_port == PORT_VHDL_YES_TESTBENCH_YES) or 23 (_presence_port == PORT_VHDL_NO_TESTBENCH_YES )) 24 if (_list_value->empty()== false) 25 { 26 string separator; 27 if (_size == 1) 28 separator = "\'"; 29 else 30 separator = "\""; 31 32 string signame = (_direction==OUT)?(_name+"_test"):_name; 33 34 vhdl->set_body (""); 35 vhdl->set_body ("with "+counter_name+" select"); 36 vhdl->set_body ("\t"+signame+" <="); 37 38 uint32_t cpt = 0; 39 list<string>::iterator i = _list_value->begin(); 40 41 while (i != _list_value->end()) 42 { 43 list<string>::iterator j = i; 44 45 ++i; 46 44 47 vhdl->set_body ("\t"+separator+*j+separator+" when "+toString(cpt++)+","); 45 else 46 vhdl->set_body ("\t"+separator+*j+separator+" when others;"); 47 } 48 } 49 48 } 49 50 if (_size == 1) 51 vhdl->set_body ("\t'0' when others;"); 52 else 53 vhdl->set_body ("\t(others => '0') when others;"); 54 } 55 50 56 log_printf(FUNC,Behavioural,"testbench_body","End"); 51 57 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_testbench_test_ok.cpp
r41 r42 18 18 19 19 if (_direction == OUT) 20 vhdl->set_body (" and "+_name+" = "+_name+"_test");20 vhdl->set_body ("\tand "+_name+" = "+_name+"_test"); 21 21 22 22 log_printf(FUNC,Behavioural,"testbench_test_ok","End");
Note: See TracChangeset
for help on using the changeset viewer.