URL
https://opencores.org/ocsvn/sc2v/sc2v/trunk
Subversion Repositories sc2v
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 1 to Rev 2
- ↔ Reverse comparison
Rev 1 → Rev 2
/trunk/LICENSE
0,0 → 1,341
GNU GENERAL PUBLIC LICENSE |
Version 2, June 1991 |
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
675 Mass Ave, Cambridge, MA 02139, USA |
Everyone is permitted to copy and distribute verbatim copies |
of this license document, but changing it is not allowed. |
|
Preamble |
|
The licenses for most software are designed to take away your |
freedom to share and change it. By contrast, the GNU General Public |
License is intended to guarantee your freedom to share and change free |
software--to make sure the software is free for all its users. This |
General Public License applies to most of the Free Software |
Foundation's software and to any other program whose authors commit to |
using it. (Some other Free Software Foundation software is covered by |
the GNU Library General Public License instead.) You can apply it to |
your programs, too. |
|
When we speak of free software, we are referring to freedom, not |
price. Our General Public Licenses are designed to make sure that you |
have the freedom to distribute copies of free software (and charge for |
this service if you wish), that you receive source code or can get it |
if you want it, that you can change the software or use pieces of it |
in new free programs; and that you know you can do these things. |
|
To protect your rights, we need to make restrictions that forbid |
anyone to deny you these rights or to ask you to surrender the rights. |
These restrictions translate to certain responsibilities for you if you |
distribute copies of the software, or if you modify it. |
|
For example, if you distribute copies of such a program, whether |
gratis or for a fee, you must give the recipients all the rights that |
you have. You must make sure that they, too, receive or can get the |
source code. And you must show them these terms so they know their |
rights. |
|
We protect your rights with two steps: (1) copyright the software, and |
(2) offer you this license which gives you legal permission to copy, |
distribute and/or modify the software. |
|
Also, for each author's protection and ours, we want to make certain |
that everyone understands that there is no warranty for this free |
software. If the software is modified by someone else and passed on, we |
want its recipients to know that what they have is not the original, so |
that any problems introduced by others will not reflect on the original |
authors' reputations. |
|
Finally, any free program is threatened constantly by software |
patents. We wish to avoid the danger that redistributors of a free |
program will individually obtain patent licenses, in effect making the |
program proprietary. To prevent this, we have made it clear that any |
patent must be licensed for everyone's free use or not licensed at all. |
|
The precise terms and conditions for copying, distribution and |
modification follow. |
|
GNU GENERAL PUBLIC LICENSE |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
|
0. This License applies to any program or other work which contains |
a notice placed by the copyright holder saying it may be distributed |
under the terms of this General Public License. The "Program", below, |
refers to any such program or work, and a "work based on the Program" |
means either the Program or any derivative work under copyright law: |
that is to say, a work containing the Program or a portion of it, |
either verbatim or with modifications and/or translated into another |
language. (Hereinafter, translation is included without limitation in |
the term "modification".) Each licensee is addressed as "you". |
|
Activities other than copying, distribution and modification are not |
covered by this License; they are outside its scope. The act of |
running the Program is not restricted, and the output from the Program |
is covered only if its contents constitute a work based on the |
Program (independent of having been made by running the Program). |
Whether that is true depends on what the Program does. |
|
1. You may copy and distribute verbatim copies of the Program's |
source code as you receive it, in any medium, provided that you |
conspicuously and appropriately publish on each copy an appropriate |
copyright notice and disclaimer of warranty; keep intact all the |
notices that refer to this License and to the absence of any warranty; |
and give any other recipients of the Program a copy of this License |
along with the Program. |
|
You may charge a fee for the physical act of transferring a copy, and |
you may at your option offer warranty protection in exchange for a fee. |
|
2. You may modify your copy or copies of the Program or any portion |
of it, thus forming a work based on the Program, and copy and |
distribute such modifications or work under the terms of Section 1 |
above, provided that you also meet all of these conditions: |
|
a) You must cause the modified files to carry prominent notices |
stating that you changed the files and the date of any change. |
|
b) You must cause any work that you distribute or publish, that in |
whole or in part contains or is derived from the Program or any |
part thereof, to be licensed as a whole at no charge to all third |
parties under the terms of this License. |
|
c) If the modified program normally reads commands interactively |
when run, you must cause it, when started running for such |
interactive use in the most ordinary way, to print or display an |
announcement including an appropriate copyright notice and a |
notice that there is no warranty (or else, saying that you provide |
a warranty) and that users may redistribute the program under |
these conditions, and telling the user how to view a copy of this |
License. (Exception: if the Program itself is interactive but |
does not normally print such an announcement, your work based on |
the Program is not required to print an announcement.) |
|
These requirements apply to the modified work as a whole. If |
identifiable sections of that work are not derived from the Program, |
and can be reasonably considered independent and separate works in |
themselves, then this License, and its terms, do not apply to those |
sections when you distribute them as separate works. But when you |
distribute the same sections as part of a whole which is a work based |
on the Program, the distribution of the whole must be on the terms of |
this License, whose permissions for other licensees extend to the |
entire whole, and thus to each and every part regardless of who wrote it. |
|
Thus, it is not the intent of this section to claim rights or contest |
your rights to work written entirely by you; rather, the intent is to |
exercise the right to control the distribution of derivative or |
collective works based on the Program. |
|
In addition, mere aggregation of another work not based on the Program |
with the Program (or with a work based on the Program) on a volume of |
a storage or distribution medium does not bring the other work under |
the scope of this License. |
|
3. You may copy and distribute the Program (or a work based on it, |
under Section 2) in object code or executable form under the terms of |
Sections 1 and 2 above provided that you also do one of the following: |
|
a) Accompany it with the complete corresponding machine-readable |
source code, which must be distributed under the terms of Sections |
1 and 2 above on a medium customarily used for software interchange; or, |
|
b) Accompany it with a written offer, valid for at least three |
years, to give any third party, for a charge no more than your |
cost of physically performing source distribution, a complete |
machine-readable copy of the corresponding source code, to be |
distributed under the terms of Sections 1 and 2 above on a medium |
customarily used for software interchange; or, |
|
c) Accompany it with the information you received as to the offer |
to distribute corresponding source code. (This alternative is |
allowed only for noncommercial distribution and only if you |
received the program in object code or executable form with such |
an offer, in accord with Subsection b above.) |
|
The source code for a work means the preferred form of the work for |
making modifications to it. For an executable work, complete source |
code means all the source code for all modules it contains, plus any |
associated interface definition files, plus the scripts used to |
control compilation and installation of the executable. However, as a |
special exception, the source code distributed need not include |
anything that is normally distributed (in either source or binary |
form) with the major components (compiler, kernel, and so on) of the |
operating system on which the executable runs, unless that component |
itself accompanies the executable. |
|
If distribution of executable or object code is made by offering |
access to copy from a designated place, then offering equivalent |
access to copy the source code from the same place counts as |
distribution of the source code, even though third parties are not |
compelled to copy the source along with the object code. |
|
4. You may not copy, modify, sublicense, or distribute the Program |
except as expressly provided under this License. Any attempt |
otherwise to copy, modify, sublicense or distribute the Program is |
void, and will automatically terminate your rights under this License. |
However, parties who have received copies, or rights, from you under |
this License will not have their licenses terminated so long as such |
parties remain in full compliance. |
|
5. You are not required to accept this License, since you have not |
signed it. However, nothing else grants you permission to modify or |
distribute the Program or its derivative works. These actions are |
prohibited by law if you do not accept this License. Therefore, by |
modifying or distributing the Program (or any work based on the |
Program), you indicate your acceptance of this License to do so, and |
all its terms and conditions for copying, distributing or modifying |
the Program or works based on it. |
|
6. Each time you redistribute the Program (or any work based on the |
Program), the recipient automatically receives a license from the |
original licensor to copy, distribute or modify the Program subject to |
these terms and conditions. You may not impose any further |
restrictions on the recipients' exercise of the rights granted herein. |
You are not responsible for enforcing compliance by third parties to |
this License. |
|
7. If, as a consequence of a court judgment or allegation of patent |
infringement or for any other reason (not limited to patent issues), |
conditions are imposed on you (whether by court order, agreement or |
otherwise) that contradict the conditions of this License, they do not |
excuse you from the conditions of this License. If you cannot |
distribute so as to satisfy simultaneously your obligations under this |
License and any other pertinent obligations, then as a consequence you |
may not distribute the Program at all. For example, if a patent |
license would not permit royalty-free redistribution of the Program by |
all those who receive copies directly or indirectly through you, then |
the only way you could satisfy both it and this License would be to |
refrain entirely from distribution of the Program. |
|
If any portion of this section is held invalid or unenforceable under |
any particular circumstance, the balance of the section is intended to |
apply and the section as a whole is intended to apply in other |
circumstances. |
|
It is not the purpose of this section to induce you to infringe any |
patents or other property right claims or to contest validity of any |
such claims; this section has the sole purpose of protecting the |
integrity of the free software distribution system, which is |
implemented by public license practices. Many people have made |
generous contributions to the wide range of software distributed |
through that system in reliance on consistent application of that |
system; it is up to the author/donor to decide if he or she is willing |
to distribute software through any other system and a licensee cannot |
impose that choice. |
|
This section is intended to make thoroughly clear what is believed to |
be a consequence of the rest of this License. |
|
8. If the distribution and/or use of the Program is restricted in |
certain countries either by patents or by copyrighted interfaces, the |
original copyright holder who places the Program under this License |
may add an explicit geographical distribution limitation excluding |
those countries, so that distribution is permitted only in or among |
countries not thus excluded. In such case, this License incorporates |
the limitation as if written in the body of this License. |
|
9. The Free Software Foundation may publish revised and/or new versions |
of the General Public License from time to time. Such new versions will |
be similar in spirit to the present version, but may differ in detail to |
address new problems or concerns. |
|
Each version is given a distinguishing version number. If the Program |
specifies a version number of this License which applies to it and "any |
later version", you have the option of following the terms and conditions |
either of that version or of any later version published by the Free |
Software Foundation. If the Program does not specify a version number of |
this License, you may choose any version ever published by the Free Software |
Foundation. |
|
10. If you wish to incorporate parts of the Program into other free |
programs whose distribution conditions are different, write to the author |
to ask for permission. For software which is copyrighted by the Free |
Software Foundation, write to the Free Software Foundation; we sometimes |
make exceptions for this. Our decision will be guided by the two goals |
of preserving the free status of all derivatives of our free software and |
of promoting the sharing and reuse of software generally. |
|
NO WARRANTY |
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
REPAIR OR CORRECTION. |
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGES. |
|
END OF TERMS AND CONDITIONS |
|
Appendix: How to Apply These Terms to Your New Programs |
|
If you develop a new program, and you want it to be of the greatest |
possible use to the public, the best way to achieve this is to make it |
free software which everyone can redistribute and change under these terms. |
|
To do so, attach the following notices to the program. It is safest |
to attach them to the start of each source file to most effectively |
convey the exclusion of warranty; and each file should have at least |
the "copyright" line and a pointer to where the full notice is found. |
|
<one line to give the program's name and a brief idea of what it does.> |
Copyright (C) 19yy <name of author> |
|
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., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
Also add information on how to contact you by electronic and paper mail. |
|
If the program is interactive, make it output a short notice like this |
when it starts in an interactive mode: |
|
Gnomovision version 69, Copyright (C) 19yy name of author |
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
This is free software, and you are welcome to redistribute it |
under certain conditions; type `show c' for details. |
|
The hypothetical commands `show w' and `show c' should show the appropriate |
parts of the General Public License. Of course, the commands you use may |
be called something other than `show w' and `show c'; they could even be |
mouse-clicks or menu items--whatever suits your program. |
|
You should also get your employer (if you work as a programmer) or your |
school, if any, to sign a "copyright disclaimer" for the program, if |
necessary. Here is a sample; alter the names: |
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
|
<signature of Ty Coon>, 1 April 1989 |
Ty Coon, President of Vice |
|
This General Public License does not permit incorporating your program into |
proprietary programs. If your program is a subroutine library, you may |
consider it more useful to permit linking proprietary applications with the |
library. If this is what you want to do, use the GNU Library General |
Public License instead of this License. |
|
------------------------------------------------------------------------- |
/trunk/sc2v.pdf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
trunk/sc2v.pdf
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/src/sc2v_step1.y
===================================================================
--- trunk/src/sc2v_step1.y (nonexistent)
+++ trunk/src/sc2v_step1.y (revision 2)
@@ -0,0 +1,719 @@
+/* -----------------------------------------------------------------------------
+ *
+ * SystemC to Verilog Translator v0.1
+ * Provided by OpenSoc Design
+ *
+ * www.opensocdesign.com
+ *
+ * -----------------------------------------------------------------------------
+ * 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 Library 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.
+ */
+
+
+%{
+#include
+#include
+
+#include "list.h"
+
+/* Global var to store Regs */
+RegsList *regslist;
+/* Global var to store Defines */
+DefinesList *defineslist;
+
+
+int processfound = 0;
+int switchfound = 0;
+int switchparenthesis = 0;
+char *processname, *processname2;
+char *fileregs;
+char *filename ;
+int openedkeys = 0;
+int newline = 0;
+int reg_found = 0;
+int regs_end;
+int i = 0; //for loops counter
+FILE *file;
+FILE *regs_file;
+char *regname, *regname2;
+char *lastword; // Stores last WORD for use it in WRITE
+char *file_defines;
+FILE *FILE_DEFINES;
+char *file_writes;
+FILE *FILE_WRITES; //FILE to store .write to know if it is a wire or reg
+int definefound = 0;
+int defineinvocationfound = 0;
+int opencorchfound = 0;
+
+int openedcase = 0;
+
+int default_break_found = 0;
+int default_found;
+
+
+void yyerror(const char *str)
+{
+ fprintf(stderr,"error: %s\n",str);
+}
+
+int yywrap()
+{
+ return 1;
+}
+
+main()
+{
+ regslist = (RegsList *)malloc(sizeof(RegsList));
+ InitializeRegsList(regslist);
+ defineslist = (DefinesList *)malloc(sizeof(DefinesList));
+ InitializeDefinesList(defineslist);
+
+ lastword = (char *)malloc(256*sizeof(int));
+ processname = (char *)malloc(256*sizeof(int));
+ processname2 = (char *)malloc(256*sizeof(int));
+ fileregs = (char *)malloc(256*sizeof(int));
+
+ file_defines = (char *)malloc(256*sizeof(int));
+ strcpy(file_defines, (char *)"file_defines.sc2v");
+ FILE_DEFINES = fopen(file_defines,(char *)"w");
+
+ file_writes = (char *)malloc(256*sizeof(int));
+ strcpy(file_writes, (char *)"file_writes.sc2v");
+ FILE_WRITES = fopen(file_writes,(char *)"w");
+ if(FILE_WRITES!=NULL)
+ printf("\nopening file => filename = %s\n",file_writes);
+
+ yyparse();
+ fclose(FILE_WRITES);
+ fclose(FILE_DEFINES);
+}
+
+%}
+
+%token NUMBER WORD SC_INT SC_UINT BOOL MAYOR MENOR OPENKEY CLOSEKEY WRITE WORD SYMBOL NEWLINE
+%token COLON SEMICOLON RANGE OPENPAR CLOSEPAR DOSPUNTOSDOBLE OPENCORCH CLOSECORCH SWITCH CASE DEFAULT BREAK
+%token SC_BIGINT SC_BIGUINT HEXA DEFINE READ
+
+%%
+
+commands: /* empty */
+ | commands command
+ ;
+
+
+command:
+ read
+ |
+ sc_int
+ |
+ sc_uint
+ |
+ sc_bigint
+ |
+ sc_biguint
+ |
+ number
+ |
+ bool
+ |
+ word
+ |
+ symbol
+ |
+ write
+ |
+ newline
+ |
+ openkey
+ |
+ closekey
+ |
+ colon
+ |
+ semicolon
+ |
+ range
+ |
+ openpar
+ |
+ closepar
+ |
+ void
+ |
+ opencorch
+ |
+ closecorch
+ |
+ mayor
+ |
+ menor
+ |
+ switch
+ |
+ case_number
+ |
+ case_default
+ |
+ break
+ |
+ hexa
+ |
+ define
+ ;
+
+read:
+ READ OPENPAR CLOSEPAR
+ {
+
+ }
+define:
+ DEFINE WORD OPENPAR CLOSEPAR
+ {
+ InsertDefine(defineslist, (char *)$2);
+ definefound = 1;
+ fprintf(FILE_DEFINES,"`define %s ",(char *)$2);
+ }
+void:
+ WORD DOSPUNTOSDOBLE WORD OPENPAR CLOSEPAR
+ {
+ strcpy(processname ,(char *)$4);
+ strcpy(processname2 ,(char *)$4);
+ strcat(processname2, (char *)".sc2v");
+ strcpy(fileregs ,(char *)$4);
+ strcat(fileregs, (char *)"_regs.sc2v");
+ /*
+ strcpy(file_writes, (char *)$4);
+ strcat(file_writes, (char *)"_writes.sc2v");
+ */
+ }
+sc_int:
+ SC_INT MENOR NUMBER MAYOR
+ {
+ if(processfound)
+ {
+ fprintf(regs_file,"reg[%d:0] ",(-1 + $3));
+ reg_found = 1;
+ }
+ }
+ ;
+
+sc_uint:
+ SC_UINT MENOR NUMBER MAYOR
+ {
+ if(processfound)
+ {
+ fprintf(regs_file,"reg[%d:0] ",(-1 + $3));
+ reg_found = 1;
+ }
+ }
+ ;
+
+sc_bigint:
+ SC_BIGINT MENOR NUMBER MAYOR
+ {
+ if(processfound)
+ {
+ fprintf(regs_file,"reg[%d:0] ",(-1 + $3));
+ reg_found = 1;
+ }
+ }
+ ;
+
+sc_biguint:
+ SC_BIGUINT MENOR NUMBER MAYOR
+ {
+ if(processfound)
+ {
+ fprintf(regs_file,"reg[%d:0] ",(-1 + $3));
+ reg_found = 1;
+ }
+ }
+ ;
+
+bool:
+ BOOL
+ {
+ if(processfound)
+ {
+ fprintf(regs_file,"reg ");
+ reg_found = 1;
+ }
+ }
+ ;
+
+range:
+ RANGE OPENPAR NUMBER COLON NUMBER CLOSEPAR
+ {
+ if(processfound)
+ fprintf(file,"[%d:%d]",$3,$5);
+ else if(definefound)
+ fprintf(FILE_DEFINES,"[%d:%d]",$3,$5);
+ }
+ ;
+
+number:
+ NUMBER
+ {
+ if(processfound)
+ if(reg_found)
+ {
+ if(opencorchfound)
+ fprintf(regs_file,"%d:0", -1 + $1);
+ else
+ fprintf(regs_file,"%d",$1);
+ }
+ else
+ fprintf(file,"%d",$1);
+ else if(definefound)
+ fprintf(FILE_DEFINES,"%d",$1);
+ }
+ ;
+word:
+ WORD
+ {
+ if(processfound)
+ {
+ if(openedcase)
+ {
+ fprintf(file," :\n");
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"begin\n");
+ openedcase = 0;
+ }
+ strcpy(lastword, (char *)$1);
+
+ if(reg_found)
+ {
+ strcpy(regname ,(char *)$1);
+ strcpy(regname2 ,(char *)$1);
+ strcat(regname2, processname);
+ fprintf(regs_file,"%s",regname2);
+ InsertReg(regslist, regname, regname2);
+ }
+ else
+ {
+ if(newline)
+ {
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ }
+ regname2 = IsReg(regslist, (char *)$1);
+ if(regname2 == NULL)
+ {
+ if(IsDefine(defineslist, (char *)$1))
+ {
+ fprintf(file,"`%s ", (char *)$1);
+ defineinvocationfound = 1;
+ }
+ else
+ {
+ fprintf(file,"%s ",(char *)$1);
+ }
+ }
+ else
+ fprintf(file,"%s ",regname2);
+ newline = 0;
+ }
+ }
+ else if(definefound)
+ {
+ if(IsDefine(defineslist, (char *)$1))
+ {
+ fprintf(FILE_DEFINES,"`%s ",(char *)$1);
+ }
+ else
+ {
+ fprintf(FILE_DEFINES,"%s ",(char *)$1);
+ }
+ }
+ }
+ ;
+
+symbol:
+ SYMBOL
+ {
+ if(processfound)
+ {
+ if(reg_found)
+ fprintf(regs_file,"%s",(char *)$1);
+ else
+ fprintf(file,"%s",(char *)$1);
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"%s",(char *)$1);
+ }
+ }
+ ;
+
+/*espace:
+ ESPACE
+ {
+ if(processfound)
+ fprintf(file," ");
+ }
+ ;
+*/
+
+/*
+tab:
+ TAB
+ {
+ if(processfound)
+ fprintf(file,"\t");
+ }
+ ;
+*/
+write:
+ WRITE
+ {
+ if(processfound)
+ {
+ fprintf(file," = ");
+ fprintf(FILE_WRITES, "%s\n", lastword);
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES," = ");
+ }
+ }
+ ;
+
+newline:
+ NEWLINE
+ {
+ if(processfound & !reg_found & !openedcase)
+ {
+ fprintf(file,"\n");
+ newline = 1;
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"\n");
+ }
+ }
+ ;
+
+colon:
+ COLON
+ {
+ if(processfound)
+ {
+ if(reg_found)
+ {
+ fprintf(regs_file,",");
+ }
+ else
+ fprintf(file,",");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,",");
+ }
+ }
+ ;
+
+semicolon:
+ SEMICOLON
+ {
+ if(processfound)
+ {
+ if(reg_found)
+ {
+ fprintf(regs_file,";\n");
+ reg_found = 0;
+ }
+ else if(defineinvocationfound)
+ {
+ defineinvocationfound = 0;
+ }
+ else
+ {
+ fprintf(file,";");
+ }
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,";");
+ }
+ }
+ ;
+
+openpar:
+ OPENPAR
+ {
+ if(processfound)
+ {
+ fprintf(file,"(");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"(");
+ }
+ }
+ ;
+
+closepar:
+ CLOSEPAR
+ {
+ if(processfound)
+ {
+ fprintf(file,")");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,")");
+ }
+ }
+ ;
+
+opencorch:
+ OPENCORCH
+ {
+ if(processfound)
+ {
+ if(reg_found)
+ {
+ fprintf(regs_file,"[");
+ opencorchfound = 1;
+ }
+ else
+ fprintf(file,"[");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"[");
+
+ }
+ }
+ ;
+
+closecorch:
+ CLOSECORCH
+ {
+ if(processfound)
+ {
+ if(reg_found)
+ {
+ fprintf(regs_file,"]");
+ opencorchfound = 0;
+ }
+ else
+ fprintf(file,"]");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"]");
+ }
+ }
+ ;
+
+
+openkey:
+ OPENKEY
+ {
+ openedkeys++;
+ if(openedkeys==1 & !definefound)
+ {
+ printf("opening file => filename = %s\n",processname2);
+ file = fopen(processname2,(char *)"w");
+ printf("opening file => filename = %s\n",fileregs);
+ regs_file = fopen(fileregs,(char *)"w");
+ processfound = 1;
+ regslist = (RegsList *)malloc(sizeof(RegsList));
+ InitializeRegsList(regslist);
+ regname = (char *)malloc(256*sizeof(int));
+ regname2 = (char *)malloc(256*sizeof(int));
+ }
+ if(processfound)
+ if(openedkeys != switchparenthesis)
+ {
+ fprintf(file,"\n");
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"begin\n");
+ newline = 1;
+ }
+ /*if(definefound)
+ {
+
+ }*/
+ }
+ ;
+
+closekey:
+ CLOSEKEY
+ {
+ if(processfound)
+ {
+ if(openedkeys==switchparenthesis & switchfound == 1)
+ {
+ fprintf(file,"\n");
+ if(default_found & !default_break_found)
+ {
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"end\n");
+ default_found = 0;
+ }
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"endcase\n");
+ newline = 1;
+ switchfound = 0;
+ switchparenthesis = 0;
+ }
+ else
+ {
+ fprintf(file,"\n");
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"end\n");
+ newline = 1;
+ }
+ }
+
+ openedkeys--;
+ if(definefound)
+ {
+ definefound = 0;
+ fprintf(FILE_DEFINES,"\n//Dummy Comment\n");
+ }
+ else if(openedkeys==0)
+ {
+ fclose(file);
+ fclose(regs_file);
+ free(regslist);
+ free(regname);
+ free(regname2);
+ processfound = 0;
+ }
+ }
+ ;
+
+
+mayor:
+ MAYOR
+ {
+ if(processfound)
+ {
+ fprintf(file,">");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,">");
+ }
+ }
+ ;
+
+menor:
+ MENOR
+ {
+ if(processfound)
+ {
+ fprintf(file,"<");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"<");
+ }
+ }
+ ;
+
+
+switch:
+ SWITCH
+ {
+ if(processfound)
+ {
+ fprintf(file,"\n");
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"case");
+ switchfound = 1;
+ switchparenthesis = openedkeys + 1;
+ }
+ };
+
+
+
+case_number:
+ CASE NUMBER SYMBOL
+ {
+ if(processfound)
+ {
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ if(openedcase)
+ fprintf(file,", %d",$2);
+ else
+ fprintf(file,"%d",$2);
+ //for(i = 0; i < openedkeys; i++)
+ // fprintf(file," ");
+ //fprintf(file,"begin\n");
+ newline = 1;
+ openedcase = 1;
+
+ }
+ };
+
+
+case_default:
+ DEFAULT SYMBOL
+ {
+ if(processfound)
+ {
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"default:\n");
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"begin\n");
+ newline = 1;
+ default_found = 1;
+ }
+ };
+
+break:
+ BREAK SEMICOLON
+ {
+ if(processfound)
+ {
+ if(newline == 0)
+ fprintf(file,"\n");
+ for(i = 0; i < openedkeys; i++)
+ fprintf(file," ");
+ fprintf(file,"end");
+ if(default_found)
+ {
+ default_break_found = 1;
+ }
+ }
+ };
+
+hexa:
+ HEXA
+ {
+ if(processfound)
+ {
+ fprintf(file,"'h");
+ }
+ else if(definefound)
+ {
+ fprintf(FILE_DEFINES,"'h");
+ }
+
+ };
Index: trunk/src/list.h
===================================================================
--- trunk/src/list.h (nonexistent)
+++ trunk/src/list.h (revision 2)
@@ -0,0 +1,171 @@
+/* -----------------------------------------------------------------------------
+ *
+ * SystemC to Verilog Translator v0.1
+ * Provided by OpenSoc Design
+ *
+ * www.opensocdesign.com
+ *
+ * -----------------------------------------------------------------------------
+ * 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 Library 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.
+ */
+
+
+typedef struct _define_node {
+ char *name;
+ struct _define_node *next;
+} DefineNode;
+
+typedef struct _defines_list {
+ DefineNode *first;
+ DefineNode *last;
+} DefinesList;
+
+typedef struct _write_node {
+ char *name;
+ struct _write_node *next;
+} WriteNode;
+
+typedef struct _writes_list {
+ WriteNode *first;
+ WriteNode *last;
+} WritesList;
+
+typedef struct _reg_node {
+ char *name;
+ char *name2;
+ struct _reg_node *next;
+} RegNode;
+
+typedef struct _regs_list {
+ RegNode *first;
+ RegNode *last;
+} RegsList;
+
+typedef struct _port_node {
+ char *name;
+ char *tipo;
+ int size;
+ struct _port_node *next;
+} PortNode;
+
+typedef struct _port_list {
+ PortNode *first;
+ PortNode *last;
+} PortList;
+
+typedef struct _signal_node {
+ char *name;
+ int size;
+ struct _signal_node *next;
+} SignalNode;
+
+typedef struct _signals_list {
+ SignalNode *first;
+ SignalNode *last;
+} SignalsList;
+
+typedef struct _bind_node {
+ char *nameport;
+ char *namebind;
+ struct _bind_node *next;
+} BindNode;
+
+typedef struct _binds_list {
+ BindNode *first;
+ BindNode *last;
+} BindsList;
+
+typedef struct _instance_node {
+ char *nameinstance;
+ char *namemodulo;
+ BindsList *bindslist;
+ struct _instance_node *next;
+ } InstanceNode;
+
+typedef struct _instances_list {
+ InstanceNode *first;
+ InstanceNode *last;
+} InstancesList;
+
+typedef struct _sensibility_node {
+ char *tipo;
+ char *name;
+ struct _sensibility_node *next;
+} SensibilityNode;
+
+typedef struct _sensibility_list {
+ SensibilityNode *first;
+ SensibilityNode *last;
+} SensibilityList;
+
+typedef struct _process_node {
+ char *name;
+ char *tipo; //comb or seq
+ SensibilityList *list;
+ struct _process_node *next;
+} ProcessNode;
+
+typedef struct _process_list {
+ ProcessNode *first;
+ ProcessNode *last;
+} ProcessList;
+
+/* Functions for DEFINES list*/
+void InitializeDefinesList(DefinesList *list);
+void InsertDefine(DefinesList *list, char *name);
+int IsDefine(DefinesList *list, char *name);
+void ShowDefines(char *filedefines);
+
+/* Functions for WRITES list*/
+void InitializeWritesList(WritesList *list);
+void InsertWrite(WritesList *list, char *name);
+int IsWrite(WritesList *list, char *name);
+void ShowRegsList(RegsList *list);
+void ReadWritesFile(WritesList *list, char *name);
+
+/* Functions for registers list*/
+void InitializeRegsList(RegsList *list);
+void InsertReg(RegsList *list, char *name, char *name2);
+char *IsReg(RegsList *list, char *name);
+void ShowRegsList(RegsList *list);
+
+/* Functions for ports list*/
+void InitializePortList(PortList *list);
+void InsertPort(PortList *list, char *name, char *tipo, int size);
+void ShowPortList(PortList *list);
+void EnumeratePorts(PortList *list);
+
+/* Functions for signals list*/
+void InitializeSignalsList(SignalsList *list);
+void InsertSignal(SignalsList *list, char *name, int size);
+void ShowSignalsList(SignalsList *list, WritesList *WritesList);
+int IsWire(char *name, InstancesList *list);
+
+/* Functions for sensitivity list*/
+void InitializeSensibilityList(SensibilityList *list);
+void InsertSensibility(SensibilityList *list, char *name, char *tipo);
+void ShowSensibilityList(SensibilityList *list);
+
+/* Functions for process list*/
+void InsertProcess(ProcessList *list, char *name, SensibilityList *SensibilityList, char *tipo);
+void ShowProcessList(ProcessList *list);
+void ShowProcessCode(ProcessList *list);
+
+/* Functions for instances and binds list*/
+void InitializeInstancesList(InstancesList *list);
+void InsertInstance(InstancesList *list, char *nameInstance, char *namemodulo);
+void InitializeBindsList(BindsList *list);
+void InsertBind(BindsList *list, char *namePort, char *namebind);
+void ShowInstancedModules(InstancesList *list);
Index: trunk/src/sc2v_step2.y
===================================================================
--- trunk/src/sc2v_step2.y (nonexistent)
+++ trunk/src/sc2v_step2.y (revision 2)
@@ -0,0 +1,454 @@
+/* -----------------------------------------------------------------------------
+ *
+ * SystemC to Verilog Translator v0.1
+ * Provided by OpenSoc Design
+ *
+ * www.opensocdesign.com
+ *
+ * -----------------------------------------------------------------------------
+ * 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 Library 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.
+ */
+
+%{
+#include
+#include
+
+#include "list.h"
+
+
+/*Global var to read from file_writes.sc2v*/
+WritesList *writeslist;
+
+/*Global var to store ports*/
+PortList *portlist;
+
+/* Global var to store signals*/
+SignalsList *signalslist;
+
+/* Global var to store sensitivity list*/
+SensibilityList *sensibilitylist;
+
+/* Global var to store instantiated modules*/
+InstancesList *instanceslist;
+
+/* Global var to store process list*/
+ProcessList *processlist;
+
+
+/* Global var to store process module name*/
+char *module_name;
+int module_name_found = 0;
+
+/* Global var to store last port type*/
+char *lastportkind;
+int lastportsize;
+int activeport = 0; // 1 -> reading port list
+
+/* Global var to store last signal type*/
+int lastsignalsize;
+int signalactive = 0;
+
+/* Global var to store last SC_METHOD found*/
+char *active_method;
+char *active_method_type;
+int method_found;
+
+/* Global var to store last sensitivity found*/
+char *last_sensibility;
+int sensibility_active = 0;
+
+
+
+
+
+void yyerror(const char *str)
+{
+ fprintf(stderr,"error: %s\n",str);
+}
+
+int yywrap()
+{
+ return 1;
+}
+
+main()
+{
+ writeslist = (WritesList *)malloc(sizeof(WritesList));
+ InitializeWritesList(writeslist);
+ portlist = (PortList *)malloc(sizeof(PortList));
+ InitializePortList(portlist);
+ signalslist = (SignalsList *)malloc(sizeof(SignalsList));
+ InitializeSignalsList(signalslist);
+ sensibilitylist = (SensibilityList *)malloc(sizeof(SensibilityList));
+ InitializeSensibilityList(sensibilitylist);
+ instanceslist = (InstancesList *)malloc(sizeof(InstancesList));
+ InitializeInstancesList(instanceslist);
+ processlist = (ProcessList *)malloc(sizeof(ProcessList));
+ InitializeProcessList(processlist);
+
+
+ yyparse();
+ printf("module %s(",module_name);
+ EnumeratePorts(portlist);
+ printf(");\n");
+
+ ShowPortList(portlist);
+ printf("\n");
+ RegOutputs(portlist);
+ printf("\n");
+
+ ReadWritesFile(writeslist, (char *)"file_writes.sc2v");
+
+ ShowSignalsList(signalslist, writeslist);
+ printf("\n");
+
+ ShowInstancedModules(instanceslist);
+ printf("\n");
+
+ ShowDefines((char *)"file_defines.sc2v");
+
+ ShowProcessCode(processlist);
+ printf("\n");
+
+ printf("endmodule\n");
+}
+
+%}
+
+%token NUMBER SC_MODULE WORD OPENPAR CLOSEPAR SC_IN SC_OUT SEMICOLON BOOL
+%token MENOR MAYOR SC_INT SC_UINT SC_METHOD SENSITIVE_POS SENSITIVE_NEG SENSITIVE
+%token SENSIBLE CLOSEKEY OPENKEY SEMICOLON COLON SC_SIGNAL ARROW EQUALS NEW QUOTE
+%token SC_CTOR VOID ASTERISCO
+
+%%
+
+commands: /* empty */
+ | commands command
+ ;
+
+
+command:
+ module
+ |
+ in_bool
+ |
+ in_sc_int
+ |
+ in_sc_uint
+ |
+ out_bool
+ |
+ out_sc_int
+ |
+ out_sc_uint
+ |
+ sc_method
+ |
+ sensitive_pos
+ |
+ sensitive_neg
+ |
+ sensitive
+ |
+ sensible_word_colon
+ |
+ sensible_word_semicolon
+ |
+ closekey
+ |
+ word_semicolon
+ |
+ word_colon
+ |
+ signal_bool
+ |
+ signal_uint
+ |
+ signal_int
+ |
+ instantation
+ |
+ port_binding
+ |
+ sc_ctor
+ |
+ void
+ |
+ inst_decl
+ |
+ closekey_semicolon
+ ;
+
+module:
+ SC_MODULE OPENPAR WORD CLOSEPAR OPENKEY
+ {
+ if(module_name_found)
+ {
+ fprintf(stderr,"error: two or more modules found in the file\n");
+ exit(1);
+ }
+ else
+ {
+ module_name = (char *)malloc(256*sizeof(char));
+ strcpy(module_name, (char *)$3);
+ module_name_found = 1;
+ }
+ }
+ ;
+
+in_sc_uint:
+ SC_IN MENOR SC_UINT MENOR NUMBER MAYOR MAYOR
+ {
+ activeport = 1;
+ lastportsize = $5;
+ lastportkind = (char *)"input";
+ }
+ ;
+
+in_sc_int:
+ SC_IN MENOR SC_INT MENOR NUMBER MAYOR MAYOR
+ {
+ activeport = 1;
+ lastportsize = $5;
+ lastportkind = (char *)"input";
+ }
+ ;
+
+
+in_bool:
+ SC_IN MENOR BOOL MAYOR
+ {
+ activeport = 1;
+ lastportsize = 0;
+ lastportkind = (char *)"input";
+ }
+ ;
+
+signal_bool:
+ SC_SIGNAL MENOR BOOL MAYOR
+ {
+ signalactive = 1;
+ lastsignalsize = 0;
+ }
+ ;
+signal_uint:
+ SC_SIGNAL MENOR SC_UINT MENOR NUMBER MAYOR MAYOR
+ {
+ signalactive = 1;
+ lastsignalsize = $5;
+ }
+ ;
+signal_int:
+ SC_SIGNAL MENOR SC_INT MENOR NUMBER MAYOR MAYOR
+ {
+ signalactive = 1;
+ lastsignalsize = $5;
+ }
+ ;
+
+out_bool:
+ SC_OUT MENOR BOOL MAYOR
+ {
+ activeport = 1;
+ lastportsize = 0;
+ lastportkind = (char *)"output";
+ }
+ ;
+
+out_sc_uint:
+ SC_OUT MENOR SC_UINT MENOR NUMBER MAYOR MAYOR
+ {
+ activeport = 1;
+ lastportsize = $5;
+ lastportkind = (char *)"output";
+ }
+ ;
+
+out_sc_int:
+ SC_OUT MENOR SC_INT MENOR NUMBER MAYOR MAYOR
+ {
+ activeport = 1;
+ lastportsize = $5;
+ lastportkind = (char *)"output";
+ }
+ ;
+
+sc_method:
+ SC_METHOD OPENPAR WORD CLOSEPAR SEMICOLON
+ {
+ if(method_found)
+ {
+ InsertProcess(processlist, active_method, sensibilitylist, active_method_type);
+ }
+ active_method = (char *)$3;
+ method_found = 1;
+ /* New sensitivity list */
+ sensibilitylist = (SensibilityList *)malloc(sizeof(SensibilityList));
+ InitializeSensibilityList(sensibilitylist);
+ }
+ ;
+
+sensitive_pos:
+ SENSITIVE_POS
+ {
+ last_sensibility = (char *)"posedge";
+ active_method_type = (char *)"seq"; //seq
+ sensibility_active = 1;
+ }
+ ;
+
+sensitive_neg:
+ SENSITIVE_NEG
+ {
+ last_sensibility = (char *)"negedge";
+ active_method_type = (char *)"seq"; //seq
+ sensibility_active = 1;
+ }
+ ;
+
+sensitive:
+ SENSITIVE
+ {
+ last_sensibility = (char *)" ";
+ active_method_type = (char *)"comb"; //comb
+ sensibility_active = 1;
+ }
+ ;
+sensible_word_colon:
+ SENSIBLE WORD
+ {
+ InsertSensibility(sensibilitylist, (char *)$2, (char *)last_sensibility);
+ }
+ ;
+
+sensible_word_semicolon:
+ SENSIBLE WORD SEMICOLON
+ {
+ InsertSensibility(sensibilitylist, (char *)$2, (char *)last_sensibility);
+ if(sensibility_active)
+ {
+ sensibility_active = 0;
+ }
+ }
+ ;
+
+closekey:
+ CLOSEKEY
+ {
+ if(method_found)
+ {
+ method_found = 0;
+ InsertProcess(processlist, active_method, sensibilitylist, active_method_type);
+ }
+ }
+ ;
+word_semicolon:
+ WORD SEMICOLON
+ {
+ if(activeport)
+ {
+ InsertPort(portlist, (char *)$1, lastportkind, lastportsize);
+ activeport = 0;
+ }
+ else if(signalactive)
+ {
+ InsertSignal(signalslist, (char *)$1, lastsignalsize);
+ signalactive = 0;
+ }
+ }
+ ;
+
+word_colon:
+ WORD COLON
+ {
+ if(activeport)
+ {
+ InsertPort(portlist, (char *)$1, lastportkind, lastportsize);
+ }
+ else if(signalactive)
+ {
+ InsertSignal(signalslist, (char *)$1, lastsignalsize);
+ }
+ }
+ ;
+
+instantation:
+ WORD EQUALS NEW WORD OPENPAR QUOTE WORD QUOTE CLOSEPAR SEMICOLON
+ {
+ InsertInstance(instanceslist, (char *)$1, (char *)$4);
+ }
+ ;
+
+port_binding:
+ WORD ARROW WORD OPENPAR WORD CLOSEPAR SEMICOLON
+ {
+ if(instanceslist->last == NULL)
+ {
+ fprintf(stderr,"error: no instances found\n");
+ }
+ else
+ {
+ InstanceNode *aux;
+ aux = instanceslist->first;
+ while(1)
+ {
+ if(strcmp(aux->nameinstance, (char *)$1) == 0)
+ {
+ break;
+ }
+ else
+ {
+ if(aux->next == NULL)
+ {
+ fprintf(stderr,"error: instance %s not found\n",$1);
+ exit(1);
+ }
+ else
+ {
+ aux = aux->next;
+ }
+ }
+ }
+ InsertBind(aux->bindslist, (char *)$3, (char *)$5);
+ }
+ }
+ ;
+
+sc_ctor:
+ SC_CTOR OPENPAR WORD CLOSEPAR OPENKEY
+ {
+
+ }
+ ;
+
+void:
+ VOID WORD OPENPAR CLOSEPAR SEMICOLON
+ {
+
+ }
+ ;
+
+inst_decl:
+ WORD ASTERISCO WORD SEMICOLON
+ {
+
+ }
+ ;
+
+closekey_semicolon: CLOSEKEY SEMICOLON
+ {
+
+ }
+ ;
Index: trunk/src/sc2v_step1.l
===================================================================
--- trunk/src/sc2v_step1.l (nonexistent)
+++ trunk/src/sc2v_step1.l (revision 2)
@@ -0,0 +1,73 @@
+/* -----------------------------------------------------------------------------
+ *
+ * SystemC to Verilog Translator v0.1
+ * Provided by OpenSoc Design
+ *
+ * www.opensocdesign.com
+ *
+ * -----------------------------------------------------------------------------
+ * 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 Library 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.
+ */
+
+
+%{
+#include
+#include "y.tab.h"
+
+extern int yylval;
+
+%}
+
+%%
+[0-9]+ yylval=atoi(yytext); return NUMBER;
+void /* Ignore void */
+"::" return DOSPUNTOSDOBLE;
+sc_int return SC_INT;
+sc_uint return SC_UINT;
+sc_bigint return SC_BIGINT;
+sc_biguint return SC_BIGUINT;
+bool return BOOL;
+">" return MAYOR;
+"<" return MENOR;
+"{" return OPENKEY;
+"}" return CLOSEKEY;
+"(" return OPENPAR;
+")" return CLOSEPAR;
+"[" return OPENCORCH;
+"]" return CLOSECORCH;
+".write" return WRITE;
+"switch" return SWITCH;
+"case" return CASE;
+"default" return DEFAULT;
+"break" return BREAK;
+".read" return READ;
+".range" return RANGE;
+"#define" return DEFINE;
+"#include" /* Ignore #include */
+[a-zA-Z][_a-zA-Z0-9]* yylval=(int)strdup(yytext); return WORD;
+[.:"^"!%()=/+*_"&""?""|""\\"] yylval=(int)strdup(yytext); return SYMBOL;
+"-" yylval=(int)strdup(yytext); return SYMBOL;
+"~" yylval=(int)strdup(yytext); return SYMBOL;
+"@" yylval=(int)strdup(yytext); return SYMBOL;
+"#" yylval=(int)strdup(yytext); return SYMBOL;
+"," return COLON;
+";" return SEMICOLON;
+[" "]+ /* Ignore white spaces*/
+"\t" /* Ignore TAB; */
+"\n" return NEWLINE;
+"0x" return HEXA;
+"$" /* Ignore $ */
+"(int)" /* Ignore int type conversions*/
+%%
Index: trunk/src/sc2v_step2.l
===================================================================
--- trunk/src/sc2v_step2.l (nonexistent)
+++ trunk/src/sc2v_step2.l (revision 2)
@@ -0,0 +1,90 @@
+/* -----------------------------------------------------------------------------
+ *
+ * SystemC to Verilog Translator v0.1
+ * Provided by OpenSoc Design
+ *
+ * www.opensocdesign.com
+ *
+ * -----------------------------------------------------------------------------
+ * 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 Library 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.
+ */
+
+%{
+#include
+#include "y.tab.h"
+
+extern int yylval;
+
+int includefound = 0;
+int linecomment = 0;
+int multilinecomment = 0;
+%}
+
+%%
+"\t" /* ignore whitespace */
+" " /* ignore whitespace */
+[0-9]+ if(!includefound & !linecomment & !multilinecomment) {
+ yylval=atoi(yytext);
+ return NUMBER;
+ }
+SC_MODULE if(!includefound & !linecomment & !multilinecomment) return SC_MODULE;
+SC_METHOD if(!includefound & !linecomment & !multilinecomment) return SC_METHOD;
+SC_CTOR if(!includefound & !linecomment & !multilinecomment) return SC_CTOR;
+"void" if(!includefound & !linecomment & !multilinecomment) return VOID;
+sensitive_pos if(!includefound & !linecomment & !multilinecomment) return SENSITIVE_POS;
+sensitive_neg if(!includefound & !linecomment & !multilinecomment) return SENSITIVE_NEG;
+sensitive if(!includefound & !linecomment & !multilinecomment) return SENSITIVE;
+"<<" if(!includefound & !linecomment & !multilinecomment) return SENSIBLE;
+sc_in if(!includefound & !linecomment & !multilinecomment) return SC_IN;
+sc_out if(!includefound & !linecomment & !multilinecomment) return SC_OUT;
+sc_signal if(!includefound & !linecomment & !multilinecomment) return SC_SIGNAL;
+"bool" if(!includefound & !linecomment & !multilinecomment) return BOOL;
+"<" if(!includefound & !linecomment & !multilinecomment) return MENOR;
+">" if(!includefound & !linecomment & !multilinecomment) return MAYOR;
+sc_int if(!includefound & !linecomment & !multilinecomment) return SC_INT;
+sc_uint if(!includefound & !linecomment & !multilinecomment) return SC_UINT;
+sc_bigint if(!includefound & !linecomment & !multilinecomment) return SC_INT;
+sc_biguint if(!includefound & !linecomment & !multilinecomment) return SC_UINT;
+\( if(!includefound & !linecomment & !multilinecomment) return OPENPAR;
+\) if(!includefound & !linecomment & !multilinecomment) return CLOSEPAR;
+; if(!includefound & !linecomment & !multilinecomment) return SEMICOLON;
+"," if(!includefound & !linecomment & !multilinecomment) return COLON;
+"{" if(!includefound & !linecomment & !multilinecomment) return OPENKEY;
+"}" if(!includefound & !linecomment & !multilinecomment) return CLOSEKEY;
+"->" if(!includefound & !linecomment & !multilinecomment) return ARROW;
+"=" if(!includefound & !linecomment & !multilinecomment) return EQUALS;
+"new" if(!includefound & !linecomment & !multilinecomment) return NEW;
+"\"" if(!includefound & !linecomment & !multilinecomment) return QUOTE;
+[a-zA-Z][a-z_A-Z0-9]* if(!includefound & !linecomment & !multilinecomment) {
+ yylval=(int)strdup(yytext);
+ return WORD;
+ }
+"*" if(!includefound & !linecomment & !multilinecomment) return ASTERISCO;
+"\n" includefound = 0; linecomment = 0;
+"$" /* ignore */
+"." /* ignore */
+":" /* ignore */
+"#include" includefound = 1;
+"//" linecomment = 1;
+"/*" multilinecomment = 1;
+"*/" multilinecomment = 0;
+"/" /* ignore */
+"-"
+"#"
+"@"
+"|"
+"~"
+
+%%
Index: trunk/src/doxygen.cfg
===================================================================
--- trunk/src/doxygen.cfg (nonexistent)
+++ trunk/src/doxygen.cfg (revision 2)
@@ -0,0 +1,993 @@
+# Doxyfile 1.2.18
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = sc2v
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ../docs
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
+# (Japanese with english messages), Korean, Norwegian, Polish, Portuguese,
+# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these class will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
+# members of a class in the documentation of that class as if those members were
+# ordinary class members. Constructors, destructors and assignment operators of
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH =
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower case letters. If set to YES upper case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF =
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# reimplements.
+
+INHERIT_DOCS = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consist of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C.
+# For instance some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
+# only. Doxygen will then generate output that is more tailored for Java.
+# For instance namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
+# *.h++ *.idl *.odl
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command , where
+# is the value of the INPUT_FILTER tag, and is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER =
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output dir.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non empty doxygen will try to run
+# the html help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
+# or Internet explorer 4.0+). Note that for large projects the tree generation
+# can take a very long time. In such cases it is better to disable this feature.
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimised for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assigments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = YES
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_XML = NO
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH = ../include
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse the
+# parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off. Note that this
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
+# recommended to install and use dot, since it yield more powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermedate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
+
+# The CGI_NAME tag should be the name of the CGI script that
+# starts the search engine (doxysearch) with the correct parameters.
+# A script with this name will be generated by doxygen.
+
+CGI_NAME = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the
+# cgi binaries are located. See the documentation of your http daemon for
+# details.
+
+CGI_URL =
+
+# The DOC_URL tag should be the absolute URL to the directory where the
+# documentation is located. If left blank the absolute path to the
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL =
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the
+# documentation is located. If left blank the directory on the local machine
+# will be used.
+
+DOC_ABSPATH =
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
+# is installed.
+
+BIN_ABSPATH = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to
+# documentation generated for other projects. This allows doxysearch to search
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS =
Index: trunk/src/list.c
===================================================================
--- trunk/src/list.c (nonexistent)
+++ trunk/src/list.c (revision 2)
@@ -0,0 +1,744 @@
+/* -----------------------------------------------------------------------------
+ *
+ * SystemC to Verilog Translator v0.1
+ * Provided by OpenSoc Design
+ *
+ * www.opensocdesign.com
+ *
+ * -----------------------------------------------------------------------------
+ * 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 Library 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.
+ */
+
+#include
+#include
+
+#include "list.h"
+
+void InitializeDefinesList(DefinesList *list)
+{
+ DefineNode *first;
+ first = (DefineNode *)malloc(sizeof(DefineNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertDefine(DefinesList *list, char *name)
+{
+ if(list->last == NULL) //list empty
+ {
+ list->first->name = (char *)malloc(256*sizeof(char));
+ strcpy(list->first->name ,name);
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ DefineNode *nuevo;
+ nuevo = (DefineNode *)malloc(sizeof(DefineNode));
+ nuevo->name = (char *)malloc(256*sizeof(char));
+ strcpy(nuevo->name ,name);
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+int IsDefine(DefinesList *list, char *name)
+{
+ DefineNode *auxwrite = list->first;
+
+ if(list->last == NULL)
+ {
+ return 0;
+ }
+ else
+ {
+ while(1)
+ {
+ if((strcmp(name, auxwrite->name)==0))
+ {
+ return 1;
+ }
+ else if(auxwrite->next != NULL)
+ {
+ auxwrite = auxwrite->next;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+void ShowDefines(char *filedefines)
+{
+ int readok;
+ char *auxchar;
+ FILE *file;
+
+ file = fopen(filedefines,(char *)"r");
+
+ while(1)
+ {
+ readok = fread((void *)&auxchar, sizeof(char), 1, file);
+ if(readok)
+ printf("%c",auxchar);
+ else
+ break;
+ }
+}
+
+void InitializeWritesList(WritesList *list)
+{
+ WriteNode *first;
+ first = (WriteNode *)malloc(sizeof(WriteNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertWrite(WritesList *list, char *name)
+{
+ if(list->last == NULL) //list empty
+ {
+ list->first->name = (char *)malloc(256*sizeof(char));
+ strcpy(list->first->name ,name);
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ WriteNode *nuevo;
+ nuevo = (WriteNode *)malloc(sizeof(WriteNode));
+ nuevo->name = (char *)malloc(256*sizeof(char));
+ strcpy(nuevo->name ,name);
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+int IsWrite(WritesList *list, char *name)
+{
+ WriteNode *auxwrite = list->first;
+
+ if(list->last == NULL)
+ {
+ return 0;
+ }
+ else
+ {
+ while(1)
+ {
+ if((strcmp(name, auxwrite->name)==0))
+ {
+ return 1;
+ }
+ else if(auxwrite->next != NULL)
+ {
+ auxwrite = auxwrite->next;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+void ShowWritesList(WritesList *list)
+{
+ if(list->last != NULL) //list not empty
+ {
+ WriteNode *aux = list->first;
+ while(1)
+ {
+ printf("%s\n",aux->name);
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+void ReadWritesFile(WritesList *list, char *name)
+{
+ char *leido;
+ int ret;
+ FILE *file_writes;
+ file_writes = fopen(name, (char *)"r");
+
+ leido = (char *)malloc(256*sizeof(char));
+
+ while(1)
+ {
+ ret = fscanf(file_writes,"%s",leido);
+ if(ret == EOF)
+ break;
+ InsertWrite(list, leido);
+ }
+
+
+}
+
+void InitializeRegsList(RegsList *list)
+{
+ RegNode *first;
+ first = (RegNode *)malloc(sizeof(RegNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertReg(RegsList *list, char *name, char *name2)
+{
+ if(list->last == NULL)
+ {
+ list->first->name = (char *)malloc(256*sizeof(char));
+ list->first->name2 = (char *)malloc(256*sizeof(char));
+ strcpy(list->first->name ,name);
+ strcpy(list->first->name2 ,name2);
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ RegNode *nuevo;
+ nuevo = (RegNode *)malloc(sizeof(RegNode));
+ nuevo->name = (char *)malloc(256*sizeof(char));
+ nuevo->name2 = (char *)malloc(256*sizeof(char));
+ strcpy(nuevo->name ,name);
+ strcpy(nuevo->name2 ,name2);
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+/* Looks if a WORD of func.y file is a register of the process*/
+char *IsReg(RegsList *list, char *name)
+{
+ RegNode *auxreg = list->first;
+
+ if(list->last == NULL)
+ {
+ return NULL;
+ }
+ else
+ {
+ while(1)
+ {
+ if((strcmp(name, auxreg->name)==0))
+ {
+ return auxreg->name2;
+ }
+ else if(auxreg->next != NULL)
+ {
+ auxreg = auxreg->next;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ return NULL;
+}
+
+void ShowRegsList(RegsList *list)
+{
+ if(list->last != NULL)
+ {
+ RegNode *aux = list->first;
+ while(1)
+ {
+ printf("%s\t",aux->name);
+ printf("%s;\n",aux->name2);
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+void InitializePortList(PortList *list)
+{
+ PortNode *first;
+ first = (PortNode *)malloc(sizeof(PortNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertPort(PortList *list, char *name, char *tipo, int size)
+{
+ if(list->last == NULL)
+ {
+ list->first->name = name;
+ list->first->tipo = tipo;
+ list->first->size = size;
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ PortNode *nuevo;
+ nuevo = (PortNode *)malloc(sizeof(PortNode));
+ nuevo->name = name;
+ nuevo->tipo = tipo;
+ nuevo->size = size;
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+void ShowPortList(PortList *list)
+{
+ if(list->last != NULL)
+ {
+ PortNode *aux = list->first;
+ while(1)
+ {
+ printf("%s ",aux->tipo);
+ if(aux->size != 0)
+ {
+ printf("[%d:0] ",(-1 + aux->size));
+ }
+ printf("%s;\n",aux->name);
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+void RegOutputs(PortList *list)
+{
+ if(list->last != NULL)
+ {
+ PortNode *aux = list->first;
+ while(1)
+ {
+ if(strcmp(aux->tipo, (char *)"output")==0)
+ {
+ printf("reg ");
+ if(aux->size != 0)
+ {
+ printf("[%d:0] ",(-1 + aux->size));
+ }
+ printf("%s;\n",aux->name);
+ }
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+void EnumeratePorts(PortList *list)
+{
+ if(list->last != NULL)
+ {
+ PortNode *aux = list->first;
+ while(1)
+ {
+ if(aux->next==NULL)
+ {
+ printf("%s",aux->name);
+ break;
+ }
+ else
+ {
+ printf("%s,",aux->name);
+ aux = aux->next;
+ }
+ }
+ }
+}
+
+void InitializeSignalsList(SignalsList *list)
+{
+ SignalNode *first;
+ first = (SignalNode *)malloc(sizeof(SignalNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertSignal(SignalsList *list, char *name, int size)
+{
+ if(list->last == NULL)
+ {
+ list->first->name = name;
+ list->first->size = size;
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ SignalNode *nuevo;
+ nuevo = (SignalNode *)malloc(sizeof(SignalNode));
+ nuevo->name = name;
+ nuevo->size = size;
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+void ShowSignalsList(SignalsList *list, WritesList *WritesList)
+{
+ if(list->last != NULL)
+ {
+ SignalNode *aux = list->first;
+ while(1)
+ {
+ if(IsWrite(WritesList, aux->name))
+ {
+ printf("reg ");
+ if(aux->size != 0)
+ {
+ printf("[%d:0] ",(-1 + aux->size));
+ }
+ printf("%s;\n",aux->name);
+ }
+ else
+ {
+ printf("wire ");
+ if(aux->size != 0)
+ {
+ printf("[%d:0] ",(-1 + aux->size));
+ }
+ printf("%s;\n",aux->name);
+ }
+
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+/* Decides if a signal is a wire or a reg*/
+int IsWire(char *name, InstancesList *list)
+{
+ InstanceNode *auxinstance = list->first;
+ BindNode *auxbind;
+ if(list->last == NULL)
+ {
+ return 0;
+ }
+ else
+ {
+ while(1)
+ {
+ auxbind = auxinstance->bindslist->first;
+ while(1)
+ {
+ if((strcmp(name, auxbind->namebind)==0))
+ {
+ return 1;
+ }
+ else if(auxbind->next != NULL)
+ {
+ auxbind = auxbind->next;
+ }
+ else
+ {
+ break;
+ }
+ }
+ if(auxinstance->next != NULL)
+ {
+ auxinstance = auxinstance->next;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+void InitializeSensibilityList(SensibilityList *list)
+{
+ SensibilityNode *first;
+ first = (SensibilityNode *)malloc(sizeof(SensibilityNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertSensibility(SensibilityList *list, char *name, char *tipo)
+{
+ if(list->last == NULL)
+ {
+ list->first->name = name;
+ list->first->tipo = tipo;
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ SensibilityNode *nuevo;
+ nuevo = (SensibilityNode *)malloc(sizeof(SensibilityNode));
+ nuevo->name = name;
+ nuevo->tipo = tipo;
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+void ShowSensibilityList(SensibilityList *list)
+{
+ if(list->last != NULL)
+ {
+ SensibilityNode *aux = list->first;
+ while(1)
+ {
+ printf("%s ",aux->tipo);
+ if(aux->next==NULL)
+ {
+ printf("%s",aux->name);
+ break;
+ }
+ else
+ {
+ printf("%s or ",aux->name);
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+
+void InitializeProcessList(ProcessList *list)
+{
+ ProcessNode *first;
+ first = (ProcessNode *)malloc(sizeof(ProcessNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertProcess(ProcessList *list, char *name, SensibilityList *SensibilityList, char *tipo)
+{
+ if(list->last == NULL)
+ {
+ list->first->name = name;
+ list->first->tipo = tipo;
+ list->first->list = SensibilityList;
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ ProcessNode *nuevo;
+ nuevo = (ProcessNode *)malloc(sizeof(ProcessNode));
+ nuevo->name = name;
+ nuevo->tipo = tipo;
+ nuevo->list = SensibilityList;
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+void ShowProcessList(ProcessList *list)
+{
+ if(list->last != NULL)
+ {
+ ProcessNode *aux = list->first;
+ while(1)
+ {
+ printf("%s: always @(", aux->name);
+ ShowSensibilityList(aux->list);
+ printf(")\n");
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+void ShowProcessCode(ProcessList *list)
+{
+ if(list->last != NULL)
+ {
+ ProcessNode *aux = list->first;
+ FILE *archivo;
+ int readok;
+ char *filename;
+ char auxchar;
+
+ while(1)
+ {
+ printf("//%s:\n", aux->name);
+ filename = (char *)malloc(256*sizeof(char));
+ strcpy(filename,aux->name);
+ strcat(filename,(char *)"_regs.sc2v");
+ archivo = fopen(filename,(char *)"r");
+
+ while(1)
+ {
+ readok = fread((void *)&auxchar, sizeof(char), 1, archivo);
+ if(readok)
+ printf("%c",auxchar);
+ else
+ break;
+ }
+
+ fclose(archivo);
+
+ printf("always @(");
+ ShowSensibilityList(aux->list);
+ printf(")\n");
+ strcpy(filename,aux->name);
+ strcat(filename,(char *)".sc2v");
+ archivo = fopen(filename,(char *)"r");
+
+ while(1)
+ {
+ readok = fread((void *)&auxchar, sizeof(char), 1, archivo);
+ if(readok)
+ printf("%c",auxchar);
+ else
+ break;
+ }
+
+ fclose(archivo);
+
+ if(aux->next==NULL)
+ {
+ break;
+ }
+ aux = aux->next;
+ }
+ }
+}
+
+
+void InitializeInstancesList(InstancesList *list)
+{
+ InstanceNode *first;
+ first = (InstanceNode *)malloc(sizeof(InstanceNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertInstance(InstancesList *list, char *nameinstance, char *namemodulo)
+{
+ if(list->last == NULL)
+ {
+ list->first->nameinstance = nameinstance;
+ list->first->namemodulo = namemodulo;
+ list->first->next = NULL;
+ list->last = list->first;
+ list->last->bindslist = (BindsList *)malloc(sizeof(BindsList));
+ list->last->bindslist = (BindsList *)malloc(sizeof(BindsList));
+ InitializeBindsList(list->last->bindslist);
+ }
+ else
+ {
+ InstanceNode *nuevo;
+ nuevo = (InstanceNode *)malloc(sizeof(InstanceNode));
+ nuevo->nameinstance = nameinstance;
+ nuevo->namemodulo = namemodulo;
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ list->last->bindslist = (BindsList *)malloc(sizeof(BindsList));
+ InitializeBindsList(list->last->bindslist);
+ }
+}
+
+void InitializeBindsList(BindsList *list)
+{
+ BindNode *first;
+ first = (BindNode *)malloc(sizeof(BindNode));
+ list->first = first;
+ list->last = NULL;
+}
+
+void InsertBind(BindsList *list, char *nameport, char *namebind)
+{
+ if(list->last == NULL)
+ {
+ list->first->nameport = nameport;
+ list->first->namebind = namebind;
+ list->first->next = NULL;
+ list->last = list->first;
+ }
+ else
+ {
+ BindNode *nuevo;
+ nuevo = (BindNode *)malloc(sizeof(BindNode));
+ nuevo->nameport = nameport;
+ nuevo->namebind = namebind;
+ nuevo->next = NULL;
+ list->last->next = nuevo;
+ list->last = nuevo;
+ }
+}
+
+void ShowInstancedModules(InstancesList *list)
+{
+ if(list->last != NULL)
+ {
+ InstanceNode *auxinstance;
+ auxinstance = list->first;
+ BindNode *auxbind;
+ auxbind = auxinstance->bindslist->first;
+ while(1)
+ {
+ printf("%s %s (",auxinstance->namemodulo, auxinstance->nameinstance);
+ while(1)
+ {
+ printf(".%s(%s)",auxbind->nameport, auxbind->namebind);
+ if(auxbind->next == NULL)
+ {
+ printf(");\n");
+ break;
+ }
+ else
+ {
+ printf(", ");
+ auxbind = auxbind->next;
+ }
+ }
+ if(auxinstance->next == NULL)
+ {
+ break;
+ }
+ else
+ {
+ auxinstance = auxinstance->next;
+ auxbind = auxinstance->bindslist->first;
+ }
+ }
+ }
+}
Index: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile (nonexistent)
+++ trunk/src/Makefile (revision 2)
@@ -0,0 +1,37 @@
+# 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 Library 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.
+
+#
+# Cygwin
+#
+#LEX = flex
+#YACC = bison -y
+#
+# Linux
+#
+LEX = lex
+YACC = yacc
+
+all:
+
+ $(LEX) sc2v_step2.l
+ $(YACC) -d sc2v_step2.y
+ gcc lex.yy.c y.tab.c list.c -Isrc -o ../bin/sc2v_step2
+ $(LEX) sc2v_step1.l
+ $(YACC) -d sc2v_step1.y
+ gcc lex.yy.c y.tab.c list.c -Isrc -o ../bin/sc2v_step1
+
+clean:
+
+ rm -rf lex.* y.* *.o ../bin/sc2v_step2* ../bin/sc2v_step1*
Index: trunk/bin/sc2v.sh
===================================================================
--- trunk/bin/sc2v.sh (nonexistent)
+++ trunk/bin/sc2v.sh (revision 2)
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# script to perform 2 steps of sc2v for input module
+# and remove temporary files
+#
+# usage: sc2v
+#
+../bin/sc2v_step1 < $1.cpp
+../bin/sc2v_step2 < $1.h > $1.v
+\rm *.sc2v
Index: trunk/Makefile
===================================================================
--- trunk/Makefile (nonexistent)
+++ trunk/Makefile (revision 2)
@@ -0,0 +1,27 @@
+# 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 Library 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, MA02111-1307, USA.
+
+LEX = flex
+all:
+ cd src; make all
+
+test:
+ cd src; make all
+ cd examples; ../bin/sc2v.sh rng; ../bin/sc2v.sh md5; echo ""; echo "sc2v translated the following files successfully"; echo ""; ls -l *.v
+
+docs:
+ cd src; doxygen doxygen.cfg
+
+clean:
+ \rm -r docs; cd src; make clean
Index: trunk/README
===================================================================
--- trunk/README (nonexistent)
+++ trunk/README (revision 2)
@@ -0,0 +1,107 @@
+/*
+ * 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 Library 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.
+ */
+
+ Authors:
+
+ Pablo Huerta (phuerta@opensocdesign.com)
+ Javier Castillo (jcastillo@opensocdesign.com)
+
+ Contributors:
+
+ David Moloney
+
+
+
+INSTRUCTIONS OF USE:
+
+1- Compiling the sources:
+
+The sc2v translator is based on lex and yacc tools. You need lex and yacc
+installed before trying to compile sc2v.
+
+For compiling the sources just type "make" under the directory you unzipped the
+fonts. It will generate two executables: sc2v_step1 and sc2v_step2.
+
+
+2- Translating an SystemC module:
+
+The translation is done in two steps. First you must translate the .cpp file by
+typing: sc2v_step1 < file.cpp
+Second step consists in traslating the .h file: sc2v_step2 < file.h > file.v
+
+3- Format and restrictions of the SystemC files:
+
+ - Each module must have a .h file with the declarations of ports,
+ signals, and processes, and there must exist a .cpp file with the code
+ of the processes.
+
+ - For writing to a port or a signal you must ALWAYS use the .write()
+ method.
+
+ - You cannot use functions.
+
+ -Macros with no parameters are supported, but may cause little problems
+ with name of variables. Macros with parameters are not supported.
+
+ -Only data types: bool, sc_int, sc_bigint, sc_uint and sc_biguint are
+ supported.
+
+ -No enumerated types supported.
+
+ -No global variables supported.
+
+4- Known bugs
+
+ -Concatenation is not yet supported. If you use concatenations like:
+ (var1, var2), in the verilog file will appear identically, so you must
+ replace the "(" and ")" by "{" and "}" manually.
+
+ -The usage of macros and defines may cause some errors.
+
+ -Using comments in switch case structures may cause errors. Specially
+ when using structures like:
+
+ case 1: //Comment here
+ case 2:
+ //Or comment here
+ case 3:
+
+ Better write it like this:
+
+ //Comment for 1, 2 and 3
+ case 1:
+ case 2:
+ case 3:
+ instructions . . .
+ instructions . . .
+ instructions . . .
+
+ A general rule would be: "Don't use comments in the same line of case or
+ in the inmediate next line. Use comments in the line before the case
+ statement"
+
+5- For testing the application we recommend to use the systemcdes or the
+systemcmd5 cores, both available at www.opencores.org.
+
+6- For any doubt, comment, or for reporting bugs, feel free to write to
+sc2v@opensocdesign.com
+
+
+TODO:
+
+ - Repair all known bugs.
+ - Make functions supported.
+ - Make macros fully supported.
Index: trunk/examples/md5.cpp
===================================================================
--- trunk/examples/md5.cpp (nonexistent)
+++ trunk/examples/md5.cpp (revision 2)
@@ -0,0 +1,530 @@
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// MD5 main implementation file ////
+//// ////
+//// This file is part of the SystemC MD5 ////
+//// ////
+//// Description: ////
+//// MD5 main implementation file ////
+//// ////
+//// To Do: ////
+//// - done ////
+//// ////
+//// Author(s): ////
+//// - Javier Castillo, jcastilo@opencores.org ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
+//// ////
+//// This source file may be used and distributed without ////
+//// restriction provided that this copyright statement is not ////
+//// removed from the file and that any derivative work contains ////
+//// the original copyright notice and the associated disclaimer. ////
+//// ////
+//// This source file is free software; you can redistribute it ////
+//// and/or modify it under the terms of the GNU Lesser General ////
+//// Public License as published by the Free Software Foundation; ////
+//// either version 2.1 of the License, or (at your option) any ////
+//// later version. ////
+//// ////
+//// This source 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 Lesser General Public License for more ////
+//// details. ////
+//// ////
+//// You should have received a copy of the GNU Lesser General ////
+//// Public License along with this source; if not, download it ////
+//// from http://www.opencores.org/lgpl.shtml ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//
+// CVS Revision History
+//
+// $Log: not supported by cvs2svn $
+// Revision 1.1.1.1 2004/09/08 16:24:49 jcastillo
+// Initial release
+//
+
+#include "md5.h"
+
+
+void
+md5::md5_rom ()
+{
+ switch (round64.read ())
+ {
+ case 0:
+ t.write (0xD76AA478070);
+ break;
+ case 1:
+ t.write (0xE8C7B7560C1);
+ break;
+ case 2:
+ t.write (0x242070DB112);
+ break;
+ case 3:
+ t.write (0xC1BDCEEE163);
+ break;
+ case 4:
+ t.write (0xF57C0FAF074);
+ break;
+ case 5:
+ t.write (0x4787C62A0C5);
+ break;
+ case 6:
+ t.write (0xA8304613116);
+ break;
+ case 7:
+ t.write (0xFD469501167);
+ break;
+ case 8:
+ t.write (0x698098D8078);
+ break;
+ case 9:
+ t.write (0x8B44F7AF0C9);
+ break;
+ case 10:
+ t.write (0xFFFF5BB111A);
+ break;
+ case 11:
+ t.write (0x895CD7BE16B);
+ break;
+ case 12:
+ t.write (0x6B90112207C);
+ break;
+ case 13:
+ t.write (0xFD9871930CD);
+ break;
+ case 14:
+ t.write (0xA679438E11E);
+ break;
+ case 15:
+ t.write (0x49B4082116F);
+ break;
+
+ case 16:
+ t.write (0xf61e2562051);
+ break;
+ case 17:
+ t.write (0xc040b340096);
+ break;
+ case 18:
+ t.write (0x265e5a510EB);
+ break;
+ case 19:
+ t.write (0xe9b6c7aa140);
+ break;
+ case 20:
+ t.write (0xd62f105d055);
+ break;
+ case 21:
+ t.write (0x0244145309A);
+ break;
+ case 22:
+ t.write (0xd8a1e6810EF);
+ break;
+ case 23:
+ t.write (0xe7d3fbc8144);
+ break;
+ case 24:
+ t.write (0x21e1cde6059);
+ break;
+ case 25:
+ t.write (0xc33707d609E);
+ break;
+ case 26:
+ t.write (0xf4d50d870E3);
+ break;
+ case 27:
+ t.write (0x455a14ed148);
+ break;
+ case 28:
+ t.write (0xa9e3e90505D);
+ break;
+ case 29:
+ t.write (0xfcefa3f8092);
+ break;
+ case 30:
+ t.write (0x676f02d90E7);
+ break;
+ case 31:
+ t.write (0x8d2a4c8a14C);
+ break;
+
+ case 32:
+ t.write (0xfffa3942045);
+ break;
+ case 33:
+ t.write (0x8771f6810B8);
+ break;
+ case 34:
+ t.write (0x6d9d612210B);
+ break;
+ case 35:
+ t.write (0xfde5380c17E);
+ break;
+ case 36:
+ t.write (0xa4beea44041);
+ break;
+ case 37:
+ t.write (0x4bdecfa90B4);
+ break;
+ case 38:
+ t.write (0xf6bb4b60107);
+ break;
+ case 39:
+ t.write (0xbebfbc7017A);
+ break;
+ case 40:
+ t.write (0x289b7ec604D);
+ break;
+ case 41:
+ t.write (0xeaa127fa0B0);
+ break;
+ case 42:
+ t.write (0xd4ef3085103);
+ break;
+ case 43:
+ t.write (0x04881d05176);
+ break;
+ case 44:
+ t.write (0xd9d4d039049);
+ break;
+ case 45:
+ t.write (0xe6db99e50BC);
+ break;
+ case 46:
+ t.write (0x1fa27cf810F);
+ break;
+ case 47:
+ t.write (0xc4ac5665172);
+ break;
+
+ case 48:
+ t.write (0xf4292244060);
+ break;
+ case 49:
+ t.write (0x432aff970A7);
+ break;
+ case 50:
+ t.write (0xab9423a70FE);
+ break;
+ case 51:
+ t.write (0xfc93a039155);
+ break;
+ case 52:
+ t.write (0x655b59c306C);
+ break;
+ case 53:
+ t.write (0x8f0ccc920A3);
+ break;
+ case 54:
+ t.write (0xffeff47d0FA);
+ break;
+ case 55:
+ t.write (0x85845dd1151);
+ break;
+ case 56:
+ t.write (0x6fa87e4f068);
+ break;
+ case 57:
+ t.write (0xfe2ce6e00AF);
+ break;
+ case 58:
+ t.write (0xa30143140F6);
+ break;
+ case 59:
+ t.write (0x4e0811a115D);
+ break;
+ case 60:
+ t.write (0xf7537e82064);
+ break;
+ case 61:
+ t.write (0xbd3af2350AB);
+ break;
+ case 62:
+ t.write (0x2ad7d2bb0F2);
+ break;
+ case 63:
+ t.write (0xeb86d391159);
+ break;
+
+ }
+}
+
+
+void
+md5::funcs ()
+{
+ sc_uint < 32 > aux, fr_var, tr_var, rotate1, rotate2;
+ sc_uint < 8 > s_var;
+ sc_uint < 4 > nblock;
+ sc_uint < 32 > message_var[16];
+
+ message_var[0]=message.read().range(511,480);
+ message_var[1]=message.read().range(479,448);
+ message_var[2]=message.read().range(447,416);
+ message_var[3]=message.read().range(415,384);
+ message_var[4]=message.read().range(383,352);
+ message_var[5]=message.read().range(351,320);
+ message_var[6]=message.read().range(319,288);
+ message_var[7]=message.read().range(287,256);
+ message_var[8]=message.read().range(255,224);
+ message_var[9]=message.read().range(223,192);
+ message_var[10]=message.read().range(191,160);
+ message_var[11]=message.read().range(159,128);
+ message_var[12]=message.read().range(127,96);
+ message_var[13]=message.read().range(95,64);
+ message_var[14]=message.read().range(63,32);
+ message_var[15]=message.read().range(31,0);
+
+ fr_var = 0;
+
+ switch (round.read ())
+ {
+ case 0:
+ fr_var = ((br.read () & cr.read ()) | (~br.read () & dr.read ()));
+ break;
+ case 1:
+ fr_var = ((br.read () & dr.read ()) | (cr.read () & (~dr.read ())));
+ break;
+ case 2:
+ fr_var = (br.read () ^ cr.read () ^ dr.read ());
+ break;
+ case 3:
+ fr_var = (cr.read () ^ (br.read () | ~dr.read ()));
+ break;
+ default:
+ break;
+ }
+
+ tr_var = t.read ().range (43, 12);
+ s_var = t.read ().range (11, 4);
+ nblock = t.read ().range (3, 0);
+
+ aux = (ar.read () + fr_var + message_var[(int) nblock] + tr_var);
+
+ //cout << (int)round64.read() << " " << (int)fr_var << " " << (int)aux << " " << (int)nblock << " " << (int)message_var[(int)nblock] << endl;
+
+ rotate1 = aux << (int) s_var;
+ rotate2 = aux >> (int) (32 - s_var);
+ func_out.write (br.read () + (rotate1 | rotate2));
+
+}
+
+void
+md5::round64FSM ()
+{
+
+ next_ar.write (ar.read ());
+ next_br.write (br.read ());
+ next_cr.write (cr.read ());
+ next_dr.write (dr.read ());
+ next_round64.write (round64.read ());
+ next_round.write (round.read ());
+ hash_generated.write (0);
+
+ if (generate_hash.read () != 0)
+ {
+ next_ar.write (dr.read ());
+ next_br.write (func_out.read ());
+ next_cr.write (br.read ());
+ next_dr.write (cr.read ());
+ }
+
+ switch (round64.read ())
+ {
+
+ case 0:
+ next_round.write (0);
+ if (generate_hash.read ())
+ {
+ next_round64.write (1);
+ }
+ break;
+ case 15:
+ case 31:
+ case 47:
+ next_round.write (round.read () + 1);
+ next_round64.write (round64.read () + 1);
+ break;
+ case 63:
+ next_round.write (0);
+ next_round64.write (0);
+ hash_generated.write (1);
+ break;
+ default:
+ next_round64.write (round64.read () + 1);
+ break;
+ }
+
+ if (newtext_i.read ())
+ {
+ next_ar.write (0x67452301);
+ next_br.write (0xEFCDAB89);
+ next_cr.write (0x98BADCFE);
+ next_dr.write (0x10325476);
+ next_round.write (0);
+ next_round64.write (0);
+ }
+
+ if (getdata_state.read () == 0)
+ {
+ next_ar.write (A.read ());
+ next_br.write (B.read ());
+ next_cr.write (C.read ());
+ next_dr.write (D.read ());
+ }
+}
+
+void
+md5::reg_signal ()
+{
+ if (!reset)
+ {
+ ready_o.write (0);
+ data_o.write (0);
+ message.write (0);
+
+ ar.write (0x67452301);
+ br.write (0xEFCDAB89);
+ cr.write (0x98BADCFE);
+ dr.write (0x10325476);
+
+ getdata_state.write (0);
+ generate_hash.write (0);
+
+ round.write (0);
+ round64.write (0);
+
+ A.write (0x67452301);
+ B.write (0xEFCDAB89);
+ C.write (0x98BADCFE);
+ D.write (0x10325476);
+
+ }
+ else
+ {
+ ready_o.write (next_ready_o.read ());
+ data_o.write (next_data_o.read ());
+ message.write (next_message.read ());
+
+ ar.write (next_ar.read ());
+ br.write (next_br.read ());
+ cr.write (next_cr.read ());
+ dr.write (next_dr.read ());
+
+ A.write (next_A.read ());
+ B.write (next_B.read ());
+ C.write (next_C.read ());
+ D.write (next_D.read ());
+
+ generate_hash.write (next_generate_hash.read ());
+ getdata_state.write (next_getdata_state.read ());
+
+ round.write (next_round.read ());
+ round64.write (next_round64.read ());
+
+ }
+
+}
+
+
+void
+md5::md5_getdata ()
+{
+
+ sc_biguint < 128 > data_o_var;
+ sc_biguint < 512 > aux;
+
+ sc_uint < 32 > A_t, B_t, C_t, D_t;
+
+ next_A.write (A.read ());
+ next_B.write (B.read ());
+ next_C.write (C.read ());
+ next_D.write (D.read ());
+
+ next_generate_hash.write (0);
+ next_ready_o.write (0);
+ next_data_o.write (0);
+
+ aux = message.read ();
+ next_message.write (message.read ());
+ next_getdata_state.write (getdata_state.read ());
+
+ if (newtext_i.read ())
+ {
+ next_A.write (0x67452301);
+ next_B.write (0xEFCDAB89);
+ next_C.write (0x98BADCFE);
+ next_D.write (0x10325476);
+ next_getdata_state.write (0);
+ }
+
+ switch (getdata_state.read ())
+ {
+
+ case 0:
+ if (load_i.read ())
+ {
+ aux.range (511, 384) = data_i.read ();
+ next_message.write (aux);
+ next_getdata_state.write (1);
+ }
+ break;
+ case 1:
+ if (load_i.read ())
+ {
+ aux.range (383, 256) = data_i.read ();
+ next_message.write (aux);
+ next_getdata_state.write (2);
+ }
+ break;
+ case 2:
+ if (load_i.read ())
+ {
+ aux.range (255, 128) = data_i.read ();
+ next_message.write (aux);
+ next_getdata_state.write (3);
+ }
+ break;
+ case 3:
+ if (load_i.read ())
+ {
+ aux.range (127, 0) = data_i.read ();
+ next_message.write (aux);
+ next_getdata_state.write (4);
+ next_generate_hash.write (1);
+ }
+ break;
+ case 4:
+ next_generate_hash.write (1);
+
+ A_t = dr.read () + A.read ();
+ B_t = func_out.read () + B.read ();
+ C_t = br.read () + C.read ();
+ D_t = cr.read () + D.read ();
+
+ data_o_var.range (127, 96) = A_t;
+ data_o_var.range (95, 64) = B_t;
+ data_o_var.range (63, 32) = C_t;
+ data_o_var.range (31, 0) = D_t;
+ next_data_o.write (data_o_var);
+
+
+ if (hash_generated.read ())
+ {
+ next_A.write (A_t);
+ next_B.write (B_t);
+ next_C.write (C_t);
+ next_D.write (D_t);
+ next_getdata_state.write (0);
+ next_ready_o.write (1);
+ next_generate_hash.write (0);
+ }
+ break;
+ }
+
+}
Index: trunk/examples/rng.cpp
===================================================================
--- trunk/examples/rng.cpp (nonexistent)
+++ trunk/examples/rng.cpp (revision 2)
@@ -0,0 +1,209 @@
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Random Number Generator Top ////
+//// ////
+//// This file is part of the SystemC RNG project ////
+//// ////
+//// Description: ////
+//// Top file of random number generator ////
+//// ////
+//// To Do: ////
+//// - nothing ////
+//// ////
+//// Author(s): ////
+//// - Javier Castillo, jcastilo@opencores.org ////
+//// ////
+//// This core is provided by OpenSoc ////
+//// http://www.opensocdesign.com ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
+//// ////
+//// This source file may be used and distributed without ////
+//// restriction provided that this copyright statement is not ////
+//// removed from the file and that any derivative work contains ////
+//// the original copyright notice and the associated disclaimer. ////
+//// ////
+//// This source file is free software; you can redistribute it ////
+//// and/or modify it under the terms of the GNU Lesser General ////
+//// Public License as published by the Free Software Foundation; ////
+//// either version 2.1 of the License, or (at your option) any ////
+//// later version. ////
+//// ////
+//// This source 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 Lesser General Public License for more ////
+//// details. ////
+//// ////
+//// You should have received a copy of the GNU Lesser General ////
+//// Public License along with this source; if not, download it ////
+//// from http://www.opencores.org/lgpl.shtml ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//
+// CVS Revision History
+//
+// $Log: not supported by cvs2svn $
+// Revision 1.2 2004/08/30 17:01:50 jcastillo
+// Used indent command
+//
+// Revision 1.1.1.1 2004/08/19 14:27:14 jcastillo
+// First import
+//
+
+#include "rng.h"
+
+void
+rng::combinate ()
+{
+ if (!reset.read ())
+ {
+ number_o.write (0);
+ }
+ else
+ {
+ number_o.write (LFSR_reg.read ().range (31, 0) ^ CASR_reg.read ().range (31, 0));
+ }
+}
+
+void
+rng::LFSR ()
+{
+
+ sc_uint < 43 > LFSR_var;
+ bool outbit;
+
+ if (!reset.read ())
+ {
+ LFSR_reg.write (1);
+ }
+ else
+ {
+ if (loadseed_i.read ())
+ {
+ LFSR_var.range (42, 31) = 0;
+ LFSR_var.range (31, 0) = seed_i.read ();
+ LFSR_reg.write (LFSR_var);
+
+ }
+ else
+ {
+ LFSR_var = LFSR_reg.read ();
+
+ outbit = LFSR_var[42];
+ LFSR_var[42] = LFSR_var[41];
+ LFSR_var[41] = LFSR_var[40] ^ outbit;
+ LFSR_var[40] = LFSR_var[39];
+ LFSR_var[39] = LFSR_var[38];
+ LFSR_var[38] = LFSR_var[37];
+ LFSR_var[37] = LFSR_var[36];
+ LFSR_var[36] = LFSR_var[35];
+ LFSR_var[35] = LFSR_var[34];
+ LFSR_var[34] = LFSR_var[33];
+ LFSR_var[33] = LFSR_var[32];
+ LFSR_var[32] = LFSR_var[31];
+ LFSR_var[31] = LFSR_var[30];
+ LFSR_var[30] = LFSR_var[29];
+ LFSR_var[29] = LFSR_var[28];
+ LFSR_var[28] = LFSR_var[27];
+ LFSR_var[27] = LFSR_var[26];
+ LFSR_var[26] = LFSR_var[25];
+ LFSR_var[25] = LFSR_var[24];
+ LFSR_var[24] = LFSR_var[23];
+ LFSR_var[23] = LFSR_var[22];
+ LFSR_var[22] = LFSR_var[21];
+ LFSR_var[21] = LFSR_var[20];
+ LFSR_var[20] = LFSR_var[19] ^ outbit;
+ LFSR_var[19] = LFSR_var[18];
+ LFSR_var[18] = LFSR_var[17];
+ LFSR_var[17] = LFSR_var[16];
+ LFSR_var[16] = LFSR_var[15];
+ LFSR_var[15] = LFSR_var[14];
+ LFSR_var[14] = LFSR_var[13];
+ LFSR_var[13] = LFSR_var[12];
+ LFSR_var[12] = LFSR_var[11];
+ LFSR_var[11] = LFSR_var[10];
+ LFSR_var[10] = LFSR_var[9];
+ LFSR_var[9] = LFSR_var[8];
+ LFSR_var[8] = LFSR_var[7];
+ LFSR_var[7] = LFSR_var[6];
+ LFSR_var[6] = LFSR_var[5];
+ LFSR_var[5] = LFSR_var[4];
+ LFSR_var[4] = LFSR_var[3];
+ LFSR_var[3] = LFSR_var[2];
+ LFSR_var[2] = LFSR_var[1];
+ LFSR_var[1] = LFSR_var[0] ^ outbit;
+ LFSR_var[0] = LFSR_var[42];
+
+ LFSR_reg.write (LFSR_var);
+ }
+ }
+}
+
+void
+rng::CASR ()
+{
+
+ sc_uint < 43 > CASR_var, CASR_out;
+
+ if (!reset.read ())
+ {
+ CASR_reg.write (1);
+ }
+ else
+ {
+ if (loadseed_i.read ())
+ {
+ CASR_var.range (36, 31) = 0;
+ CASR_var.range (31, 0) = seed_i.read ();
+ CASR_reg.write (CASR_var);
+
+ }
+ else
+ {
+ CASR_var = CASR_reg.read ();
+
+ CASR_out[36] = CASR_var[35] ^ CASR_var[0];
+ CASR_out[35] = CASR_var[34] ^ CASR_var[36];
+ CASR_out[34] = CASR_var[33] ^ CASR_var[35];
+ CASR_out[33] = CASR_var[32] ^ CASR_var[34];
+ CASR_out[32] = CASR_var[31] ^ CASR_var[33];
+ CASR_out[31] = CASR_var[30] ^ CASR_var[32];
+ CASR_out[30] = CASR_var[29] ^ CASR_var[31];
+ CASR_out[29] = CASR_var[28] ^ CASR_var[30];
+ CASR_out[28] = CASR_var[27] ^ CASR_var[29];
+ CASR_out[27] = CASR_var[26] ^ CASR_var[28];
+ CASR_out[26] = CASR_var[25] ^ CASR_var[27];
+ CASR_out[25] = CASR_var[24] ^ CASR_var[26];
+ CASR_out[24] = CASR_var[23] ^ CASR_var[25];
+ CASR_out[23] = CASR_var[22] ^ CASR_var[24];
+ CASR_out[22] = CASR_var[21] ^ CASR_var[23];
+ CASR_out[21] = CASR_var[20] ^ CASR_var[22];
+ CASR_out[20] = CASR_var[19] ^ CASR_var[21];
+ CASR_out[19] = CASR_var[18] ^ CASR_var[20];
+ CASR_out[18] = CASR_var[17] ^ CASR_var[19];
+ CASR_out[17] = CASR_var[16] ^ CASR_var[18];
+ CASR_out[16] = CASR_var[15] ^ CASR_var[17];
+ CASR_out[15] = CASR_var[14] ^ CASR_var[16];
+ CASR_out[14] = CASR_var[13] ^ CASR_var[15];
+ CASR_out[13] = CASR_var[12] ^ CASR_var[14];
+ CASR_out[12] = CASR_var[11] ^ CASR_var[13];
+ CASR_out[11] = CASR_var[10] ^ CASR_var[12];
+ CASR_out[10] = CASR_var[9] ^ CASR_var[11];
+ CASR_out[9] = CASR_var[8] ^ CASR_var[10];
+ CASR_out[8] = CASR_var[7] ^ CASR_var[9];
+ CASR_out[7] = CASR_var[6] ^ CASR_var[8];
+ CASR_out[6] = CASR_var[5] ^ CASR_var[7];
+ CASR_out[5] = CASR_var[4] ^ CASR_var[6];
+ CASR_out[4] = CASR_var[3] ^ CASR_var[5];
+ CASR_out[3] = CASR_var[2] ^ CASR_var[4];
+ CASR_out[2] = CASR_var[1] ^ CASR_var[3];
+ CASR_out[1] = CASR_var[0] ^ CASR_var[2];
+ CASR_out[0] = CASR_var[36] ^ CASR_var[1];
+
+ CASR_reg.write (CASR_out);
+ }
+ }
+}
Index: trunk/examples/md5.v
===================================================================
--- trunk/examples/md5.v (nonexistent)
+++ trunk/examples/md5.v (revision 2)
@@ -0,0 +1,679 @@
+module md5(clk,reset,load_i,ready_o,newtext_i,data_i,data_o);
+input clk;
+input reset;
+input load_i;
+output ready_o;
+input newtext_i;
+input [127:0] data_i;
+output [127:0] data_o;
+
+reg ready_o;
+reg [127:0] data_o;
+
+reg [31:0] ar;
+reg [31:0] br;
+reg [31:0] cr;
+reg [31:0] dr;
+reg [31:0] next_ar;
+reg [31:0] next_br;
+reg [31:0] next_cr;
+reg [31:0] next_dr;
+reg [31:0] A;
+reg [31:0] B;
+reg [31:0] C;
+reg [31:0] D;
+reg [31:0] next_A;
+reg [31:0] next_B;
+reg [31:0] next_C;
+reg [31:0] next_D;
+reg next_ready_o;
+reg [127:0] next_data_o;
+reg [511:0] message;
+reg [511:0] next_message;
+reg generate_hash;
+reg hash_generated;
+reg next_generate_hash;
+reg [2:0] getdata_state;
+reg [2:0] next_getdata_state;
+reg [1:0] round;
+reg [1:0] next_round;
+reg [5:0] round64;
+reg [5:0] next_round64;
+reg [43:0] t;
+reg [31:0] func_out;
+
+
+//reg_signal:
+always @(posedge clk or negedge reset)
+
+ begin
+
+ if (!reset )
+
+ begin
+
+ ready_o = (0);
+ data_o = (0);
+ message = (0);
+
+ ar = ('h67452301);
+ br = ('hEFCDAB89 );
+ cr = ('h98BADCFE );
+ dr = ('h10325476);
+
+ getdata_state = (0);
+ generate_hash = (0);
+
+ round = (0);
+ round64 = (0);
+
+ A = ('h67452301);
+ B = ('hEFCDAB89 );
+ C = ('h98BADCFE );
+ D = ('h10325476);
+
+
+ end
+
+ else
+
+ begin
+
+ ready_o = (next_ready_o );
+ data_o = (next_data_o );
+ message = (next_message );
+
+ ar = (next_ar );
+ br = (next_br );
+ cr = (next_cr );
+ dr = (next_dr );
+
+ A = (next_A );
+ B = (next_B );
+ C = (next_C );
+ D = (next_D );
+
+ generate_hash = (next_generate_hash );
+ getdata_state = (next_getdata_state );
+
+ round = (next_round );
+ round64 = (next_round64 );
+
+
+ end
+
+
+
+ end
+//md5_getdata:
+reg[127:0] data_o_varmd5_getdata;
+reg[511:0] auxmd5_getdata;
+reg[31:0] A_tmd5_getdata,B_tmd5_getdata,C_tmd5_getdata,D_tmd5_getdata;
+always @( newtext_i or data_i or load_i or getdata_state or hash_generated or message or func_out or A or B or C or D or ar or br or cr or dr or generate_hash)
+
+ begin
+
+
+
+
+
+
+
+ next_A = (A );
+ next_B = (B );
+ next_C = (C );
+ next_D = (D );
+
+ next_generate_hash = (0);
+ next_ready_o = (0);
+ next_data_o = (0);
+
+ auxmd5_getdata =message ;
+ next_message = (message );
+ next_getdata_state = (getdata_state );
+
+ if (newtext_i )
+
+ begin
+
+ next_A = ('h67452301);
+ next_B = ('hEFCDAB89 );
+ next_C = ('h98BADCFE );
+ next_D = ('h10325476);
+ next_getdata_state = (0);
+
+ end
+
+
+
+ case( getdata_state )
+
+
+ 0 :
+ begin
+ if (load_i )
+
+ begin
+
+ auxmd5_getdata [511:384]=data_i ;
+ next_message = (auxmd5_getdata );
+ next_getdata_state = (1);
+
+ end
+
+ end
+ 1 :
+ begin
+ if (load_i )
+
+ begin
+
+ auxmd5_getdata [383:256]=data_i ;
+ next_message = (auxmd5_getdata );
+ next_getdata_state = (2);
+
+ end
+
+ end
+ 2 :
+ begin
+ if (load_i )
+
+ begin
+
+ auxmd5_getdata [255:128]=data_i ;
+ next_message = (auxmd5_getdata );
+ next_getdata_state = (3);
+
+ end
+
+ end
+ 3 :
+ begin
+ if (load_i )
+
+ begin
+
+ auxmd5_getdata [127:0]=data_i ;
+ next_message = (auxmd5_getdata );
+ next_getdata_state = (4);
+ next_generate_hash = (1);
+
+ end
+
+ end
+ 4 :
+ begin
+ next_generate_hash = (1);
+
+ A_tmd5_getdata =dr +A ;
+ B_tmd5_getdata =func_out +B ;
+ C_tmd5_getdata =br +C ;
+ D_tmd5_getdata =cr +D ;
+
+ data_o_varmd5_getdata [127:96]=A_tmd5_getdata ;
+ data_o_varmd5_getdata [95:64]=B_tmd5_getdata ;
+ data_o_varmd5_getdata [63:32]=C_tmd5_getdata ;
+ data_o_varmd5_getdata [31:0]=D_tmd5_getdata ;
+ next_data_o = (data_o_varmd5_getdata );
+
+
+ if (hash_generated )
+
+ begin
+
+ next_A = (A_tmd5_getdata );
+ next_B = (B_tmd5_getdata );
+ next_C = (C_tmd5_getdata );
+ next_D = (D_tmd5_getdata );
+ next_getdata_state = (0);
+ next_ready_o = (1);
+ next_generate_hash = (0);
+
+ end
+
+ end
+
+ endcase
+
+
+
+ end
+//round64FSM:
+always @( newtext_i or round or round64 or ar or br or cr or dr or generate_hash or func_out or getdata_state or A or B or C or D)
+
+ begin
+
+
+ next_ar = (ar );
+ next_br = (br );
+ next_cr = (cr );
+ next_dr = (dr );
+ next_round64 = (round64 );
+ next_round = (round );
+ hash_generated = (0);
+
+ if (generate_hash !=0)
+
+ begin
+
+ next_ar = (dr );
+ next_br = (func_out );
+ next_cr = (br );
+ next_dr = (cr );
+
+ end
+
+
+
+ case( round64 )
+
+
+ 0 :
+ begin
+ next_round = (0);
+ if (generate_hash )
+
+ begin
+
+ next_round64 = (1);
+
+ end
+
+ end
+ 15 , 31 , 47 :
+ begin
+ next_round = (round +1);
+ next_round64 = (round64 +1);
+ end
+ 63 :
+ begin
+ next_round = (0);
+ next_round64 = (0);
+ hash_generated = (1);
+ end
+ default:
+ begin
+
+ next_round64 = (round64 +1);
+ end
+
+ endcase
+
+
+ if (newtext_i )
+
+ begin
+
+ next_ar = ('h67452301);
+ next_br = ('hEFCDAB89 );
+ next_cr = ('h98BADCFE );
+ next_dr = ('h10325476);
+ next_round = (0);
+ next_round64 = (0);
+
+ end
+
+
+ if (getdata_state ==0)
+
+ begin
+
+ next_ar = (A );
+ next_br = (B );
+ next_cr = (C );
+ next_dr = (D );
+
+ end
+
+
+ end
+//md5_rom:
+always @( round64)
+
+ begin
+
+
+ case( round64 )
+
+ 0 :
+ begin
+ t = ('hD76AA478070 );
+ end
+ 1 :
+ begin
+ t = ('hE8C7B7560C1 );
+ end
+ 2 :
+ begin
+ t = ('h242070DB112 );
+ end
+ 3 :
+ begin
+ t = ('hC1BDCEEE163 );
+ end
+ 4 :
+ begin
+ t = ('hF57C0FAF074 );
+ end
+ 5 :
+ begin
+ t = ('h4787C62A0C5 );
+ end
+ 6 :
+ begin
+ t = ('hA8304613116 );
+ end
+ 7 :
+ begin
+ t = ('hFD469501167 );
+ end
+ 8 :
+ begin
+ t = ('h698098D8078 );
+ end
+ 9 :
+ begin
+ t = ('h8B44F7AF0C9 );
+ end
+ 10 :
+ begin
+ t = ('hFFFF5BB111A );
+ end
+ 11 :
+ begin
+ t = ('h895CD7BE16B );
+ end
+ 12 :
+ begin
+ t = ('h6B90112207C );
+ end
+ 13 :
+ begin
+ t = ('hFD9871930CD );
+ end
+ 14 :
+ begin
+ t = ('hA679438E11E );
+ end
+ 15 :
+ begin
+ t = ('h49B4082116F );
+ end
+
+ 16 :
+ begin
+ t = ('hf61e2562051 );
+ end
+ 17 :
+ begin
+ t = ('hc040b340096 );
+ end
+ 18 :
+ begin
+ t = ('h265e5a510EB );
+ end
+ 19 :
+ begin
+ t = ('he9b6c7aa140 );
+ end
+ 20 :
+ begin
+ t = ('hd62f105d055 );
+ end
+ 21 :
+ begin
+ t = ('h244145309A );
+ end
+ 22 :
+ begin
+ t = ('hd8a1e6810EF );
+ end
+ 23 :
+ begin
+ t = ('he7d3fbc8144 );
+ end
+ 24 :
+ begin
+ t = ('h21e1cde6059 );
+ end
+ 25 :
+ begin
+ t = ('hc33707d609E );
+ end
+ 26 :
+ begin
+ t = ('hf4d50d870E3 );
+ end
+ 27 :
+ begin
+ t = ('h455a14ed148 );
+ end
+ 28 :
+ begin
+ t = ('ha9e3e90505D );
+ end
+ 29 :
+ begin
+ t = ('hfcefa3f8092 );
+ end
+ 30 :
+ begin
+ t = ('h676f02d90E7 );
+ end
+ 31 :
+ begin
+ t = ('h8d2a4c8a14C );
+ end
+
+ 32 :
+ begin
+ t = ('hfffa3942045 );
+ end
+ 33 :
+ begin
+ t = ('h8771f6810B8 );
+ end
+ 34 :
+ begin
+ t = ('h6d9d612210B );
+ end
+ 35 :
+ begin
+ t = ('hfde5380c17E );
+ end
+ 36 :
+ begin
+ t = ('ha4beea44041 );
+ end
+ 37 :
+ begin
+ t = ('h4bdecfa90B4 );
+ end
+ 38 :
+ begin
+ t = ('hf6bb4b60107 );
+ end
+ 39 :
+ begin
+ t = ('hbebfbc7017A );
+ end
+ 40 :
+ begin
+ t = ('h289b7ec604D );
+ end
+ 41 :
+ begin
+ t = ('heaa127fa0B0 );
+ end
+ 42 :
+ begin
+ t = ('hd4ef3085103 );
+ end
+ 43 :
+ begin
+ t = ('h4881d05176 );
+ end
+ 44 :
+ begin
+ t = ('hd9d4d039049 );
+ end
+ 45 :
+ begin
+ t = ('he6db99e50BC );
+ end
+ 46 :
+ begin
+ t = ('h1fa27cf810F );
+ end
+ 47 :
+ begin
+ t = ('hc4ac5665172 );
+ end
+
+ 48 :
+ begin
+ t = ('hf4292244060 );
+ end
+ 49 :
+ begin
+ t = ('h432aff970A7 );
+ end
+ 50 :
+ begin
+ t = ('hab9423a70FE );
+ end
+ 51 :
+ begin
+ t = ('hfc93a039155 );
+ end
+ 52 :
+ begin
+ t = ('h655b59c306C );
+ end
+ 53 :
+ begin
+ t = ('h8f0ccc920A3 );
+ end
+ 54 :
+ begin
+ t = ('hffeff47d0FA );
+ end
+ 55 :
+ begin
+ t = ('h85845dd1151 );
+ end
+ 56 :
+ begin
+ t = ('h6fa87e4f068 );
+ end
+ 57 :
+ begin
+ t = ('hfe2ce6e00AF );
+ end
+ 58 :
+ begin
+ t = ('ha30143140F6 );
+ end
+ 59 :
+ begin
+ t = ('h4e0811a115D );
+ end
+ 60 :
+ begin
+ t = ('hf7537e82064 );
+ end
+ 61 :
+ begin
+ t = ('hbd3af2350AB );
+ end
+ 62 :
+ begin
+ t = ('h2ad7d2bb0F2 );
+ end
+ 63 :
+ begin
+ t = ('heb86d391159 );
+ end
+
+
+ endcase
+
+
+ end
+//funcs:
+reg[31:0] auxfuncs,fr_varfuncs,tr_varfuncs,rotate1funcs,rotate2funcs;
+reg[7:0] s_varfuncs;
+reg[3:0] nblockfuncs;
+reg[31:0] message_varfuncs[15:0];
+always @( t or ar or br or cr or dr or round or message or func_out)
+
+ begin
+
+
+
+
+
+
+ message_varfuncs [0]=message [511:480];
+ message_varfuncs [1]=message [479:448];
+ message_varfuncs [2]=message [447:416];
+ message_varfuncs [3]=message [415:384];
+ message_varfuncs [4]=message [383:352];
+ message_varfuncs [5]=message [351:320];
+ message_varfuncs [6]=message [319:288];
+ message_varfuncs [7]=message [287:256];
+ message_varfuncs [8]=message [255:224];
+ message_varfuncs [9]=message [223:192];
+ message_varfuncs [10]=message [191:160];
+ message_varfuncs [11]=message [159:128];
+ message_varfuncs [12]=message [127:96];
+ message_varfuncs [13]=message [95:64];
+ message_varfuncs [14]=message [63:32];
+ message_varfuncs [15]=message [31:0];
+
+ fr_varfuncs =0;
+
+
+ case( round )
+
+ 0 :
+ begin
+ fr_varfuncs =((br &cr )|(~br &dr ));
+ end
+ 1 :
+ begin
+ fr_varfuncs =((br &dr )|(cr &(~dr )));
+ end
+ 2 :
+ begin
+ fr_varfuncs =(br ^cr ^dr );
+ end
+ 3 :
+ begin
+ fr_varfuncs =(cr ^(br |~dr ));
+ end
+ default:
+ begin
+
+ end
+
+ endcase
+
+
+ tr_varfuncs =t [43:12];
+ s_varfuncs =t [11:4];
+ nblockfuncs =t [3:0];
+
+ auxfuncs =(ar +fr_varfuncs +message_varfuncs [nblockfuncs ]+tr_varfuncs );
+
+// cout <>(32-s_varfuncs );
+ func_out = (br +(rotate1funcs |rotate2funcs ));
+
+
+ end
+
+endmodule
Index: trunk/examples/rng.v
===================================================================
--- trunk/examples/rng.v (nonexistent)
+++ trunk/examples/rng.v (revision 2)
@@ -0,0 +1,217 @@
+module rng(clk,reset,loadseed_i,seed_i,number_o);
+input clk;
+input reset;
+input loadseed_i;
+input [31:0] seed_i;
+output [31:0] number_o;
+
+reg [31:0] number_o;
+
+reg [42:0] LFSR_reg;
+reg [36:0] CASR_reg;
+
+
+//CASR:
+reg[42:0] CASR_varCASR,CASR_outCASR;
+always @(posedge clk or negedge reset)
+
+ begin
+
+
+
+
+ if (!reset )
+
+ begin
+
+ CASR_reg = (1);
+
+ end
+
+ else
+
+ begin
+
+ if (loadseed_i )
+
+ begin
+
+ CASR_varCASR [36:31]=0;
+ CASR_varCASR [31:0]=seed_i ;
+ CASR_reg = (CASR_varCASR );
+
+
+ end
+
+ else
+
+ begin
+
+ CASR_varCASR =CASR_reg ;
+
+ CASR_outCASR [36]=CASR_varCASR [35]^CASR_varCASR [0];
+ CASR_outCASR [35]=CASR_varCASR [34]^CASR_varCASR [36];
+ CASR_outCASR [34]=CASR_varCASR [33]^CASR_varCASR [35];
+ CASR_outCASR [33]=CASR_varCASR [32]^CASR_varCASR [34];
+ CASR_outCASR [32]=CASR_varCASR [31]^CASR_varCASR [33];
+ CASR_outCASR [31]=CASR_varCASR [30]^CASR_varCASR [32];
+ CASR_outCASR [30]=CASR_varCASR [29]^CASR_varCASR [31];
+ CASR_outCASR [29]=CASR_varCASR [28]^CASR_varCASR [30];
+ CASR_outCASR [28]=CASR_varCASR [27]^CASR_varCASR [29];
+ CASR_outCASR [27]=CASR_varCASR [26]^CASR_varCASR [28];
+ CASR_outCASR [26]=CASR_varCASR [25]^CASR_varCASR [27];
+ CASR_outCASR [25]=CASR_varCASR [24]^CASR_varCASR [26];
+ CASR_outCASR [24]=CASR_varCASR [23]^CASR_varCASR [25];
+ CASR_outCASR [23]=CASR_varCASR [22]^CASR_varCASR [24];
+ CASR_outCASR [22]=CASR_varCASR [21]^CASR_varCASR [23];
+ CASR_outCASR [21]=CASR_varCASR [20]^CASR_varCASR [22];
+ CASR_outCASR [20]=CASR_varCASR [19]^CASR_varCASR [21];
+ CASR_outCASR [19]=CASR_varCASR [18]^CASR_varCASR [20];
+ CASR_outCASR [18]=CASR_varCASR [17]^CASR_varCASR [19];
+ CASR_outCASR [17]=CASR_varCASR [16]^CASR_varCASR [18];
+ CASR_outCASR [16]=CASR_varCASR [15]^CASR_varCASR [17];
+ CASR_outCASR [15]=CASR_varCASR [14]^CASR_varCASR [16];
+ CASR_outCASR [14]=CASR_varCASR [13]^CASR_varCASR [15];
+ CASR_outCASR [13]=CASR_varCASR [12]^CASR_varCASR [14];
+ CASR_outCASR [12]=CASR_varCASR [11]^CASR_varCASR [13];
+ CASR_outCASR [11]=CASR_varCASR [10]^CASR_varCASR [12];
+ CASR_outCASR [10]=CASR_varCASR [9]^CASR_varCASR [11];
+ CASR_outCASR [9]=CASR_varCASR [8]^CASR_varCASR [10];
+ CASR_outCASR [8]=CASR_varCASR [7]^CASR_varCASR [9];
+ CASR_outCASR [7]=CASR_varCASR [6]^CASR_varCASR [8];
+ CASR_outCASR [6]=CASR_varCASR [5]^CASR_varCASR [7];
+ CASR_outCASR [5]=CASR_varCASR [4]^CASR_varCASR [6];
+ CASR_outCASR [4]=CASR_varCASR [3]^CASR_varCASR [5];
+ CASR_outCASR [3]=CASR_varCASR [2]^CASR_varCASR [4];
+ CASR_outCASR [2]=CASR_varCASR [1]^CASR_varCASR [3];
+ CASR_outCASR [1]=CASR_varCASR [0]^CASR_varCASR [2];
+ CASR_outCASR [0]=CASR_varCASR [36]^CASR_varCASR [1];
+
+ CASR_reg = (CASR_outCASR );
+
+ end
+
+
+ end
+
+
+ end
+//LFSR:
+reg[42:0] LFSR_varLFSR;
+reg outbitLFSR;
+always @(posedge clk or negedge reset)
+
+ begin
+
+
+
+
+
+ if (!reset )
+
+ begin
+
+ LFSR_reg = (1);
+
+ end
+
+ else
+
+ begin
+
+ if (loadseed_i )
+
+ begin
+
+ LFSR_varLFSR [42:31]=0;
+ LFSR_varLFSR [31:0]=seed_i ;
+ LFSR_reg = (LFSR_varLFSR );
+
+
+ end
+
+ else
+
+ begin
+
+ LFSR_varLFSR =LFSR_reg ;
+
+ outbitLFSR =LFSR_varLFSR [42];
+ LFSR_varLFSR [42]=LFSR_varLFSR [41];
+ LFSR_varLFSR [41]=LFSR_varLFSR [40]^outbitLFSR ;
+ LFSR_varLFSR [40]=LFSR_varLFSR [39];
+ LFSR_varLFSR [39]=LFSR_varLFSR [38];
+ LFSR_varLFSR [38]=LFSR_varLFSR [37];
+ LFSR_varLFSR [37]=LFSR_varLFSR [36];
+ LFSR_varLFSR [36]=LFSR_varLFSR [35];
+ LFSR_varLFSR [35]=LFSR_varLFSR [34];
+ LFSR_varLFSR [34]=LFSR_varLFSR [33];
+ LFSR_varLFSR [33]=LFSR_varLFSR [32];
+ LFSR_varLFSR [32]=LFSR_varLFSR [31];
+ LFSR_varLFSR [31]=LFSR_varLFSR [30];
+ LFSR_varLFSR [30]=LFSR_varLFSR [29];
+ LFSR_varLFSR [29]=LFSR_varLFSR [28];
+ LFSR_varLFSR [28]=LFSR_varLFSR [27];
+ LFSR_varLFSR [27]=LFSR_varLFSR [26];
+ LFSR_varLFSR [26]=LFSR_varLFSR [25];
+ LFSR_varLFSR [25]=LFSR_varLFSR [24];
+ LFSR_varLFSR [24]=LFSR_varLFSR [23];
+ LFSR_varLFSR [23]=LFSR_varLFSR [22];
+ LFSR_varLFSR [22]=LFSR_varLFSR [21];
+ LFSR_varLFSR [21]=LFSR_varLFSR [20];
+ LFSR_varLFSR [20]=LFSR_varLFSR [19]^outbitLFSR ;
+ LFSR_varLFSR [19]=LFSR_varLFSR [18];
+ LFSR_varLFSR [18]=LFSR_varLFSR [17];
+ LFSR_varLFSR [17]=LFSR_varLFSR [16];
+ LFSR_varLFSR [16]=LFSR_varLFSR [15];
+ LFSR_varLFSR [15]=LFSR_varLFSR [14];
+ LFSR_varLFSR [14]=LFSR_varLFSR [13];
+ LFSR_varLFSR [13]=LFSR_varLFSR [12];
+ LFSR_varLFSR [12]=LFSR_varLFSR [11];
+ LFSR_varLFSR [11]=LFSR_varLFSR [10];
+ LFSR_varLFSR [10]=LFSR_varLFSR [9];
+ LFSR_varLFSR [9]=LFSR_varLFSR [8];
+ LFSR_varLFSR [8]=LFSR_varLFSR [7];
+ LFSR_varLFSR [7]=LFSR_varLFSR [6];
+ LFSR_varLFSR [6]=LFSR_varLFSR [5];
+ LFSR_varLFSR [5]=LFSR_varLFSR [4];
+ LFSR_varLFSR [4]=LFSR_varLFSR [3];
+ LFSR_varLFSR [3]=LFSR_varLFSR [2];
+ LFSR_varLFSR [2]=LFSR_varLFSR [1];
+ LFSR_varLFSR [1]=LFSR_varLFSR [0]^outbitLFSR ;
+ LFSR_varLFSR [0]=LFSR_varLFSR [42];
+
+ LFSR_reg = (LFSR_varLFSR );
+
+ end
+
+
+ end
+
+
+ end
+//combinate:
+always @(posedge clk or negedge reset)
+
+ begin
+
+ if (!reset )
+
+ begin
+
+ number_o = (0);
+
+ end
+
+ else
+
+ begin
+
+ number_o = (LFSR_reg [31:0]^CASR_reg [31:0]);
+
+ end
+
+
+ end
+
+endmodule
Index: trunk/examples/md5.h
===================================================================
--- trunk/examples/md5.h (nonexistent)
+++ trunk/examples/md5.h (revision 2)
@@ -0,0 +1,121 @@
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// MD5 header ////
+//// ////
+//// This file is part of the SystemC MD5 ////
+//// ////
+//// Description: ////
+//// MD5 top file header ////
+//// ////
+//// To Do: ////
+//// - done ////
+//// ////
+//// Author(s): ////
+//// - Javier Castillo, jcastilo@opencores.org ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
+//// ////
+//// This source file may be used and distributed without ////
+//// restriction provided that this copyright statement is not ////
+//// removed from the file and that any derivative work contains ////
+//// the original copyright notice and the associated disclaimer. ////
+//// ////
+//// This source file is free software; you can redistribute it ////
+//// and/or modify it under the terms of the GNU Lesser General ////
+//// Public License as published by the Free Software Foundation; ////
+//// either version 2.1 of the License, or (at your option) any ////
+//// later version. ////
+//// ////
+//// This source 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 Lesser General Public License for more ////
+//// details. ////
+//// ////
+//// You should have received a copy of the GNU Lesser General ////
+//// Public License along with this source; if not, download it ////
+//// from http://www.opencores.org/lgpl.shtml ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//
+// CVS Revision History
+//
+// $Log: not supported by cvs2svn $
+// Revision 1.1.1.1 2004/09/08 16:24:49 jcastillo
+// Initial release
+//
+
+#include "systemc.h"
+
+SC_MODULE (md5)
+{
+
+ sc_in < bool > clk;
+ sc_in < bool > reset;
+
+ sc_in < bool > load_i;
+ sc_out < bool > ready_o;
+ sc_in < bool > newtext_i;
+
+
+ //Input must be padded and in little endian mode
+ sc_in < sc_biguint < 128 > >data_i;
+ sc_out < sc_biguint < 128 > >data_o;
+
+
+ //Signals
+ sc_signal < sc_uint < 32 > >ar, br, cr, dr;
+ sc_signal < sc_uint < 32 > >next_ar, next_br, next_cr, next_dr;
+ sc_signal < sc_uint < 32 > >A, B, C, D;
+ sc_signal < sc_uint < 32 > >next_A, next_B, next_C, next_D;
+
+ sc_signal < bool > next_ready_o;
+ sc_signal < sc_biguint < 128 > >next_data_o;
+
+ sc_signal < sc_biguint < 512 > >message, next_message;
+ sc_signal < bool > generate_hash, hash_generated, next_generate_hash;
+
+ sc_signal < sc_uint < 3 > >getdata_state, next_getdata_state;
+
+ sc_signal < sc_uint < 2 > >round, next_round;
+ sc_signal < sc_uint < 6 > >round64, next_round64;
+
+ sc_signal < sc_uint < 44 > >t;
+
+ sc_signal < sc_uint < 32 > >func_out;
+
+ void md5_getdata ();
+ void reg_signal ();
+ void round64FSM ();
+ void md5_rom ();
+ void funcs ();
+
+ SC_CTOR (md5)
+ {
+
+ SC_METHOD (reg_signal);
+ sensitive_pos << clk;
+ sensitive_neg << reset;
+
+ SC_METHOD (md5_getdata);
+ sensitive << newtext_i << data_i << load_i << getdata_state <<
+ hash_generated << message;
+ sensitive << func_out << A << B << C << D << ar << br << cr << dr <<
+ generate_hash;
+
+ SC_METHOD (round64FSM);
+ sensitive << newtext_i << round << round64 << ar << br << cr << dr <<
+ generate_hash << func_out;
+ sensitive << getdata_state << A << B << C << D;
+
+
+ SC_METHOD (md5_rom);
+ sensitive << round64;
+
+ SC_METHOD (funcs);
+ sensitive << t << ar << br << cr << dr << round << message << func_out;
+
+ }
+};
Index: trunk/examples/rng.h
===================================================================
--- trunk/examples/rng.h (nonexistent)
+++ trunk/examples/rng.h (revision 2)
@@ -0,0 +1,91 @@
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Random Number Generator Top Header ////
+//// ////
+//// This file is part of the SystemC RNG project ////
+//// ////
+//// Description: ////
+//// Top file of random number generator ////
+//// ////
+//// To Do: ////
+//// - nothing ////
+//// ////
+//// Author(s): ////
+//// - Javier Castillo, jcastilo@opencores.org ////
+//// ////
+//// This core is provided by OpenSoc ////
+//// http://www.opensocdesign.com ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
+//// ////
+//// This source file may be used and distributed without ////
+//// restriction provided that this copyright statement is not ////
+//// removed from the file and that any derivative work contains ////
+//// the original copyright notice and the associated disclaimer. ////
+//// ////
+//// This source file is free software; you can redistribute it ////
+//// and/or modify it under the terms of the GNU Lesser General ////
+//// Public License as published by the Free Software Foundation; ////
+//// either version 2.1 of the License, or (at your option) any ////
+//// later version. ////
+//// ////
+//// This source 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 Lesser General Public License for more ////
+//// details. ////
+//// ////
+//// You should have received a copy of the GNU Lesser General ////
+//// Public License along with this source; if not, download it ////
+//// from http://www.opencores.org/lgpl.shtml ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//
+// CVS Revision History
+//
+// $Log: not supported by cvs2svn $
+// Revision 1.2 2004/08/30 17:01:50 jcastillo
+// Used indent command
+//
+// Revision 1.1.1.1 2004/08/19 14:27:14 jcastillo
+// First import
+//
+#include "systemc.h"
+
+SC_MODULE (rng)
+{
+
+ sc_in < bool > clk;
+ sc_in < bool > reset;
+
+ sc_in < bool > loadseed_i;
+ sc_in < sc_uint < 32 > >seed_i;
+
+ sc_out < sc_uint < 32 > >number_o;
+
+ sc_signal < sc_uint < 43 > >LFSR_reg;
+ sc_signal < sc_uint < 37 > >CASR_reg;
+
+ void CASR ();
+ void LFSR ();
+ void combinate ();
+
+ SC_CTOR (rng)
+ {
+
+ SC_METHOD (CASR);
+ sensitive_pos << clk;
+ sensitive_neg << reset;
+
+ SC_METHOD (LFSR);
+ sensitive_pos << clk;
+ sensitive_neg << reset;
+
+ SC_METHOD (combinate);
+ sensitive_pos << clk;
+ sensitive_neg << reset;
+
+ }
+};