[Armadeus-commitlog] SF.net SVN: armadeus: [609] trunk/software
Brought to you by:
sszy
|
From: <th...@us...> - 2007-06-30 09:22:47
|
Revision: 609
http://armadeus.svn.sourceforge.net/armadeus/?rev=609&view=rev
Author: thom25
Date: 2007-06-30 02:22:49 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
add initial version of orchestra project builder
Added Paths:
-----------
trunk/software/orchesta/
trunk/software/orchesta/armadeus_ready/
trunk/software/orchesta/common/
trunk/software/orchesta/common/armadeus_ready.cpp
trunk/software/orchesta/common/armadeus_ready.h
trunk/software/orchesta/common/ip.cpp
trunk/software/orchesta/common/ip.h
trunk/software/orchesta/common/line_option.cpp
trunk/software/orchesta/common/line_option.h
trunk/software/orchesta/common/platform.cpp
trunk/software/orchesta/common/platform.h
trunk/software/orchesta/common/project.cpp
trunk/software/orchesta/common/project.h
trunk/software/orchesta/common/toolchain.cpp
trunk/software/orchesta/common/toolchain.h
trunk/software/orchesta/common/xmldoc.cpp
trunk/software/orchesta/common/xmldoc.h
trunk/software/orchesta/plateform.xml
trunk/software/orchesta/projectBuilder/
trunk/software/orchesta/projectBuilder/debug/
trunk/software/orchesta/projectBuilder/main.cpp
trunk/software/orchesta/projectBuilder/projectBuilder.pro
trunk/software/orchesta/xilinx_toolchain.xml
Added: trunk/software/orchesta/common/armadeus_ready.cpp
===================================================================
--- trunk/software/orchesta/common/armadeus_ready.cpp (rev 0)
+++ trunk/software/orchesta/common/armadeus_ready.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,82 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** armadeus_ready.cpp: armadeus_ready utilities
+**
+** author: th...@us...
+*/
+#include "armadeus_ready.h"
+
+#include <qdir>
+#include <qfileinfo>
+#include <qstringlist>
+
+void ArmadeusReadyIpFinder::getNextIpAbsoluteNames(QFileInfoList *ipNamesList, QDir dir){
+ QDir fileDir(dir.path()+"/");
+ fileDir.setFilter(QDir::Files | QDir::NoSymLinks);
+ fileDir.setNameFilters(QStringList("*.xml"));
+
+ // start with local files
+ QFileInfoList list = fileDir.entryInfoList();
+ for (int i = 0; i < list.size(); ++i) {
+ ipNamesList->append(list.at(i));
+ }
+ // continue with local folders
+ dir.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot);
+ list = dir.entryInfoList();
+ for ( int i = 0; i < list.size(); ++i) {
+ getNextIpAbsoluteNames(ipNamesList, QDir(list.at(i).absoluteFilePath()+"/") );
+ }
+}
+
+QString ArmadeusReadyIpFinder::getIpAbsoluteFilePath( QString fileName ){
+ QFileInfoList ipList = getAllIpAbsoluteNames();
+ for( int i = 0; i<ipList.size(); i++ ){
+ if( ipList.at(i).baseName() == fileName )
+ return ipList.at(i).absoluteFilePath();
+ }
+ return QString();
+}
+
+
+
+void ArmadeusReadyIpFinder::setPath( QString path ){
+ armadeusReadyPath = path;
+}
+
+QFileInfoList ArmadeusReadyIpFinder::getAllIpAbsoluteNames(){
+ QFileInfoList result;
+ QDir dir(armadeusReadyPath);
+
+ dir.setFilter(QDir::AllDirs);
+ getNextIpAbsoluteNames(&result, dir);
+
+ return result;
+
+}
+
+QStringList ArmadeusReadyIpFinder::getAllIpNames(){
+ QStringList result;
+ QFileInfoList ipList = getAllIpAbsoluteNames();
+ for( int i = 0; i<ipList.size(); i++ ){
+ result.append(ipList.at(i).baseName());
+ }
+
+ return result;
+}
Added: trunk/software/orchesta/common/armadeus_ready.h
===================================================================
--- trunk/software/orchesta/common/armadeus_ready.h (rev 0)
+++ trunk/software/orchesta/common/armadeus_ready.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,50 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** armadeus_ready.h: armadeus_ready utilities
+**
+** author: th...@us...
+*/
+#ifndef ARMADEUS_READY_H
+#define ARMADEUS_READY_H
+
+#include <qstring>
+#include <qdir>
+
+#define ARMADEUS_READY_FOLDER "/armadeus_ready/"
+
+class ArmadeusReadyIpFinder
+{
+ protected:
+ QString armadeusReadyPath;
+
+ void getNextIpAbsoluteNames(QFileInfoList *ipNamesList, QDir dir);
+ QFileInfoList getAllIpAbsoluteNames();
+
+ public:
+ ArmadeusReadyIpFinder(){};
+ virtual ~ArmadeusReadyIpFinder(){};
+
+ virtual void setPath(QString path);
+ virtual QStringList getAllIpNames();
+ virtual QString getIpAbsoluteFilePath( QString fileName );
+};
+
+
+#endif //ARMADEUS_READY_H
Added: trunk/software/orchesta/common/ip.cpp
===================================================================
--- trunk/software/orchesta/common/ip.cpp (rev 0)
+++ trunk/software/orchesta/common/ip.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,137 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** ip.cpp: FGPA ip wrapper
+**
+** author: th...@us...
+*/
+#include <qstringlist>
+#include <qfile>
+#include <qdomdocument>
+#include <qbytearray>
+#include <qtextstream>
+#include <qregexpvalidator>
+#include "ip.h"
+
+AddressRange::AddressRange():top(0),bottom(0){};
+AddressRange::AddressRange(int byteSize):top(0), bottom(byteSize-1){};
+AddressRange::AddressRange(int start, int length):top(start), bottom(start+length-1){};
+
+void AddressRange::adjustStartAddress(int address){ top += address; bottom += address; }
+void AddressRange::adjustEndAddress(int address){ bottom += address; }
+
+void AddressRange::merge(AddressRange range){
+// printf("address Range: %d, %d\n", range.start(), range.end());
+ if( range.end() > bottom )
+ bottom = range.end();
+ if( range.start() < top )
+ top = range.start();
+}
+bool AddressRange::intersects(AddressRange range){
+ if( (range.start() >= top) || (range.end() <= bottom) )
+ return true;
+ return false;
+}
+int AddressRange::start(){ return top; }
+int AddressRange::end(){ return bottom; }
+
+
+
+
+bool Ip::setGenericAttributeValue(QString genericName, QString attributeName, QString attributeValue)
+{
+ QString filterString = getAttribute("generics", genericName, "valid");
+ if( filterString != "" ){ // if filter present
+ int pos=0;
+ QRegExpValidator validator(QRegExp(filterString), NULL);
+ if( validator.validate(attributeValue, pos) == QValidator::Acceptable ){
+ setAttributeValue("generics", genericName, attributeName, attributeValue);
+ return true;
+ }
+ }
+ else {
+ return setAttributeValue("generics", genericName, attributeName, attributeValue);
+ }
+ return false;
+}
+
+QString Ip::getHDLTopName(){
+ QDomElement hdls = xmlNode.firstChildElement("hdl_files");
+ QDomNodeList hdlList = hdls.childNodes();
+ for( int i =0; i<hdlList.size(); i++ ){
+ if( hdlList.at(i).toElement().attribute("istop") == "1" )
+ return hdlList.at(i).toElement().attribute("name");
+ }
+ return QString();
+}
+
+
+QStringList Ip::getNameList(QString nodeName){
+ QStringList result;
+ QDomElement generics = xmlNode.firstChildElement(nodeName);
+ QDomNodeList genericList = generics.childNodes();
+ for( int i =0; i<genericList.size(); i++ ){
+ if( genericList.at(i).isElement() ) // avoid non Element
+ result += genericList.at(i).toElement().attribute("name");
+ }
+ return result;
+}
+
+QString Ip::getBaseAddress(){
+ return xmlNode.firstChildElement("base_address").attribute("value");
+}
+
+void Ip::setBaseAddress(QString address){
+ QDomElement base_address = xmlNode.firstChildElement("base_address");
+ base_address.setAttribute("value",address);
+}
+
+QString Ip::getInterrupt(){
+ return xmlNode.firstChildElement("interrupt").attribute("value");
+}
+
+void Ip::setInterrupt(QString interrupt){
+ QDomElement interruptElement = xmlNode.firstChildElement("interrupt");
+ interruptElement.setAttribute("value",interrupt);
+}
+
+
+
+AddressRange Ip::getRegisterAddressRange(){
+ AddressRange range;
+ QStringList registerNameList = getRegistersNameList();
+ for( int i=0; i<registerNameList.count(); i++ ){
+ QString offset = getRegisterAttribute(registerNameList.at(i), "offset");
+ QString width = getRegisterAttribute(registerNameList.at(i), "width");
+ bool ok;
+
+ if( width.toInt() )
+ range.merge(AddressRange(offset.remove("0X").toInt(&ok,16),width.toInt()/8));
+ }
+ if( getBaseAddress() != "" ){
+ range.adjustStartAddress(getBaseAddress().toInt());
+ }
+// printf("address Range: %d, %d\n", range.start(), range.end());
+ return range;
+}
+
+bool Ip::isRegisterAddressConflict(QString registerAddress){
+ return getRegisterAddressRange().intersects(AddressRange(registerAddress.toInt()));
+}
+
Added: trunk/software/orchesta/common/ip.h
===================================================================
--- trunk/software/orchesta/common/ip.h (rev 0)
+++ trunk/software/orchesta/common/ip.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,144 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** ip.h: FGPA ip wrapper
+**
+** author: th...@us...
+*/
+#ifndef IP_H
+#define IP_H
+
+#include <qstringList>
+#include <qrect>
+#include "xmldoc.h"
+
+class AddressRange
+{
+ protected:
+ int top;
+ int bottom;
+
+ public:
+ AddressRange();
+ AddressRange(int byteSize);
+ AddressRange(int start, int length);
+ virtual ~AddressRange(){};
+
+ virtual void adjustStartAddress( int address );
+ virtual void adjustEndAddress( int address );
+ virtual void merge( AddressRange range );
+ virtual bool intersects( AddressRange range );
+ virtual int start();
+ virtual int end();
+};
+
+
+
+
+
+
+class Ip : public XMLNodeWrapper
+{
+ protected:
+
+ QStringList getNameList(QString nodeName);
+
+ public:
+ Ip():XMLNodeWrapper(){};
+ virtual ~Ip(){};
+
+ QString getReference() {return xmlNode.toElement().attribute("name");};
+ QString getDescription() {return getCDATA("description");};
+ QString getVersion() {return xmlNode.toElement().attribute("version");};
+ QString getName() { return xmlNode.toElement().attribute("user_name");};
+
+ QString getGenericAttribute(QString genericName, QString attributeName)
+ {return getAttribute("generics", genericName, attributeName);};
+ bool setGenericAttributeValue(QString genericName, QString attribute, QString attributeValue);
+ QStringList getGenericNameList() {return getNameList("generics");};
+
+ QStringList getRegistersNameList() {return getNameList("registers");};
+ QString getRegisterAttribute(QString registerName, QString attributeName)
+ {return getAttribute("registers", registerName, attributeName);};
+
+ QString getHDLAttribute(QString HDLName, QString attributeName)
+ {return getAttribute("hdl_files",HDLName, attributeName);};
+ QStringList getHDLNameList() {return getNameList("hdl_files");};
+ QString getHDLTopName();
+
+ QString getBaseAddress();
+ void setBaseAddress(QString address);
+ QString getInterrupt();
+ void setInterrupt(QString interrupt);
+
+ bool isRegisterAddressConflict(QString registerAddress);
+ AddressRange getRegisterAddressRange();
+
+};
+
+#endif // IP_H
+/*
+
+
+
+
+class Ip : public XMLDoc
+{
+ protected:
+ QStringList getNameList(QString nodeName);
+// virtual QString getAttribute(QString startNodeName, QString nodeName, QString attributeName);
+ QDomNode getGenericsNode(){return getTopNode().firstChildElement("generics");}
+ QDomNode getHDLsNode(){return getTopNode().firstChildElement("hdl_files");}
+ QDomNode getRegistersNode(){return getTopNode().firstChildElement("registers");}
+
+ public:
+ Ip();
+ virtual ~Ip();
+
+ QString getReference() {return getAttribute(QDomNode(), QString("ip"), QString("ref"));};
+ QString getDescription() {return getCDATA(doc.documentElement(), "description");};
+ QString getVersion() {return getAttribute(QDomNode(), "ip", "version");};
+ QString getName() {return getAttribute(QDomNode(), "ip", "name");};
+
+ QString getGenericAttribute(QString genericName, QString attributeName)
+ {return getAttribute(getGenericsNode(), genericName, attributeName);};
+ bool setGenericAttributeValue(QString genericName, QString attribute, QString attributeValue);
+ QStringList getGenericNameList() {return getNameList("generics");};
+
+ QStringList getRegistersNameList() {return getNameList("registers");};
+ QString getRegisterAttribute(QString registerName, QString attributeName)
+ {return getAttribute(getRegistersNode(), registerName, attributeName);};
+
+ QString getHDLAttribute(QString HDLName, QString attributeName)
+ {return getAttribute(getHDLsNode(), HDLName, attributeName);};
+ QStringList getHDLNameList() {return getNameList("hdl_files");};
+ QString getHDLTopName();
+
+ QString getBaseAddress();
+ void setBaseAddress(QString address);
+
+ bool isRegisterAddressConflict(QString registerAddress);
+ AddressRange getRegisterAddressRange();
+
+ virtual bool initialize(QString aFileName, QString anIpName); // initialize the ip object with the informations contained in the xml file
+ virtual bool initialize(QDomNode *ipNode){ return XMLDoc::initialize(ipNode); };
+};
+
+#endif // IP_H
+*/
Added: trunk/software/orchesta/common/line_option.cpp
===================================================================
--- trunk/software/orchesta/common/line_option.cpp (rev 0)
+++ trunk/software/orchesta/common/line_option.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,99 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** line_option.cpp: command line option parser
+**
+** author: th...@us...
+*/
+#include <QString>
+#include <QStringList>
+
+#include "line_option.h"
+
+LineOption::LineOption( QString opt, QString help, OptionCallback aCallback ) {
+ option = opt; verbose = help;
+ nbArgs = help.count('[');
+ optionCallback = aCallback;
+};
+
+bool LineOption::process(QStringList list) {
+ QStringList argsList;
+ if( (!list.isEmpty()) && (list.at(0) == option) ) {
+ list.removeFirst();
+ if( list.size() == nbArgs ) {
+ optionCallback(list);
+ return true;
+ }
+ }
+ return false;
+};
+
+QString LineOption::getHelp() {
+ return verbose;
+};
+
+LineOptionManager::LineOptionManager(QString aMenu){
+ menu = aMenu;
+}
+
+int LineOptionManager::getMaxCmdLength(){
+ int maxCmdLength = 0;
+ int pos = 0;
+ for( int i=0; i<optionList.size(); i++ ){
+ int tempMaxCmdLength = optionList.at(i)->getHelp().indexOf(' ');
+ if( (pos != -1) && (tempMaxCmdLength>maxCmdLength) ){
+ maxCmdLength = tempMaxCmdLength;
+ }
+ }
+ return maxCmdLength;
+}
+
+void LineOptionManager::formatCmd(QString *string, int maxLength){
+ int pos = string->indexOf(' ');
+ if( pos < maxLength ){
+ for( int i = pos; i<maxLength; i++)
+ string->insert(pos,' ');
+ }
+}
+
+void LineOptionManager::displayHelp(){
+ printf("%s\n",menu.toLatin1().constData());
+
+ QStringList helpList;
+ int maxCmdLength = getMaxCmdLength();
+
+ for( int i=0; i<optionList.size(); i++ ){
+ QString cmd = optionList.at(i)->getHelp();
+ formatCmd(&cmd,maxCmdLength);
+ printf("%s\n", cmd.toLatin1().constData());
+ }
+}
+
+void LineOptionManager::add(LineOption *opt){
+ optionList.append( opt );
+};
+
+void LineOptionManager::execute(QStringList args){
+ for( int i=0; i<optionList.size(); i++ ){
+ if( optionList.at(i)->process(args) ){
+ return;
+ }
+ }
+ displayHelp();
+}
Added: trunk/software/orchesta/common/line_option.h
===================================================================
--- trunk/software/orchesta/common/line_option.h (rev 0)
+++ trunk/software/orchesta/common/line_option.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,67 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** line_option.h: command line option parser
+**
+** author: th...@us...
+*/
+#ifndef LINE_OPTION_H
+#define LINE_OPTION_H
+#include <QString>
+#include <QStringList>
+
+typedef void (*OptionCallback)(QStringList);
+
+class LineOption
+{
+ protected:
+ QString option;
+ QString verbose;
+ OptionCallback optionCallback;
+ int nbArgs;
+
+ public:
+ LineOption(){};
+ LineOption( QString opt, QString help, OptionCallback aCallback );
+ ~LineOption(){};
+
+ bool process(QStringList list);
+ QString getHelp();
+};
+
+class LineOptionManager
+{
+ protected:
+ QString menu;
+ QList<LineOption*> optionList;
+
+ void displayHelp();
+ int getMaxCmdLength();
+ void formatCmd(QString *string, int maxLength);
+
+ public:
+ LineOptionManager(){};
+ LineOptionManager(QString aMenu);
+ ~LineOptionManager(){};
+
+ void add(LineOption *opt);
+ void execute(QStringList args);
+};
+
+#endif // LINE_OPTION_H
Added: trunk/software/orchesta/common/platform.cpp
===================================================================
--- trunk/software/orchesta/common/platform.cpp (rev 0)
+++ trunk/software/orchesta/common/platform.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,33 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** platform.cpp: FPGA platform wrapper
+**
+** author: th...@us...
+*/
+#include "platform.h"
+
+QString Platform::getFullFPGAType(){
+ QString result;
+
+ result = getFPGAType()+"-";
+ result += getFPGAPackage();
+ result += getFPGASpeed();
+ return result;
+}
Added: trunk/software/orchesta/common/platform.h
===================================================================
--- trunk/software/orchesta/common/platform.h (rev 0)
+++ trunk/software/orchesta/common/platform.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,44 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** platform.h: FPGA platform wrapper
+**
+** author: th...@us...
+*/
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#include "xmldoc.h"
+
+class Platform : public XMLNodeWrapper
+{
+ public:
+ Platform():XMLNodeWrapper(){};
+ virtual ~Platform(){};
+
+ QString getFPGAType() { return getAttribute("fpga", "type"); };
+ QString getFPGASpeed() { return getAttribute("fpga", "speed"); };
+ QString getFPGAPackage() { return getAttribute("fpga", "package"); };
+ QString getFPGAFamily() { return getAttribute("fpga", "family"); };
+ QString getBoardType() { return getAttribute("board", "type"); };
+ QString getDescription() { return getCDATA("description"); };
+ QString getFullFPGAType();
+};
+
+#endif //PLATFORM_H
Added: trunk/software/orchesta/common/project.cpp
===================================================================
--- trunk/software/orchesta/common/project.cpp (rev 0)
+++ trunk/software/orchesta/common/project.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,349 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** project.cpp: FPGA project manager
+**
+** author: th...@us...
+*/
+#include "project.h"
+#include "ip.h"
+#include "platform.h"
+#include <qfileinfo>
+#include <qtextstream>
+#include <qmap>
+#include <qcoreapplication>
+
+Project::Project(){
+ docFileName = "";
+}
+
+Project::~Project(){}
+
+QMap<QString, QString> Project::getProjectVariables(){
+ QMap<QString, QString> result;
+ Platform plt;
+ get(&plt);
+ result.insert("LT", "<"); // for <
+ result.insert("GT", ">"); // for >
+ result.insert("PROJECTNAME", getName());
+ result.insert("FPGAFULLTYPE", plt.getFullFPGAType());
+
+ return result;
+}
+
+QDomNode Project::findIpNode(QString anIpName) {
+ QDomNodeList nodeList = doc.documentElement().elementsByTagName("ip");
+ for( int i=0; i<nodeList.size(); i++ ){
+ QDomElement e = nodeList.at(i).toElement(); // try to convert the node to an element.
+ if(!e.isNull()) {
+ if( e.attribute("user_name") == anIpName ){
+ return nodeList.at(i);
+ }
+ }
+ }
+ return QDomNode();
+}
+
+QDomNode Project::findPlatformNode() {
+ QDomElement docElem = doc.documentElement();
+ QDomNodeList nodeList = docElem.elementsByTagName("platform");
+ if( !nodeList.isEmpty() )
+ return nodeList.at(0);
+ return QDomNode();
+}
+
+
+QDomNode Project::findToolchainNode() {
+ QDomElement docElem = doc.documentElement();
+ QDomNodeList nodeList = docElem.elementsByTagName("toolchain");
+ if( !nodeList.isEmpty() )
+ return nodeList.at(0);
+ return QDomNode();
+}
+
+bool Project::addIp(QString ipName, QString ipFileName) {
+ if( findIpNode(ipName).isNull() ){ // test whether the ipname already exists or not
+ QDomDocument tempDoc;
+ if( getDocFromXmlFile(ipFileName, &tempDoc) ){
+ QDomElement ipNode = tempDoc.documentElement();
+
+ QDomElement interrupt = tempDoc.createElement("interrupt");
+ interrupt.setAttribute("value","");
+ ipNode.appendChild(interrupt);
+ QDomElement base_address = tempDoc.createElement("base_address");
+ base_address.setAttribute("value","");
+ ipNode.appendChild(base_address);
+ ipNode.setAttribute("user_name",ipName);
+ doc.documentElement().appendChild( doc.importNode( tempDoc.documentElement(), true ));
+
+ return true;
+ }
+ printf("unable to read Ip xml file\n");
+ return false;
+ }
+ printf("Ip already exists\n");
+ return false;
+}
+
+bool Project::removeIp(QString anIpName){
+ QDomNode node = findIpNode(anIpName);
+ if( !node.isNull() ){
+ QDomNode parent = node.parentNode();
+ if( !parent.isNull()){
+ parent.removeChild(node);
+ return true;
+ }
+ }
+ printf("no Ip found\n");
+ return false;
+}
+
+bool Project::removePlatform(){
+ QDomNode pltNode = findPlatformNode();
+ if( !pltNode.isNull() ){
+ if( !doc.documentElement().removeChild(pltNode).isNull() )
+ return true;
+ }
+ printf("no platform\n");
+ return false;
+}
+
+
+bool Project::create(QString aFileName){
+ docFileName = aFileName;
+ QDomElement root = doc.createElement("project");
+ doc.appendChild(root);
+ return true;
+}
+
+bool Project::initialize(QString aFileName){
+ docFileName = aFileName;
+ QFile file(docFileName);
+ if (!file.open(QIODevice::ReadOnly)){
+ printf("unable to open project file\n");
+ return false;
+ }
+ if (!doc.setContent(&file)) {
+ printf("unable to read project file\n");
+ return false;
+ }
+ file.close();
+ return true;
+}
+
+bool Project::addPlatform(QString platformFileName){
+ if( findPlatformNode().isNull() ){
+ QDomDocument tempDoc;
+ if( getDocFromXmlFile(platformFileName, &tempDoc) ){
+ doc.documentElement().appendChild( doc.importNode( tempDoc.documentElement(), true ));
+ return true;
+ }
+ return false;
+ }
+ printf("platform already exists\n");
+ return false;
+}
+
+bool Project::addToolchain(QString toolchainTemplate){
+ QDomNode toolNode = findToolchainNode();
+ if( !toolNode.isNull() ){
+ if( doc.documentElement().removeChild(toolNode).isNull() )
+ return false;
+ }
+ QDomDocument tempDoc;
+ printf("%s\n",(QCoreApplication::applicationDirPath()+"/"+toolchainTemplate).toLatin1().constData());
+ if( getDocFromXmlFile(QCoreApplication::applicationDirPath()+"/"+toolchainTemplate, &tempDoc) ){
+ doc.documentElement().appendChild( doc.importNode( tempDoc.documentElement(), true ));
+ return true;
+ }
+ return false;
+}
+
+
+
+bool Project::getDocFromXmlFile(QString fileName, QDomDocument *tempDoc){
+ QFile tempFile(fileName);
+ if (!tempFile.open(QIODevice::ReadOnly)){
+ printf("unable to open xml file %s\n",fileName.toLatin1().constData());
+ return false;
+ }
+ if (!tempDoc->setContent(&tempFile)) {
+ printf("unable to set content of xml doc\n");
+ tempFile.close();
+ return false;
+ }
+ tempFile.close();
+ return true;
+}
+
+
+QString Project::getName(){
+ return QFileInfo(getFileName()).baseName();
+}
+
+QStringList Project::getIpNames(){
+ QStringList result;
+
+ QDomNodeList nodeList = doc.documentElement().elementsByTagName("ip");
+ for( int i=0; i<nodeList.size(); i++ ){
+ QDomElement e = nodeList.at(i).toElement(); // try to convert the node to an element.
+ if(!e.isNull())
+ result.append(e.attribute("user_name"));
+ }
+ return result;
+}
+
+bool Project::get(Toolchain *result){
+ QDomNode node = findToolchainNode();
+ if( !node.isNull() ){
+ result->initialize(node, this);
+ return true;
+ }
+ return false;
+}
+
+bool Project::get(Platform *result){
+ QDomNode node = findPlatformNode();
+ if( !node.isNull() ){
+ result->initialize(node);
+ return true;
+ }
+ return false;
+}
+
+bool Project::get(QString anIpName, Ip *result){
+ QDomNode node = findIpNode(anIpName);
+ if( !node.isNull() ){
+ result->initialize(node);
+ return true;
+ }
+ return false;
+}
+
+bool Project::checkFreeRegisterAddressRange(QString address){
+ Ip ip;
+ QStringList ipList = getIpNames();
+ for( int i=0; i<ipList.count(); i++ ){
+ get(ipList.at(i), &ip);
+ if( ip.isRegisterAddressConflict(address) )
+ return false;
+ }
+ return true;
+}
+
+bool Project::modifyIpBaseAddress(QString ipName, QString baseAddress){
+ Ip ip;
+ if( get(ipName, &ip) ){
+ if( checkFreeRegisterAddressRange(baseAddress) ){
+ ip.setBaseAddress(baseAddress);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Project::computeIpBaseAddresses(){
+ Ip ip;
+ QStringList ipList = getIpNames();
+ if( ipList.count() > 0 ){
+ get(ipList.at(0), &ip);
+
+ // fix first IP address if not set
+ if( ip.getBaseAddress() == "" )
+ ip.setBaseAddress(QString::number(0));
+
+ int previousEndAddress = ip.getRegisterAddressRange().end() + 1;
+ printf("set ip %s base address %s \n", ip.getName().toLatin1().constData(), ip.getBaseAddress().toLatin1().constData());
+ for( int i=1; i<ipList.count(); i++ ){
+ get(ipList.at(i), &ip);
+ ip.setBaseAddress(QString::number(previousEndAddress));
+ printf("set ip %s base address %s \n", ip.getName().toLatin1().constData(), ip.getBaseAddress().toLatin1().constData());
+ int endAddress = ip.getRegisterAddressRange().end();
+ previousEndAddress = endAddress + 1;
+ }
+ }
+ else
+ printf("Warning no IP\n");
+ return true;
+}
+
+bool Project::saveToFile(QString aFileName){
+ QString finalFileName = aFileName;
+ if( aFileName == "" )
+ finalFileName = docFileName;
+ if( !finalFileName.contains(".pro") )
+ finalFileName.append(".pro");
+
+ QFile destFile(finalFileName);
+ if (!destFile.open(QIODevice::ReadWrite | QIODevice::Truncate)){
+ return false;
+ };
+
+ QString xmlContent = doc.toString();
+ QTextStream out(&destFile);
+ out << xmlContent;
+ return true;
+}
+
+bool Project::setToolchain(const QString type){
+ if( type.compare("xilinx") == 0 ){
+ return addToolchain("xilinx_toolchain.xml");
+ }
+ else {
+ printf("Error Altera projects not supported\n");
+ }
+ return false;
+}
+
+void Project::resolveProjectVariables( QString *command ){
+ QMap<QString, QString> variables = getProjectVariables();
+ QMapIterator<QString, QString> it(variables);
+
+ while (it.hasNext()) {
+ it.next();
+ command->replace("$"+it.key(),it.value()); // pour chaque command remplacer les variables de la map
+ }
+}
+
+
+void Project::resolveProjectVariables( QStringList *commandList ){
+ QMap<QString, QString> variables = getProjectVariables();
+ QMapIterator<QString, QString> it(variables);
+
+ for( int i=0; i<commandList->size(); i++ ){
+ while (it.hasNext()) {
+ it.next();
+ // printf("key: %s, valeu: %s \n",it.key().toLatin1().constData(), it.value().toLatin1().constData());
+ commandList->replaceInStrings("$"+it.key(),it.value()); // pour chaque command remplacer les variables de la map
+ }
+ }
+}
+
+
+
+
+/*
+QString Project::serializeIp(QString anIpName){
+ Ip *ip = findIp( anIpName );
+ if( ip )
+ return ip->serialize();
+ return "";
+}*/
+
+
Added: trunk/software/orchesta/common/project.h
===================================================================
--- trunk/software/orchesta/common/project.h (rev 0)
+++ trunk/software/orchesta/common/project.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,76 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** project.h: FPGA project manager
+**
+** author: th...@us...
+*/
+#ifndef PROJECT_H
+#define PROJECT_H
+
+#include "xmldoc.h"
+#include "ip.h"
+#include "platform.h"
+#include "toolchain.h"
+
+
+class Project
+{
+ protected:
+ QString docFileName;
+ QDomDocument doc;
+
+ virtual QDomNode findIpNode(QString anIpName);
+ virtual QDomNode findPlatformNode();
+ virtual QDomNode findToolchainNode();
+ virtual bool getDocFromXmlFile(QString fileName, QDomDocument *tempDoc);
+ virtual QMap<QString, QString> Project::getProjectVariables();
+
+ public:
+ Project();
+ virtual ~Project();
+
+ virtual bool removePlatform();
+ virtual bool removeIp(QString anIpName);
+ virtual bool addIp(QString ipName, QString ipFileName);
+ virtual bool addToolchain(QString toolchainTemplate);
+ virtual bool addPlatform(QString platformFileName);
+
+ virtual bool get(Platform *result);
+ virtual bool get(Toolchain *result);
+ virtual bool get(QString anIpName, Ip *result);
+ virtual QString getName();
+ virtual QString getFileName() {return docFileName;};
+
+ virtual bool modifyIpBaseAddress(QString ipName, QString baseAddress);
+ virtual bool computeIpBaseAddresses();
+ virtual bool checkFreeRegisterAddressRange(QString address);
+
+ virtual bool setToolchain(const QString type="Xilinx");
+
+ virtual QStringList getIpNames();
+ virtual bool initialize(QString aFileName);
+ virtual bool create(QString aFileName);
+ virtual bool saveToFile(QString aFileName="");
+ virtual void resolveProjectVariables( QStringList *commandList );
+ virtual void resolveProjectVariables( QString *command );
+
+};
+
+#endif // PROJECT_H
Added: trunk/software/orchesta/common/toolchain.cpp
===================================================================
--- trunk/software/orchesta/common/toolchain.cpp (rev 0)
+++ trunk/software/orchesta/common/toolchain.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,179 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** toolchain.cpp: FPGA toolchain wrapper
+**
+** author: th...@us...
+*/
+#include "toolchain.h"
+#include "project.h"
+#include "ip.h"
+#include "armadeus_ready.h"
+#include <qtextstream>
+#include <qprocess>
+#include <qfileinfo>
+#include <qdir>
+#include <qcoreapplication>
+
+void Toolchain::initialize(QDomNode aNode, Project* aProject){
+ XMLNodeWrapper::initialize(aNode);
+ project = aProject;
+}
+
+QStringList Toolchain::getCommandLines(){
+ QStringList result;
+ QDomElement flow = xmlNode.firstChildElement("flow");
+ QDomNodeList commandList = flow.childNodes();
+ for( int i =0; i<commandList.size(); i++ ){
+ if( commandList.at(i).isElement() ) { // avoid non Element
+ QString temp = commandList.at(i).toElement().attribute("name") + " " +
+ commandList.at(i).toElement().attribute("options");
+ result += temp;
+// printf("command list: %s\n", temp.toLatin1().constData());
+ }
+ }
+ return result;
+}
+
+bool Toolchain::copyIps(){
+
+ ArmadeusReadyIpFinder finder;
+ finder.setPath(QCoreApplication::applicationDirPath()+ARMADEUS_READY_FOLDER);
+ QStringList ipFileNameList = finder.getAllIpNames();
+ for( int i=0; i<ipFileNameList.count(); i++ ){
+ QString ipDirectory = QFileInfo(finder.getIpAbsoluteFilePath(ipFileNameList.at(i))).absolutePath();
+ QProcess process;
+// printf("cp -r %s/*.* .\n", ipDirectory.toLatin1().constData());
+// process.start("cp -r "+ipDirectory+"/*.* .");
+// printf("xcopy %s . /E\n", ipDirectory.replace(QString("/"), QString("\\")).toLatin1().constData());
+ process.start("xcopy "+ipDirectory.replace(QString("/"), QString("\\"))+" . /E /Y");
+ process.waitForFinished();
+ }
+ return true;
+}
+
+
+
+
+bool XilinxToolchain::buildXilinxPrj(){
+ Ip currentIp;
+ QStringList result;
+ QString projectName = project->getFileName();
+ QStringList ipNameList = project->getIpNames();
+
+ // create hdl top file list
+ for( int i=0; i<ipNameList.count(); i++ ){
+ if( project->get(ipNameList.at(i), ¤tIp ) ){
+// printf("IP: %s\n", currentIp.getName().toLatin1().constData());
+ QString topIpFileName = currentIp.getHDLTopName();
+ QStringList HDLlist = currentIp.getHDLNameList();
+ int pos = HDLlist.indexOf(topIpFileName);
+ if( pos != -1)
+ HDLlist.removeAt(pos);
+ HDLlist.prepend(topIpFileName); // reorganize in a proper order
+ if( topIpFileName != "" ){
+ for( int j=0; j<HDLlist.size(); j++ ){
+ if( !result.filter(HDLlist.at(j)).size() ) // if not already present in the list
+ {
+ if( QFileInfo(HDLlist.at(j)).suffix() == "vhd" ) // check whether it is a vhdl or a verilog file
+ result+= "vhdl work \""+HDLlist.at(j)+'"';
+ else if( QFileInfo(HDLlist.at(j)).suffix() == "v" )
+ result+= "verilog work \""+ HDLlist.at(j) + '"';
+ }
+ }
+ }
+ else
+ printf("Warning no top file for IP: %s", currentIp.getName().toLatin1().constData());
+ }
+ }
+
+ // create prj file
+ QFile file(project->getName()+".prj");
+ if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)){
+ printf("can not create file %s\n", projectName.toLatin1().constData());
+ return false;
+ }
+
+ QTextStream out(&file);
+ for( int i=0; i<result.size(); i++ )
+ out << result.at(i) + "\n" ;
+ file.close();
+ return true;
+}
+
+void XilinxToolchain::checkErrors()
+{
+ QFile file(project->getName()+".log");
+ if (!file.open(QIODevice::ReadOnly)){
+ printf("Error: unable to open project log file\n");
+ } else {
+ QTextStream in(&file);
+ while (!in.atEnd()) {
+ QString line = in.readLine();
+ if(line.contains("ERROR:"))
+ printf("%s\n", line.toLatin1().constData());
+ }
+ }
+}
+
+bool XilinxToolchain::execute(){
+ if( project ){
+ if( !copyIps() )
+ return false;
+ QProcess builder;
+ builder.setProcessChannelMode(QProcess::MergedChannels);
+
+ // create .xstprojnav.tmp
+ QDir tempDir(".");
+ tempDir.mkdir(QString("xst"));
+ tempDir.mkdir(QString("xst/projnav.tmp"));
+
+ QDomElement flow = xmlNode.firstChildElement("xst_script");
+ QDomNodeList xst_script = flow.childNodes();
+ QString temp;
+ for( int i =0; i<xst_script.size(); i++ ){
+ temp += xst_script.at(i).toElement().attribute("name") + " " +
+ xst_script.at(i).toElement().attribute("options") + "\n";
+ }
+ project->resolveProjectVariables(&temp);
+
+ // create prj file
+ QFile file(project->getName()+".xst");
+ if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate))
+ return false;
+ QTextStream out(&file);
+ out << temp;
+ file.close();
+
+ QStringList commandList = getCommandLines();
+ project->resolveProjectVariables(&commandList);
+
+ for( int i=0; i<commandList.size(); i++ ){
+// printf("%s\n", commandList.at(i).toLatin1().constData());
+ builder.start(commandList.at(i));
+ builder.waitForFinished();
+ }
+
+ // check errors in log file
+ checkErrors();
+
+ return true;
+ }
+ return false;
+}
Added: trunk/software/orchesta/common/toolchain.h
===================================================================
--- trunk/software/orchesta/common/toolchain.h (rev 0)
+++ trunk/software/orchesta/common/toolchain.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,69 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** toolchain.h: FPGA toolchain wrapper
+**
+** author: th...@us...
+*/
+#ifndef TOOLCHAIN_H
+#define TOOLCHAIN_H
+
+#include "xmldoc.h"
+#include "platform.h"
+
+class Project;
+
+class Toolchain : public XMLNodeWrapper
+{
+ protected:
+ Project *project;
+
+ virtual void checkErrors() = 0;
+ virtual bool copyIps();
+
+ public:
+ Toolchain():XMLNodeWrapper(){project=NULL;};
+ virtual ~Toolchain(){};
+
+ virtual QString getType() { return getAttribute("infos", "type"); };
+ virtual QStringList getCommandLines();
+ virtual bool execute() = 0;
+ virtual void initialize(QDomNode aNode, Project* aProject);
+
+};
+
+class XilinxToolchain : public Toolchain
+{
+ protected:
+ bool createXilinxScript();
+
+ virtual void checkErrors();
+
+ public:
+ XilinxToolchain():Toolchain(){};
+ virtual ~XilinxToolchain(){};
+
+ virtual bool execute();
+ virtual bool buildXilinxPrj();
+};
+
+
+
+
+#endif //TOOLCHAIN_H
Added: trunk/software/orchesta/common/xmldoc.cpp
===================================================================
--- trunk/software/orchesta/common/xmldoc.cpp (rev 0)
+++ trunk/software/orchesta/common/xmldoc.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,109 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** xmldoc.cpp: XML document base class
+**
+** author: th...@us...
+*/
+#include "xmldoc.h"
+#include <QTextStream>
+
+XMLNodeWrapper::XMLNodeWrapper(){
+}
+
+QString XMLNodeWrapper::getAttribute( QString subNodeName, QString elementName, QString attributeName ){
+ QDomElement subNode = xmlNode.firstChildElement(subNodeName);
+ if( !subNode.isNull() ){
+ QDomElement element = subNode.firstChildElement(elementName);
+ if( !element.isNull() )
+ return element.attribute(attributeName);
+ else{ // not a tag name. try with attribute name
+ QDomNodeList elementList = subNode.childNodes();
+ for( int i =0; i<elementList.size(); i++ ){
+ if( elementList.at(i).toElement().attribute("name") == elementName ){
+ return elementList.at(i).toElement().attribute(attributeName);
+ }
+ }
+ }
+ }
+ return QString();
+}
+
+QString XMLNodeWrapper::getAttribute( QString elementName, QString attributeName ){
+ QDomElement e;
+ e = xmlNode.firstChildElement(elementName);
+ if( !e.isNull() ){
+ return e.attribute(attributeName);
+ }
+ else { // not a tag name... look at a node with attribute elementName
+ QDomNodeList elementList = xmlNode.childNodes();
+ for( int i =0; i<elementList.size(); i++ ){
+ // printf("getAttribute %s", elementList.at(i).toElement().attribute("name").toLatin1().constData());
+ if( elementList.at(i).toElement().attribute("name") == elementName ){
+ return elementList.at(i).toElement().attribute(attributeName);
+ }
+ }
+ }
+ return "";
+}
+
+bool XMLNodeWrapper::setAttributeValue(QString elementName, QString attributeName, QString attributeValue)
+{
+ QDomElement element = xmlNode.firstChildElement(elementName);
+ if( !element.isNull() ){
+ element.setAttribute(attributeName, attributeValue);
+ return true;
+ }
+ return false;
+}
+
+bool XMLNodeWrapper::setAttributeValue(QString subNodeName, QString elementName, QString attributeName, QString attributeValue)
+{
+ QDomNode subNode = xmlNode.firstChildElement(subNodeName);
+ if( !subNode.isNull() ){
+ QDomElement element = subNode.firstChildElement(elementName);
+ if( !element.isNull() ){
+ element.setAttribute(attributeName, attributeValue);
+ return true;
+ }
+ }
+ return false;
+}
+
+QString XMLNodeWrapper::getCDATA( QString elementName ){
+ QDomElement e;
+ e = xmlNode.firstChildElement(elementName);
+ if( !e.isNull() ){
+ if( ! e.firstChild().toCDATASection().isNull() )
+ return e.firstChild().toCDATASection().data();
+ }
+ return "";
+}
+
+void XMLNodeWrapper::initialize(QDomNode aNode){
+ xmlNode = aNode;
+}
+
+QString XMLNodeWrapper::toString(){
+ QString result;
+ QTextStream stream(&result);
+ xmlNode.save(stream,4);
+ return result;
+}
+
Added: trunk/software/orchesta/common/xmldoc.h
===================================================================
--- trunk/software/orchesta/common/xmldoc.h (rev 0)
+++ trunk/software/orchesta/common/xmldoc.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,53 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** xmldoc.h: XML document base class
+**
+** author: th...@us...
+*/
+#ifndef XMLDOC_H
+#define XMLDOC_H
+
+#include <qstringlist>
+#include <qfile>
+#include <qdomdocument>
+
+
+
+class XMLNodeWrapper
+{
+ protected:
+ QDomNode xmlNode;
+ virtual QString getCDATA( QString elementName );
+
+ public:
+ XMLNodeWrapper();
+ virtual ~XMLNodeWrapper(){};
+
+ virtual void initialize(QDomNode aNode);
+ virtual QString getAttribute( QString elementName, QString attributeName );
+ virtual QString getAttribute( QString subNodeName, QString elementName, QString attributeName );
+ virtual bool setAttributeValue( QString subNodeName, QString elementName,
+ QString attributeName, QString attributeValue);
+ virtual bool setAttributeValue( QString elementName, QString attributeName, QString attributeValue);
+ virtual QString toString();
+
+};
+
+#endif // XMLDOC_H
Added: trunk/software/orchesta/plateform.xml
===================================================================
--- trunk/software/orchesta/plateform.xml (rev 0)
+++ trunk/software/orchesta/plateform.xml 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<platform>
+ <description>
+ <![CDATA[ gfdjgkfghdkfjghdf ]]>
+ </description>
+ <board type="APF9328" version="1"/>
+ <fpga type="XC3S200" speed="-4" package="TQ144" family="spartan" />
+</platform>
\ No newline at end of file
Added: trunk/software/orchesta/projectBuilder/main.cpp
===================================================================
--- trunk/software/orchesta/projectBuilder/main.cpp (rev 0)
+++ trunk/software/orchesta/projectBuilder/main.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,333 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** main.cpp: Project builder main file
+**
+** author: th...@us...
+*/
+#include <qcoreapplication>
+#include <qstring>
+#include <qstringlist>
+#include <qfile>
+//#include <qtextstream>
+#include <iostream>
+#include <qdir>
+#include <qdatetime>
+#include <qprocess>
+
+#include "platform.h"
+#include "project.h"
+#include "ip.h"
+#include "line_option.h"
+#include "toolchain.h"
+#include "armadeus_ready.h"
+
+
+bool buildXilinx( Project &pro ){
+ XilinxToolchain toolchain;
+ if( pro.get(&toolchain)){
+ if( !toolchain.buildXilinxPrj() )
+ return false;
+ if( toolchain.execute()) {
+ return true;
+ }
+ }
+ printf("Error: no valid toolchain\n");
+ return false;
+}
+
+
+bool initProject(Project *pro){
+ QDir dir;
+ QStringList list = dir.entryList(QStringList("*.pro"));
+ if( list.isEmpty() ){
+ printf("Please create a local project first\n");
+ return false;
+ }
+ pro->initialize(list.at(0));
+ return true;
+}
+
+void buildProject_callback(QStringList args){
+ Project pro;
+
+ if( initProject(&pro) ){
+ Platform plt;
+ pro.computeIpBaseAddresses();
+ if( pro.get(&plt) ) {
+ if( plt.getFPGAFamily() == "spartan" ){
+ buildXilinx(pro);
+ pro.saveToFile();
+ }
+ else
+ printf("unsupported FPGA Type\n");
+ }
+ else
+ printf("Error no platform found \n");
+ }
+ else
+ printf("Error no valid project\n");
+}
+
+
+void addIp_callback( QStringList args ){
+ Project pro;
+ if( initProject(&pro) ){
+ ArmadeusReadyIpFinder finder;
+ finder.setPath(QCoreApplication::applicationDirPath()+ARMADEUS_READY_FOLDER);
+ if( pro.addIp(args.at(0), finder.getIpAbsoluteFilePath(args.at(1))) )
+ pro.saveToFile();
+ }
+};
+
+void createNewProject_callback( QStringList args ){
+ Project pro;
+
+ if( pro.create(args.at(0)) ) {
+ if( pro.addPlatform(args.at(1)) )
+ pro.saveToFile();
+ }
+};
+
+void removeIp_callback( QStringList args ){
+ Project pro;
+ if( initProject(&pro) ){
+ if( pro.removeIp(args.at(0)) )
+ pro.saveToFile();
+ }
+};
+
+void listIps_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ printf("IP list:\n");
+ QStringList ipNameList = pro.getIpNames();
+ for( int i=0; i<ipNameList.count(); i++ )
+ printf("%s\n",ipNameList.at(i).toLatin1().constData());
+ }
+};
+
+void viewIpInfos_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ printf("%s",ip.toString().toLatin1().constData());
+ }
+}
+
+void viewPlatformInfos_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Platform plt;
+ if( pro.get(&plt) )
+ printf("%s",plt.toString().toLatin1().constData());
+ }
+}
+
+
+
+void clearIpBaseAddress_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ ip.setBaseAddress("");
+ }
+}
+
+void setIpBaseAddress_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ ip.setBaseAddress(args.at(1));
+ }
+}
+
+void setIpInterrupt_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ ip.setInterrupt(args.at(1));
+ }
+}
+
+void listArmadeusReadyIps_callback(QStringList args){
+ ArmadeusReadyIpFinder finder;
+ finder.setPath(QCoreApplication::applicationDirPath()+ARMADEUS_READY_FOLDER);
+ printf("%s",finder.getAllIpNames().join("\n").toLatin1().constData());
+}
+
+void setToolchain_callback(QStringList args){
+ Project pro;
+
+ if( initProject(...
[truncated message content] |