Changeset 30 for trunk/IPs/systemC/processor/Morpheo/Tools/Viewer
- Timestamp:
- May 24, 2007, 4:43:17 PM (18 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/include/BaseP.h
r22 r30 22 22 string comment; 23 23 int level; 24 24 25 protected: 25 26 … … 38 39 int getLevel(); 39 40 void setLevel (int v); 41 int getSchema(); 40 42 };//end class BaseP 41 43 -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseP_accessors.cpp
r26 r30 49 49 } 50 50 51 int BaseP::getSchema(){return ent->getSchema();} 51 52 };//end bdd 52 53 };//end viewer -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseV_searchComponent.cpp
r26 r30 13 13 morpheo::tools::viewer::bdd::BaseP BaseV::get_BasePos(string v){ 14 14 int tmp=listcomp->indexOf(v,0); 15 if(tmp==-1) 15 if(tmp==-1){ 16 cout << "not found\n"; 16 17 return NULL; 18 } 17 19 else 18 20 return pos->operator[](tmp); -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h
r26 r30 39 39 #include <qdirmodel.h> 40 40 #include <qevent.h> 41 #include <qfiledialog.h> 41 42 42 43 … … 74 75 75 76 void _open(); //open a file 76 void _open_end(); 77 void _open_error(); 77 void _open_error(); 78 78 79 79 void _save(); //save a file … … 111 111 void drawPort(int x,int y,int pos,string dir); //draw the components ports 112 112 void write_name(string name); //write the name of the component clicked name in the informations window 113 void write_position(int x, int y);//write the position of the position clicked in the informations window114 void write_size(int x, int y);//write the size of the component clicked in the informations window115 113 void write_comment(string comment); 116 void erase_position(); 117 void erase_size(); 114 void write_type(string t); 118 115 119 116 QList <Port> port_east; //ports lists … … 127 124 QWidget *ws; 128 125 QWidget *wq; 129 QWidget *wo;130 126 QWidget *wa; 131 127 … … 148 144 QString current_name; //name of the current file opened 149 145 150 /*items of the parameters window*/151 QLineEdit *positionX; //x position152 QLineEdit *positionY;//y position153 QLineEdit *sizeX;//x size154 QLineEdit *sizeY;//y size155 156 146 /*items of the informations window*/ 157 147 QLabel *lname;//name of the component clicked 148 QLabel *ln; 158 149 QLineEdit *comment;//comment associated with the component clicked 150 QLabel *lt; 151 QLabel *ltype;//type of the component 152 159 153 int level; //level of architecture 160 154 int mouseX; //mouse position … … 185 179 bool paint; //(re)paint or not 186 180 bool wq_open; //know if Quit/Open ( 2 windows possible)/Save window is open 187 bool wo_open;188 bool ws_open;189 181 bool wa_open; 190 182 bool quit_demand;//know if user clicked on "quit" (used for saving file before quit) 191 183 bool file_open;//know if a file is still open (used if user wants to open another file) 192 bool is_parse;//know is the base has been created193 184 bool signalName;//show or hide signals name 194 185 bool componentName;//show or hide components name -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp
r26 r30 7 7 void Window::paintEvent( QPaintEvent * ) 8 8 { 9 10 9 /*draw window size*/ 11 10 setMinimumSize(600,600); 12 11 12 int schema; 13 QString t; 14 13 15 if(paint){ 14 16 painter.begin(this); … … 53 55 tailleX = co->get_size_x(); 54 56 tailleY = co->get_size_y(); 55 painter.drawRect(posX,posY,tailleX,tailleY); 57 58 t=QString::fromStdString(it->getType()).toLower(); 59 BaseP tp = base->get_BasePos(t.toStdString()); 60 if(&tp != NULL){ 61 schema=tp.getSchema(); 62 switch(schema){ 63 case 0: 64 painter.drawRect(posX,posY,tailleX,tailleY); 65 break; 66 case 1: 67 painter.drawEllipse(posX,posY,tailleX,tailleY); 68 break; 69 case 2: 70 painter.drawRect(posX,posY,tailleX,tailleY); 71 painter.drawLine(posX+tailleX/4,posY+tailleY,posX+tailleX/4,posY); 72 painter.drawLine(posX+tailleX/2,posY+tailleY,posX+tailleX/2,posY); 73 painter.drawLine(posX+3*tailleX/4,posY+tailleY,posX+3*tailleX/4,posY); 74 break; 75 case 3: 76 painter.drawRect(posX,posY,tailleX,tailleY); 77 painter.drawLine(posX,posY+tailleY,posX+tailleX/2,posY+tailleY/2); 78 painter.drawLine(posX+tailleX,posY+tailleY,posX+tailleX/2,posY+tailleY/2); 79 break; 80 } 81 } 82 56 83 if (componentName){ 57 84 QString compo_name = QString::fromStdString(it->getName()); -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp
r26 r30 10 10 11 11 void Window::_open(){ 12 //if no file open or if the file opened has been saved -> open other file, else -> ask for saving file 13 if(!file_open || is_save){ 14 wo = new QWidget(); 15 wo_open = true; //the "open" window is open 16 if(wa_open) 17 wa->close(); 18 QBoxLayout *open_box = new QBoxLayout(QBoxLayout::TopToBottom,0); 19 wo->setWindowTitle("open : file name"); 20 wo->setFixedSize(500,500); 21 wo->move(50,100); 22 QDirModel *dir = new QDirModel(); 23 QTreeView *tree = new QTreeView(wo); 24 tree->resize(400,400); 25 tree->setModel(dir); 26 tree->setRootIndex(dir->index("./data/")); 27 file_name = new QLineEdit(wo); 28 QPushButton *ok_open = new QPushButton("ok",wo); 29 connect(ok_open,SIGNAL(clicked()),this,SLOT(_open_end())); 30 open_box->addWidget(tree); 31 open_box->addWidget(file_name); 32 open_box->addWidget(ok_open); 33 wo->setLayout(open_box); 34 wo->show(); 12 QString current2; 13 if(!file_open && is_save){//if no file open or if the file opened has been saved -> open other file, else -> ask for saving file 14 current2 = QFileDialog::getOpenFileName(this,"", "./data"); 15 if(current2!=""){ 16 this->setDisabled(true); 17 current_name = current2; 18 if(parse->open_file( current_name.toStdString(),0)==-1) 19 _open_error(); 20 else{ 21 paint = false; 22 repaint(); 23 _init_file(); 24 } 25 } 35 26 } 36 27 else{ 37 wa_open = true;38 28 file_open = false; 39 wa = new QWidget(); 40 QBoxLayout *other_box = new QBoxLayout(QBoxLayout::LeftToRight,0); 41 wa->setFixedSize(500,60); 42 wa->move(50,100); 43 QLabel *label = new QLabel("do you want to save this file?"); 44 QPushButton *yes_save = new QPushButton("yes",wa); 45 QPushButton *no_save = new QPushButton("no",wa); 46 if(current_name!=NULL) 47 connect(yes_save,SIGNAL(clicked()),this,SLOT(_save())); 48 else 49 connect(yes_save,SIGNAL(clicked()),this,SLOT(_saveAs())); 50 connect(no_save,SIGNAL(clicked()),this,SLOT(_open())); 51 other_box->addWidget(label); 52 other_box->addWidget(yes_save); 53 other_box->addWidget(no_save); 54 wa->setLayout(other_box); 55 wa->show(); 56 } 57 } 58 59 60 void Window::_open_end(){ 61 current_name=file_name->text(); 62 wo->close(); 63 wo_open = false;//the "open" window is now closed 64 if(!is_parse){ 65 parse = new Parse(); 66 is_parse=true; 67 } 68 if(parse->open_file( current_name.toStdString(),0)==-1) 69 _open_error(); 70 else{ 71 paint = false; 72 repaint(); 73 _init_file(); 29 if(!is_save){ 30 wa_open = true; 31 wa = new QWidget(); 32 QBoxLayout *other_box = new QBoxLayout(QBoxLayout::LeftToRight,0); 33 wa->setFixedSize(500,60); 34 wa->move(50,100); 35 QLabel *label = new QLabel("do you want to save this file?"); 36 QPushButton *yes_save = new QPushButton("yes",wa); 37 QPushButton *no_save = new QPushButton("no",wa); 38 if(current_name!=NULL) 39 connect(yes_save,SIGNAL(clicked()),this,SLOT(_save())); 40 else 41 connect(yes_save,SIGNAL(clicked()),this,SLOT(_saveAs())); 42 connect(no_save,SIGNAL(clicked()),this,SLOT(_open())); 43 other_box->addWidget(label); 44 other_box->addWidget(yes_save); 45 other_box->addWidget(no_save); 46 wa->setLayout(other_box); 47 wa->show(); 48 } 49 else{ 50 parse->closeBaseV(); 51 _open(); 52 } 74 53 } 75 54 } … … 96 75 paint = true; 97 76 repaint(); 77 this->setDisabled(false); 98 78 setMouseTracking(true); 99 79 } … … 112 92 wa->close(); 113 93 if(save_as || first_save || (current_name==NULL)){//if "save as" or if it's the first time the user click on save (new file) -> save as 114 ws = new QWidget(); 115 ws_open = true;//the "save" window is open 116 QBoxLayout *save_box = new QBoxLayout(QBoxLayout::LeftToRight,0); 117 ws->setWindowTitle("save : file name"); 118 ws->setFixedSize(300,60); 119 ws->move(50,100); 120 file_name = new QLineEdit(ws); 121 QPushButton *ok_save = new QPushButton("ok",ws); 122 connect(ok_save,SIGNAL(clicked()),this,SLOT(_saveAsOk())); 123 save_box->addWidget(file_name); 124 save_box->addWidget(ok_save); 125 ws->setLayout(save_box); 126 ws->show(); 94 current_name = QFileDialog::getSaveFileName(this,"","./data"); 127 95 save_as = false; 128 96 first_save = false; … … 155 123 156 124 void Window::_saveAsOk(){ 157 current_name = file_name->text();158 ws->close();//close the "save" window159 ws_open = false;160 125 is_save = true; 161 126 status->showMessage("file " + current_name + " saved",900); … … 170 135 void Window::_close(){ 171 136 paint = false; 137 parse->closeBaseV(); 172 138 lname->setText(""); 139 ln->setText(""); 140 lt->setText(""); 141 write_name(""); 142 write_comment(""); 143 comment->hide(); 173 144 winfo->show(); 174 145 file_open = false; … … 206 177 if(wq_open) 207 178 wq->close(); 208 if(wo_open)209 wo->close();210 if(ws_open)211 ws->close();212 179 if(wa_open) 213 180 wa->close(); -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp
r26 r30 14 14 winfo->setFixedSize(350,292); 15 15 winfo->move(628,50); 16 17 QBoxLayout *bname = new QBoxLayout(QBoxLayout::LeftToRight,0); 18 ln = new QLabel(); 19 ln->setText(""); 16 20 lname = new QLabel(); 17 21 lname->setText(""); 22 bname->addWidget(ln); 23 bname->addWidget(lname); 24 25 QBoxLayout *btype = new QBoxLayout(QBoxLayout::LeftToRight,0); 26 lt = new QLabel(); 27 lt->setText(""); 28 ltype = new QLabel(); 29 ltype->setText(""); 30 btype->addWidget(lt); 31 btype->addWidget(ltype); 32 18 33 comment = new QLineEdit(); 19 34 comment->setText(""); 20 informations->addWidget(lname); 35 comment->setReadOnly(true); 36 37 QPushButton *noselect = new QPushButton("cancel selection",wparam); 38 QPushButton *back = new QPushButton("back",wparam); 39 connect(back,SIGNAL(clicked()),this,SLOT(_back())); 40 connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection())); 41 42 informations->addLayout(bname); 43 informations->addLayout(btype); 21 44 informations->addWidget(comment); 45 informations->addWidget(noselect); 46 informations->addWidget(back); 47 22 48 winfo->setLayout(informations); 23 49 winfo->show(); … … 27 53 QString c = QString::fromStdString(cm); 28 54 comment->setText(c); 55 comment->show(); 29 56 } 30 57 … … 33 60 lname->setText(n); 34 61 } 62 63 void Window::write_type(string type){ 64 lt->setText("type"); 65 QString n = QString::fromStdString(type); 66 ltype->setText(n); 67 } 68 69 void Window::_cancel_selection(){ 70 component_clicked = false; 71 } -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp
r26 r30 10 10 { 11 11 paint = false; 12 is_parse = false;13 12 window_height = 620; 14 13 window_width = 620; … … 137 136 138 137 /*little windows (open, save...), closed at init*/ 139 wo_open = false;140 138 wq_open = false; 141 ws_open = false;142 139 wa_open = false; 143 140 … … 157 154 file_open = false; 158 155 paint = false; 159 is_save = false;156 is_save = true; 160 157 } 161 158 } -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp
r28 r30 7 7 8 8 void Window::mousePressEvent (QMouseEvent *e){ 9 10 9 if(paint && (p.getArchitecture() != NULL)){ 11 10 12 11 compo = p.getComponent(); 13 14 12 15 13 QMouseEvent *mouseEvent = (QMouseEvent *) e; … … 20 18 bool bc = false; 21 19 int cx,cy,tx,ty; 22 string cc,nc ;20 string cc,nc,type; 23 21 bool found = false; 24 22 … … 67 65 tab[cpt_level] = father; 68 66 paint = true; 69 this->releaseMouse();70 67 repaint(); 71 68 write_name(""); 72 69 write_comment(""); 73 erase_position(); 74 erase_size(); 70 write_type(""); 71 ln->setText(""); 72 lt->setText(""); 73 comment->hide(); 75 74 found = false; 76 75 this->setDisabled(false); 76 component_clicked = false; 77 77 } 78 78 … … 85 85 tx = taillex; 86 86 ty = tailley; 87 type = it->getType(); 87 88 BaseP tp = base->get_BasePos(t.toStdString()); 88 89 if(&tp != NULL) … … 94 95 if(bc){ 95 96 write_name(nc); 96 write_position(cx,cy); 97 write_size(tx,ty); 97 write_type(type); 98 ln->setText("component"); 99 lt->setText("type"); 98 100 write_comment(cc); 99 101 } … … 103 105 104 106 void Window::mouseMoveEvent(QMouseEvent *e){ 105 106 bool b = false; 107 bool b2 = false; 108 bool b3 = false; 109 int px,py,taillex,tailley,ppx,ppy; 110 string s,s2,c; 107 bool b = false; 108 bool b2 = false; 109 bool b3 = false; 110 int px,py,taillex,tailley,ppx,ppy; 111 string s,s2,c,type; 111 112 112 113 if(paint && (p.getArchitecture() != NULL) && !component_clicked){ … … 125 126 taillex = co->get_size_x(); 126 127 tailley = co->get_size_y(); 127 128 QString t=QString::fromStdString(it->getType()).toLower(); 128 129 QList<PortMap> *pm=it->getPortMap(); 129 130 … … 132 133 b = true; 133 134 s = it->getName(); 134 BaseP tp=base->get_BasePos(it->getName()); 135 type = it->getType(); 136 BaseP tp=base->get_BasePos(t.toStdString()); 135 137 if(&tp!=NULL) 136 138 c=tp.getComment(); … … 154 156 if(b){ 155 157 write_name(s); 156 write_ position(ppx,ppy);157 write_size(taillex,tailley);158 write_type(type); 159 ln->setText("component"); 158 160 write_comment(c); 161 lt->setText("type"); 159 162 b3 = false; 160 163 b2 = false; … … 163 166 if(b2){ 164 167 write_name(s); 165 erase_position(); 168 write_type(""); 169 lt->setText(""); 166 170 write_comment(""); 171 ln->setText("signal"); 172 comment->hide(); 167 173 b3 = false; 168 174 b = false; … … 171 177 if(!b && !b2){ 172 178 write_name(""); 173 erase_position(); 179 write_type(""); 180 ln->setText(""); 181 lt->setText(""); 174 182 write_comment(""); 175 erase_size(); 176 } 177 183 comment->hide(); 184 } 178 185 } 179 186 … … 217 224 b = false; 218 225 write_name(""); 219 erase_position();220 226 write_name(s2); 221 erase_size(); 227 write_type(type); 228 ln->setText("signal"); 229 lt->setText(""); 230 write_comment(""); 231 comment->hide(); 222 232 } 223 233 } … … 262 272 repaint(); 263 273 this->setDisabled(false); 274 component_clicked = false; 264 275 } 265 276 } -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp
r26 r30 15 15 wparam->move(628,370); 16 16 17 QBoxLayout *bpos = new QBoxLayout(QBoxLayout::LeftToRight,0);18 QLabel *lx = new QLabel();19 lx->setText("position x : ");20 positionX = new QLineEdit();21 positionX->setText("");22 bpos->addWidget(lx);23 bpos->addWidget(positionX);24 17 25 QBoxLayout *bpos2 = new QBoxLayout(QBoxLayout::LeftToRight,0);26 QLabel *ly = new QLabel();27 ly->setText("position y : ");28 positionY = new QLineEdit();29 positionY->setText("");30 bpos2->addWidget(ly);31 bpos2->addWidget(positionY);32 33 QBoxLayout *bsize = new QBoxLayout(QBoxLayout::LeftToRight,0);34 QLabel *sx = new QLabel();35 sx->setText("size x : ");36 sizeX = new QLineEdit();37 sizeX->setText("");38 bsize->addWidget(sx);39 bsize->addWidget(sizeX);40 41 QBoxLayout *bsize2 = new QBoxLayout(QBoxLayout::LeftToRight,0);42 QLabel *sy = new QLabel();43 sy->setText("size y : ");44 sizeY = new QLineEdit();45 sizeY->setText("");46 bsize2->addWidget(sy);47 bsize2->addWidget(sizeY);48 parameters->addLayout(bpos);49 parameters->addLayout(bpos2);50 parameters->addLayout(bsize);51 parameters->addLayout(bsize2);52 QPushButton *noselect = new QPushButton("cancel selection",wparam);53 QPushButton *back = new QPushButton("back",wparam);54 18 QPushButton *apply = new QPushButton("apply",wparam); 55 connect(back,SIGNAL(clicked()),this,SLOT(_back()));56 connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection()));57 19 connect(apply,SIGNAL(clicked()),this,SLOT(_apply())); 58 20 59 parameters->addWidget(noselect);60 parameters->addWidget(back);61 21 parameters->addWidget(apply); 62 22 … … 65 25 } 66 26 67 void Window::write_position(int x, int y){68 stringstream out;69 string str;70 out << x;71 str = out.str();72 positionX->setText( QString::fromStdString(str));73 stringstream out2;74 string str2;75 out2 << y;76 str2 = out2.str();77 positionY->setText(QString::fromStdString(str2));78 }79 80 void Window::erase_position(){81 positionX->setText("");82 positionY->setText("");83 }84 85 void Window::write_size(int x,int y){86 stringstream out;87 string str;88 out << x;89 str = out.str();90 sizeX->setText(QString::fromStdString(str));91 stringstream out2;92 string str2;93 out2 << y;94 str2 = out2.str();95 sizeY->setText(QString::fromStdString(str2));96 }97 98 void Window::erase_size(){99 sizeX->setText("");100 sizeY->setText("");101 }102 103 void Window::_cancel_selection(){104 component_clicked = false;105 }106 27 107 28 void Window::_apply(){ 108 if(positionX->isModified()) 109 cout << "positionX modified : " << positionX->text().toStdString() << endl; 110 if(positionY->isModified()) 111 cout << "positionY modified : " << positionX->text().toStdString() << endl; 112 if(sizeX->isModified()) 113 cout << "sizeX modified : " << sizeX->text().toStdString() << endl; 114 if(sizeY->isModified()) 115 cout << "sizeY modified : " << sizeY->text().toStdString() << endl; 29 cout << "apply\n"; 116 30 } -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_closeBaseV.cpp
r27 r30 13 13 int i; 14 14 for(i==0;i<LEVEL_MAX;i++) 15 16 17 18 19 15 { 16 delete ctemp[i]; 17 delete arch[i]; 18 delete ent[i]; 19 } 20 20 delete pos; 21 21 delete base; 22 toplevel.clear(); 23 absolutePath.clear(); 24 base=NULL; 22 25 23 26 } -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/data/two_level_branch_predictor-branch_history_table.pos
r27 r30 9 9 <entity name="branch_history_table" 10 10 type="Branch_History_Table" 11 schema=" 1" >11 schema="2" > 12 12 13 13 <port name="clock" -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/data/two_level_branch_predictor-pattern_history_table.pos
r27 r30 9 9 <entity name="pattern_history_table" 10 10 type="Pattern_History_Table" 11 schema=" 1" >11 schema="3" > 12 12 13 13 <port name="clock"
Note: See TracChangeset
for help on using the changeset viewer.