/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
*
|
*
|
* SystemC to Verilog Translator v0.4
|
* SystemC to Verilog Translator v0.4
|
* Provided by Universidad Rey Juan Carlos
|
* Provided by Universidad Rey Juan Carlos
|
*
|
*
|
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
* (at your option) any later version.
|
* (at your option) any later version.
|
*
|
*
|
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* GNU Library General Public License for more details.
|
* GNU Library General Public License for more details.
|
*
|
*
|
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
*/
|
*/
|
|
|
#include "sglib.h"
|
#include "sglib.h"
|
|
|
#define MAX_NAME_LENGTH 256
|
#define MAX_NAME_LENGTH 256
|
|
|
typedef struct _DefineNode
|
typedef struct _DefineNode
|
{
|
{
|
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
struct _DefineNode *next;
|
struct _DefineNode *next;
|
} DefineNode;
|
} DefineNode;
|
|
|
typedef struct _RegNode
|
typedef struct _RegNode
|
{
|
{
|
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
char name2[MAX_NAME_LENGTH];
|
char name2[MAX_NAME_LENGTH];
|
struct _RegNode *next;
|
struct _RegNode *next;
|
} RegNode;
|
} RegNode;
|
|
|
/*Each struct has a name and a list of the registers declared inside it*/
|
/*Each struct has a name and a list of the registers declared inside it*/
|
typedef struct _StructRegNode
|
typedef struct _StructRegNode
|
{
|
{
|
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
int length;
|
int length;
|
struct _StructRegNode *next;
|
struct _StructRegNode *next;
|
} StructRegNode;
|
} StructRegNode;
|
|
|
typedef struct _StructNode
|
typedef struct _StructNode
|
{
|
{
|
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
StructRegNode *list;
|
StructRegNode *list;
|
struct _StructNode *next;
|
struct _StructNode *next;
|
} StructNode;
|
} StructNode;
|
|
|
/* Global var to store Regs */
|
/* Global var to store Regs */
|
RegNode *regslist;
|
RegNode *regslist;
|
/* Global var to store Defines */
|
/* Global var to store Defines */
|
DefineNode *defineslist;
|
DefineNode *defineslist;
|
/*Global var to store Structs */
|
/*Global var to store Structs */
|
StructNode *structslist;
|
StructNode *structslist;
|
StructRegNode *structsreglist;
|
StructRegNode *structsreglist;
|
|
|
/* Functions for defines list*/
|
/* Functions for defines list*/
|
DefineNode *InsertDefine(DefineNode *list,char *name);
|
DefineNode *InsertDefine(DefineNode *list,char *name);
|
int IsDefine(DefineNode *list,char *name);
|
int IsDefine(DefineNode *list,char *name);
|
|
|
/* Functions for registers list*/
|
/* Functions for registers list*/
|
RegNode *InsertReg(RegNode *list, char *name, char *name2);
|
RegNode *InsertReg(RegNode *list, char *name, char *name2);
|
char *IsReg (RegNode *list,char *name);
|
char *IsReg (RegNode *list,char *name);
|
|
|
/* Functions for structs list*/
|
/* Functions for structs list*/
|
StructNode *InsertStruct(StructNode *list, char *name, StructRegNode *reglist);
|
StructNode *InsertStruct(StructNode *list, char *name, StructRegNode *reglist);
|
StructRegNode *InsertStructReg(StructRegNode *list, char *name, int length);
|
StructRegNode *InsertStructReg(StructRegNode *list, char *name, int length);
|
void ShowStructs (StructNode * list);
|
void ShowStructs (StructNode * list);
|
|
|
|
|
|
|
|
|