autotest stub

This commit is contained in:
Wolfgang Spraul 2012-08-17 12:12:39 +02:00
parent 3be3d504d2
commit 5ac4354c67
7 changed files with 39 additions and 13 deletions

View File

@ -42,7 +42,7 @@ bits.o: bits.c bits.h model.h
control.o: control.c control.h model.h
draw_svg_tiles: draw_svg_tiles.o $(MODEL_OBJ) helper.o
draw_svg_tiles: draw_svg_tiles.o $(MODEL_OBJ) helper.o control.o
draw_svg_tiles.o: draw_svg_tiles.c model.h helper.h

View File

@ -164,10 +164,8 @@ int main(int argc, char** argv)
rc = fpga_set_lut(&model, logic_dev, D6_LUT, "A3", ZTERM);
if (rc) FAIL();
#if 0
rc = diff_printf(&tstate);
if (rc) goto fail;
#endif
printf("P46 I pinw %s\n", P46_dev->iob.pinw_out_I);
for (i = 0;; i++) {

View File

@ -1,3 +1,14 @@
#!/bin/bash
diff -U 0 $1 $2 > ${2%.*}.fp_diff || true
diff -U 0 $1 $2 > ${2%.*}.fp_diff
./fp2bit $2 ${2%.*}.f2b || exit $?
./bit2fp --bits-only ${2%.*}.f2b > ${2%.*}.b2f || exit $?
if [ "$1" == "/dev/null" ]
then
diff -U 0 /dev/null ${2%.*}.b2f > ${2%.*}.b2f_diff
else
diff -U 0 ${1%.*}.b2f ${2%.*}.b2f > ${2%.*}.b2f_diff
fi
cat ${2%.*}.fp_diff | sed -e '/^--- /d;/^+++ /d;/^@@ /d' > ${2%.*}.diff
cat ${2%.*}.b2f_diff | sed -e '/^--- /d;/^+++ /d;/^@@ /d' >> ${2%.*}.diff

View File

@ -12,21 +12,28 @@
int main(int argc, char** argv)
{
struct fpga_model model;
FILE* fbits;
int rc = -1;
FILE* fbits = 0;
int bits_only, file_arg, rc = -1;
if (argc != 3) {
if (argc < 2) {
fprintf(stderr,
"\n"
"%s - bitstream to floorplan\n"
"Usage: %s <bitstream_file>\n"
"Usage: %s [--bits-only] <bitstream_file>\n"
"\n", argv[0], argv[0]);
goto fail;
}
fbits = fopen(argv[1], "r");
bits_only = 0;
file_arg = 1;
if (!strcmp(argv[1], "--bits-only")) {
bits_only = 1;
file_arg = 2;
}
fbits = fopen(argv[file_arg], "r");
if (!fbits) {
fprintf(stderr, "Error opening %s.\n", argv[1]);
fprintf(stderr, "Error opening %s.\n", argv[file_arg]);
goto fail;
}
@ -35,8 +42,11 @@ int main(int argc, char** argv)
goto fail;
if ((rc = read_bits(&model, fbits))) goto fail;
if ((rc = write_floorplan(stdout, &model))) goto fail;
if ((rc = write_floorplan(stdout, &model,
bits_only ? FP_BITS_ONLY : FP_BITS_DEFAULT))) goto fail;
fclose(fbits);
return EXIT_SUCCESS;
fail:
if (fbits) fclose(fbits);
return rc;
}

View File

@ -758,7 +758,9 @@ next_line: ;
return 0;
}
int write_floorplan(FILE* f, struct fpga_model* model)
int write_floorplan(FILE* f, struct fpga_model* model, int flags)
{
if (!(flags & FP_BITS_ONLY))
printf_version(f);
return 0;
}

View File

@ -25,7 +25,9 @@
//
int read_floorplan(struct fpga_model* model, FILE* f);
int write_floorplan(FILE* f, struct fpga_model* model);
#define FP_BITS_DEFAULT 0x0000
#define FP_BITS_ONLY 0x0001
int write_floorplan(FILE* f, struct fpga_model* model, int flags);
void printf_version(FILE* f);
int printf_tiles(FILE* f, struct fpga_model* model);

View File

@ -15,6 +15,7 @@ int main(int argc, char** argv)
FILE* fp, *fbits;
int rc = -1;
fbits = 0;
if (argc != 3) {
fprintf(stderr,
"\n"
@ -45,7 +46,9 @@ int main(int argc, char** argv)
if ((rc = read_floorplan(&model, fp))) goto fail;
if ((rc = write_bits(fbits, &model))) goto fail;
fclose(fbits);
return EXIT_SUCCESS;
fail:
if (fbits) fclose(fbits);
return rc;
}