URL
https://opencores.org/ocsvn/pavr/pavr/trunk
Subversion Repositories pavr
Compare Revisions
- This comparison shows the changes necessary to convert path
/pavr/trunk/tools/build_vhdl_test
- from Rev 4 to Rev 6
- ↔ Reverse comparison
Rev 4 → Rev 6
/clean.bat
0,0 → 1,9
del .\*.exe |
del .\*.obj |
del .\*.tds |
del *~ |
del *.vhd |
del *.bin |
del *.bpr |
del *.bpf |
del *.dsk |
clean.bat
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: projman.tcl
===================================================================
--- projman.tcl (nonexistent)
+++ projman.tcl (revision 6)
@@ -0,0 +1,2 @@
+source ../common/projman.tcl
+wm title . "VHDL test generation tool"
Index: run.bat
===================================================================
--- run.bat (nonexistent)
+++ run.bat (revision 6)
@@ -0,0 +1,47 @@
+echo off
+
+set crtdir=%cd%
+set pavrdir=..\..\
+set testdir=%pavrdir%test\
+set buildvhdltestdir=%pavrdir%tools\build_vhdl_test\
+set srcdir=%pavrdir%src\
+
+rem rem General test ------------------
+rem echo Building general test...
+rem cd %testdir%gentest\
+rem del test.bin
+rem call compile.bat
+rem echo Copying binary file...
+rem copy test.bin %buildvhdltestdir%
+rem rem -------------------------------
+
+rem rem Sieve of Eratoshthenes ------------
+rem echo Building Sieve of Eratosthenes test...
+rem cd %testdir%sieve\
+rem del test.bin
+rem call gcccompile.bat
+rem echo Copying binary file...
+rem copy test.bin %buildvhdltestdir%
+rem rem -----------------------------------
+
+rem Waves -----------------------------
+echo Building Waves test...
+cd %testdir%waves\
+ del test.bin
+ call gcccompile.bat
+echo Copying binary file...
+copy test.bin %buildvhdltestdir%
+rem -----------------------------------
+
+cd %buildvhdltestdir%
+echo Copying VHDL source file...
+copy %srcdir%test_pavr.vhd %buildvhdltestdir%
+
+echo Building VHDL source test file...
+build_vhdl_test.exe test_pavr.vhd test.bin
+
+echo Overwriting the original VHDL source test file...
+copy test_pavr.vhd %srcdir%
+
+echo Changing to initial directory...
+cd %crtdir%
run.bat
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: edit.bat
===================================================================
--- edit.bat (nonexistent)
+++ edit.bat (revision 6)
@@ -0,0 +1 @@
+textpad build_vhdl_test.c
\ No newline at end of file
edit.bat
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: build_vhdl_test.c
===================================================================
--- build_vhdl_test.c (nonexistent)
+++ build_vhdl_test.c (revision 6)
@@ -0,0 +1,98 @@
+#include
+#include
+#include
+#include
+#include
+#include "../common/tagScan.h"
+
+#define TAG_CLK_CNT_BEGIN "-- "
+#define TAG_CLK_CNT_END "-- "
+#define TAG_INSTRUCTIONS_BEGIN "-- "
+#define TAG_INSTRUCTIONS_END "-- "
+
+#define CLK_OFFSET 100
+//#define K1 " if std_logic_vector_to_nat(cnt)<"
+//#define K2 " then\n"
+#define K3 " when "
+#define K4 " => tmpv1 := pm_setup("
+#define K5 ", 16#"
+#define K6 "#);\n"
+
+
+
+int main(int argc, char * argv[]) {
+ FILE *fStr1;
+ scanTag_t stag;
+ long int pos1, pos2;
+ char *tStr1, *tStr2;
+ int instr;
+ int addr;
+
+ if (argc > 2)
+ {
+ scanTag_t_construct(&stag);
+
+ fStr1 = fopen(argv[2], "rb");
+ if (fStr1 != NULL)
+ {
+ fseek(fStr1, 0L, SEEK_SET);
+ pos1 = ftell(fStr1);
+ fseek(fStr1, 0L, SEEK_END);
+ pos2 = ftell(fStr1);
+
+ tStr1 = (char *) malloc(10+2);
+ tStr2 = (char *) malloc(10+2);
+ sprintf(tStr2, "%li", CLK_OFFSET+(pos2-pos1)/2);
+ strcpy(tStr1, "\n");
+ //strcat(tStr1, K1);
+ strcat(tStr1, tStr2);
+ strcat(tStr1, "\n");
+ //strcat(tStr1, K2);
+
+ // Scan VHDL source and modify the paragraph tagged by `-- ' `-- '.
+ scanTag_t_writeTaggedText(TAG_CLK_CNT_BEGIN, TAG_CLK_CNT_END, tStr1, argv[1], &stag);
+
+ free(tStr1);
+ tStr1 = (char *) malloc((pos2-pos1)*(sizeof(K3)+10+sizeof(K4)+10+sizeof(K5)+10+sizeof(K6))+2);
+ strcpy(tStr1, "\n");
+ fseek(fStr1, 0L, SEEK_SET);
+ addr = 0;
+ while (feof(fStr1) == 0)
+ {
+ fread(&instr, 2, 1, fStr1);
+ if (feof(fStr1) == 0)
+ {
+ strcat(tStr1, K3);
+ sprintf(tStr2, "%i", addr+CLK_OFFSET);
+ strcat(tStr1, tStr2);
+ strcat(tStr1, K4);
+ sprintf(tStr2, "%i", addr);
+ strcat(tStr1, tStr2);
+ strcat(tStr1, K5);
+ sprintf(tStr2, "%04x", instr);
+ strcat(tStr1, tStr2);
+ strcat(tStr1, K6);
+ addr++;
+ }
+ }
+
+ // Scan VHDL source and modify the paragraph tagged by `-- ' `-- '.
+ scanTag_t_writeTaggedText(TAG_INSTRUCTIONS_BEGIN, TAG_INSTRUCTIONS_END, tStr1, argv[1], &stag);
+ free(tStr1);
+ free(tStr2);
+ }
+ else
+ {
+ exit(1);
+ }
+
+
+ fprintf(stdout, "%s\n", scanTag_t_getStatus(&stag));
+ scanTag_t_destruct(&stag);
+ }
+ else
+ {
+ fprintf(stderr, "Usage: this_executable.exe src.vhd prog.bin\n");
+ }
+ return 0;
+}
Index: compile.bat
===================================================================
--- compile.bat (nonexistent)
+++ compile.bat (revision 6)
@@ -0,0 +1 @@
+bcc32 build_vhdl_test.c ../common/tagScan.c
\ No newline at end of file
compile.bat
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property