From 40fb20955179c2f897f6d1c8447de214e22cdd0b Mon Sep 17 00:00:00 2001 From: Wolfgang Spraul Date: Thu, 16 Aug 2012 12:18:14 +0200 Subject: [PATCH] added bit2fp stub --- bit2fp.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bit2fp.c diff --git a/bit2fp.c b/bit2fp.c new file mode 100644 index 0000000..84a1881 --- /dev/null +++ b/bit2fp.c @@ -0,0 +1,42 @@ +// +// Author: Wolfgang Spraul +// +// This is free and unencumbered software released into the public domain. +// For details see the UNLICENSE file at the root of the source tree. +// + +#include "model.h" +#include "floorplan.h" +#include "bits.h" + +int main(int argc, char** argv) +{ + struct fpga_model model; + FILE* fbits; + int rc = -1; + + if (argc != 3) { + fprintf(stderr, + "\n" + "%s - bitstream to floorplan\n" + "Usage: %s \n" + "\n", argv[0], argv[0]); + goto fail; + } + + fbits = fopen(argv[1], "r"); + if (!fbits) { + fprintf(stderr, "Error opening %s.\n", argv[1]); + goto fail; + } + + if ((rc = fpga_build_model(&model, XC6SLX9_ROWS, XC6SLX9_COLUMNS, + XC6SLX9_LEFT_WIRING, XC6SLX9_RIGHT_WIRING))) + goto fail; + + if ((rc = read_bits(&model, fbits))) goto fail; + if ((rc = write_floorplan(stdout, &model))) goto fail; + return EXIT_SUCCESS; +fail: + return rc; +}