Warning: Permanently added '172.25.94.142' (ECDSA) to the list of known hosts. Running: /usr/bin/copr-rpmbuild --verbose --drop-resultdir --build-id 870521 --chroot fedora-rawhide-i386 --detached default Version: 0.24 Task: {'build_id': 870521, 'buildroot_pkgs': [], 'chroot': 'fedora-rawhide-i386', 'enable_net': False, 'fetch_sources_only': True, 'git_hash': '53781bf8e4ecb68b444386534ff077a315d5fb94', 'git_repo': 'lkundrak/varia/icestorm', 'memory_reqs': 2048, 'package_name': 'icestorm', 'package_version': '0-0.7.20190311gitfa1c932.fc31', 'project_dirname': 'varia', 'project_name': 'varia', 'project_owner': 'lkundrak', 'repos': [{'baseurl': 'https://copr-be.cloud.fedoraproject.org/results/lkundrak/varia/fedora-rawhide-i386/', 'id': 'copr_base', 'name': 'Copr repository'}], 'source_json': {'clone_url': 'https://copr-dist-git.fedorainfracloud.org/git/lkundrak/varia/icestorm.git', 'committish': '53781bf8e4ecb68b444386534ff077a315d5fb94'}, 'source_type': 8, 'submitter': 'lkundrak', 'task_id': '870521-fedora-rawhide-i386', 'timeout': 64800, 'use_bootstrap_container': False, 'with_opts': [], 'without_opts': []} Running: git clone https://copr-dist-git.fedorainfracloud.org/git/lkundrak/varia/icestorm.git /tmp/tmpk4lt5jnq/icestorm --depth 500 --no-single-branch cmd: ['git', 'clone', 'https://copr-dist-git.fedorainfracloud.org/git/lkundrak/varia/icestorm.git', '/tmp/tmpk4lt5jnq/icestorm', '--depth', '500', '--no-single-branch'] cwd: . rc: 0 stdout: stderr: Cloning into '/tmp/tmpk4lt5jnq/icestorm'... Running: git checkout 53781bf8e4ecb68b444386534ff077a315d5fb94 cmd: ['git', 'checkout', '53781bf8e4ecb68b444386534ff077a315d5fb94'] cwd: /tmp/tmpk4lt5jnq/icestorm rc: 0 stdout: stderr: Note: checking out '53781bf8e4ecb68b444386534ff077a315d5fb94'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b HEAD is now at 53781bf automatic import of icestorm Running: cp -r . /tmp/tmpgwpoikld cmd: ['cp', '-r', '.', '/tmp/tmpgwpoikld'] cwd: /tmp/tmpk4lt5jnq/icestorm rc: 0 stdout: stderr: Generated rpkg config: [rpkg] preprocess_spec = True # auto-packing is deprecated: auto_pack = True [git] lookaside = https://copr-dist-git.fedorainfracloud.org/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s anongiturl = https://copr-dist-git.fedorainfracloud.org/git/%(module)s Writing config into /tmp/tmpk4lt5jnq/.config/rpkg.conf Running: rpkg -C /tmp/tmpk4lt5jnq/.config/rpkg.conf sources --outdir /tmp/tmpgwpoikld cmd: ['rpkg', '-C', '/tmp/tmpk4lt5jnq/.config/rpkg.conf', 'sources', '--outdir', '/tmp/tmpgwpoikld'] cwd: /tmp/tmpk4lt5jnq/icestorm rc: 0 stdout: Downloading icestorm-fa1c932.tar.gz from lookaside cache at copr-dist-git.fedorainfracloud.org stderr: /usr/bin/tail: /var/lib/copr-rpmbuild/main.log: file truncated Running (timeout=64800): unbuffer /usr/bin/mock --buildsrpm --spec /tmp/tmpgwpoikld/icestorm.spec --sources /tmp/tmpgwpoikld --configdir /var/lib/copr-rpmbuild/results/configs --resultdir /var/lib/copr-rpmbuild/results --define '%_disable_source_fetch 0' --uniqueext 1552997133.472221 -r child WARNING: Could not find required logging config file: /var/lib/copr-rpmbuild/results/configs/logging.ini. Using default... INFO: mock.py version 1.4.14 starting (python version = 3.6.5)... Start: init plugins INFO: tmpfs initialized INFO: selinux disabled INFO: chroot_scan: initialized INFO: compress_logs: initialized Finish: init plugins Start: run INFO: Start(/tmp/tmpgwpoikld/icestorm.spec) Config(870521-fedora-rawhide-i386) Start: clean chroot Finish: clean chroot Start: chroot init INFO: mounting tmpfs at /var/lib/mock/870521-fedora-rawhide-i386-1552997133.472221/root. INFO: calling preinit hooks INFO: enabled root cache INFO: enabled HW Info plugin Mock Version: 1.4.14 INFO: Mock Version: 1.4.14 Start: dnf install 'Copr repository' 562 kB/s | 63 kB 00:00 fedora 47 MB/s | 55 MB 00:01 Last metadata expiration check: 0:00:00 ago on Tue 19 Mar 2019 12:05:39 PM UTC. Dependencies resolved. ================================================================================ Group Packages ================================================================================ Marking packages as installed by the group: @Buildsystem building group gawk glibc-minimal-langpack xz diffutils rpm-build bzip2 grep cpio which fedora-release bash unzip sed util-linux make tar patch redhat-rpm-config info gzip findutils coreutils shadow-utils ================================================================================ Package Arch Version Repository Size ================================================================================ Installing group packages: bash i686 5.0.2-1.fc30 fedora 1.7 M bzip2 i686 1.0.6-29.fc30 fedora 50 k coreutils i686 8.31-1.fc31 fedora 1.3 M cpio i686 2.12-10.fc30 fedora 255 k diffutils i686 3.7-2.fc30 fedora 395 k fedora-release noarch 31-0.1 fedora 10 k findutils i686 1:4.6.0-22.fc30 fedora 515 k gawk i686 4.2.1-6.fc30 fedora 1.1 M glibc-minimal-langpack i686 2.29.9000-6.fc31 fedora 54 k grep i686 3.1-9.fc30 fedora 256 k gzip i686 1.9-8.fc30 fedora 153 k info i686 6.6-1.fc30 fedora 220 k make i686 1:4.2.1-13.fc30 fedora 490 k patch i686 2.7.6-9.fc31 fedora 138 k redhat-rpm-config noarch 128-1.fc30 fedora 60 k rpm-build i686 4.14.2.1-4.fc30.1 fedora 114 k sed i686 4.5-3.fc30 fedora 289 k shadow-utils i686 2:4.6-9.fc31 fedora 1.1 M tar i686 2:1.32-1.fc31 fedora 889 k unzip i686 6.0-43.fc30 fedora 175 k util-linux i686 2.33.1-4.fc31 fedora 2.4 M which i686 2.21-14.fc30 fedora 41 k xz i686 5.2.4-5.fc30 fedora 148 k Installing dependencies: alternatives i686 1.11-4.fc31 fedora 34 k audit-libs i686 3.0-0.6.20181218gitbdb72c0.fc30 fedora 112 k basesystem noarch 11-7.fc30 fedora 6.9 k binutils i686 2.32-9.fc31 fedora 6.0 M binutils-gold i686 2.32-9.fc31 fedora 820 k boost-regex i686 1.69.0-6.fc30 fedora 312 k brotli i686 1.0.7-3.fc30 fedora 313 k bzip2-libs i686 1.0.6-29.fc30 fedora 38 k ca-certificates noarch 2018.2.26-3.fc30 fedora 385 k coreutils-common i686 8.31-1.fc31 fedora 2.0 M cracklib i686 2.9.6-19.fc30 fedora 77 k crypto-policies noarch 20190211-2.gite3eacfc.fc30 fedora 51 k ctags i686 5.8-25.fc30 fedora 163 k curl i686 7.64.0-4.fc31 fedora 324 k cyrus-sasl-lib i686 2.1.27-0.6rc7.fc30 fedora 97 k dwz i686 0.12-10.fc30 fedora 105 k efi-srpm-macros noarch 4-2.fc30 fedora 23 k elfutils i686 0.176-1.fc30 fedora 309 k elfutils-default-yama-scope noarch 0.176-1.fc30 fedora 16 k elfutils-libelf i686 0.176-1.fc30 fedora 184 k elfutils-libs i686 0.176-1.fc30 fedora 297 k expat i686 2.2.6-2.fc30 fedora 94 k fedora-gpg-keys noarch 31-0.2 fedora 102 k fedora-release-common noarch 31-0.1 fedora 18 k fedora-repos noarch 31-0.2 fedora 9.2 k fedora-repos-rawhide noarch 31-0.2 fedora 8.4 k file i686 5.36-2.fc31 fedora 49 k file-libs i686 5.36-2.fc31 fedora 552 k filesystem i686 3.10-1.fc30 fedora 1.1 M fpc-srpm-macros noarch 1.2-1.fc31 fedora 7.5 k gc i686 7.6.4-5.fc30 fedora 97 k gdb-headless i686 8.3.50.20190304-1.fc31 fedora 3.7 M gdbm-libs i686 1:1.18-4.fc30 fedora 53 k ghc-srpm-macros noarch 1.4.2-9.fc30 fedora 7.6 k glib2 i686 2.60.0-3.fc31 fedora 2.6 M glibc i686 2.29.9000-6.fc31 fedora 3.7 M glibc-common i686 2.29.9000-6.fc31 fedora 826 k gmp i686 1:6.1.2-10.fc31 fedora 259 k gnat-srpm-macros noarch 4-9.fc30 fedora 8.5 k go-srpm-macros noarch 2-19.fc30 fedora 11 k guile22 i686 2.2.4-3.fc30 fedora 6.5 M keyutils-libs i686 1.6-2.fc30 fedora 30 k krb5-libs i686 1.17-6.fc31 fedora 769 k libacl i686 2.2.53-3.fc30 fedora 25 k libarchive i686 3.3.3-4.fc31 fedora 381 k libatomic_ops i686 7.6.10-1.fc31 fedora 34 k libattr i686 2.4.48-5.fc30 fedora 17 k libbabeltrace i686 1.5.6-2.fc30 fedora 208 k libblkid i686 2.33.1-4.fc31 fedora 161 k libcap i686 2.26-5.fc30 fedora 47 k libcap-ng i686 0.7.9-7.fc31 fedora 27 k libcom_err i686 1.45.0-1.fc31 fedora 27 k libcurl i686 7.64.0-4.fc31 fedora 282 k libdb i686 5.3.28-37.fc30 fedora 809 k libdb-utils i686 5.3.28-37.fc30 fedora 135 k libfdisk i686 2.33.1-4.fc31 fedora 213 k libffi i686 3.1-19.fc30 fedora 30 k libgcc i686 9.0.1-0.10.fc30 fedora 89 k libgcrypt i686 1.8.4-3.fc30 fedora 416 k libgpg-error i686 1.33-2.fc30 fedora 244 k libicu i686 63.1-2.fc30 fedora 9.1 M libidn2 i686 2.1.1a-1.fc30 fedora 90 k libipt i686 2.0-2.fc30 fedora 61 k libmetalink i686 0.1.3-8.fc30 fedora 30 k libmount i686 2.33.1-4.fc31 fedora 181 k libnghttp2 i686 1.37.0-1.fc31 fedora 77 k libnsl2 i686 1.2.0-4.20180605git4a062cf.fc30 fedora 57 k libpkgconf i686 1.6.0-1.fc30 fedora 36 k libpsl i686 0.20.2-6.fc30 fedora 58 k libpwquality i686 1.4.0-12.fc30 fedora 97 k libselinux i686 2.9-0.rc2.1.fc31 fedora 85 k libsemanage i686 2.9-0.rc2.1.fc31 fedora 122 k libsepol i686 2.9-0.rc2.1.fc31 fedora 308 k libsigsegv i686 2.11-7.fc30 fedora 25 k libsmartcols i686 2.33.1-4.fc31 fedora 115 k libssh i686 0.8.7-1.fc31 fedora 230 k libstdc++ i686 9.0.1-0.10.fc30 fedora 609 k libtasn1 i686 4.13-7.fc30 fedora 71 k libtirpc i686 1.1.4-2.rc2.fc30.1 fedora 105 k libtool-ltdl i686 2.4.6-29.fc30 fedora 36 k libunistring i686 0.9.10-5.fc30 fedora 423 k libutempter i686 1.1.6-16.fc30 fedora 24 k libuuid i686 2.33.1-4.fc31 fedora 27 k libverto i686 0.3.0-7.fc30 fedora 21 k libxcrypt i686 4.4.4-2.fc31 fedora 126 k libxml2 i686 2.9.9-2.fc30 fedora 696 k libzstd i686 1.3.8-2.fc30 fedora 251 k lua-libs i686 5.3.5-5.fc30 fedora 119 k lz4-libs i686 1.8.3-2.fc30 fedora 61 k mpfr i686 3.1.6-4.fc30 fedora 220 k ncurses i686 6.1-10.20180923.fc30 fedora 363 k ncurses-base noarch 6.1-10.20180923.fc30 fedora 59 k ncurses-libs i686 6.1-10.20180923.fc30 fedora 308 k nim-srpm-macros noarch 1-4.fc30 fedora 8.1 k ocaml-srpm-macros noarch 5-5.fc30 fedora 7.7 k openblas-srpm-macros noarch 2-5.fc30 fedora 7.3 k openldap i686 2.4.47-1.fc30 fedora 298 k openssl-libs i686 1:1.1.1b-3.fc31 fedora 1.3 M p11-kit i686 0.23.15-3.fc30 fedora 237 k p11-kit-trust i686 0.23.15-3.fc30 fedora 129 k pam i686 1.3.1-17.fc30 fedora 643 k pcre i686 8.43-1.fc31 fedora 186 k pcre2 i686 10.33-0.3.RC1.fc31 fedora 252 k perl-srpm-macros noarch 1-29.fc30 fedora 8.2 k pkgconf i686 1.6.0-1.fc30 fedora 38 k pkgconf-m4 noarch 1.6.0-1.fc30 fedora 15 k pkgconf-pkg-config i686 1.6.0-1.fc30 fedora 11 k popt i686 1.16-17.fc30 fedora 57 k publicsuffix-list-dafsa noarch 20190128-2.fc30 fedora 54 k python-pip-wheel noarch 19.0.3-1.fc31 fedora 1.1 M python-setuptools-wheel noarch 40.8.0-1.fc30 fedora 279 k python-srpm-macros noarch 3-42.fc30 fedora 11 k python3-libs i686 3.7.2-7.fc30 fedora 7.8 M qt5-srpm-macros noarch 5.12.1-1.fc31 fedora 9.1 k readline i686 8.0-2.fc30 fedora 198 k rpm i686 4.14.2.1-4.fc30.1 fedora 485 k rpm-build-libs i686 4.14.2.1-4.fc30.1 fedora 100 k rpm-libs i686 4.14.2.1-4.fc30.1 fedora 299 k rust-srpm-macros noarch 6-4.fc30 fedora 9.0 k setup noarch 2.13.2-1.fc31 fedora 149 k source-highlight i686 3.1.8-23.fc31 fedora 679 k sqlite-libs i686 3.27.2-3.fc31 fedora 580 k systemd-libs i686 241-2.gita09c170.fc31 fedora 507 k tzdata noarch 2018i-2.fc30 fedora 424 k xz-libs i686 5.2.4-5.fc30 fedora 92 k zip i686 3.0-24.fc30 fedora 271 k zlib i686 1.2.11-15.fc30 fedora 91 k zstd i686 1.3.8-2.fc30 fedora 365 k Transaction Summary ================================================================================ Install 151 Packages Total download size: 78 M Installed size: 328 M Downloading Packages: (1/151): diffutils-3.7-2.fc30.i686.rpm 8.0 MB/s | 395 kB 00:00 (2/151): gawk-4.2.1-6.fc30.i686.rpm 20 MB/s | 1.1 MB 00:00 (3/151): shadow-utils-4.6-9.fc31.i686.rpm 18 MB/s | 1.1 MB 00:00 (4/151): gzip-1.9-8.fc30.i686.rpm 7.6 MB/s | 153 kB 00:00 (5/151): make-4.2.1-13.fc30.i686.rpm 17 MB/s | 490 kB 00:00 (6/151): redhat-rpm-config-128-1.fc30.noarch.rp 6.7 MB/s | 60 kB 00:00 (7/151): glibc-minimal-langpack-2.29.9000-6.fc3 5.9 MB/s | 54 kB 00:00 (8/151): util-linux-2.33.1-4.fc31.i686.rpm 30 MB/s | 2.4 MB 00:00 (9/151): findutils-4.6.0-22.fc30.i686.rpm 18 MB/s | 515 kB 00:00 (10/151): fedora-release-31-0.1.noarch.rpm 1.7 MB/s | 10 kB 00:00 (11/151): rpm-build-4.14.2.1-4.fc30.1.i686.rpm 15 MB/s | 114 kB 00:00 (12/151): sed-4.5-3.fc30.i686.rpm 24 MB/s | 289 kB 00:00 (13/151): grep-3.1-9.fc30.i686.rpm 25 MB/s | 256 kB 00:00 (14/151): which-2.21-14.fc30.i686.rpm 4.7 MB/s | 41 kB 00:00 (15/151): patch-2.7.6-9.fc31.i686.rpm 11 MB/s | 138 kB 00:00 (16/151): bash-5.0.2-1.fc30.i686.rpm 13 MB/s | 1.7 MB 00:00 (17/151): info-6.6-1.fc30.i686.rpm 8.1 MB/s | 220 kB 00:00 (18/151): tar-1.32-1.fc31.i686.rpm 19 MB/s | 889 kB 00:00 (19/151): unzip-6.0-43.fc30.i686.rpm 11 MB/s | 175 kB 00:00 (20/151): cpio-2.12-10.fc30.i686.rpm 15 MB/s | 255 kB 00:00 (21/151): bzip2-1.0.6-29.fc30.i686.rpm 5.2 MB/s | 50 kB 00:00 (22/151): xz-5.2.4-5.fc30.i686.rpm 7.8 MB/s | 148 kB 00:00 (23/151): coreutils-8.31-1.fc31.i686.rpm 29 MB/s | 1.3 MB 00:00 (24/151): gmp-6.1.2-10.fc31.i686.rpm 16 MB/s | 259 kB 00:00 (25/151): filesystem-3.10-1.fc30.i686.rpm 20 MB/s | 1.1 MB 00:00 (26/151): libsigsegv-2.11-7.fc30.i686.rpm 2.3 MB/s | 25 kB 00:00 (27/151): mpfr-3.1.6-4.fc30.i686.rpm 22 MB/s | 220 kB 00:00 (28/151): readline-8.0-2.fc30.i686.rpm 17 MB/s | 198 kB 00:00 (29/151): libacl-2.2.53-3.fc30.i686.rpm 3.1 MB/s | 25 kB 00:00 (30/151): audit-libs-3.0-0.6.20181218gitbdb72c0 7.6 MB/s | 112 kB 00:00 (31/151): libattr-2.4.48-5.fc30.i686.rpm 2.6 MB/s | 17 kB 00:00 (32/151): libselinux-2.9-0.rc2.1.fc31.i686.rpm 10 MB/s | 85 kB 00:00 (33/151): libsemanage-2.9-0.rc2.1.fc31.i686.rpm 13 MB/s | 122 kB 00:00 (34/151): libxcrypt-4.4.4-2.fc31.i686.rpm 13 MB/s | 126 kB 00:00 (35/151): setup-2.13.2-1.fc31.noarch.rpm 17 MB/s | 149 kB 00:00 (36/151): libcap-ng-0.7.9-7.fc31.i686.rpm 2.4 MB/s | 27 kB 00:00 (37/151): libblkid-2.33.1-4.fc31.i686.rpm 7.3 MB/s | 161 kB 00:00 (38/151): libfdisk-2.33.1-4.fc31.i686.rpm 16 MB/s | 213 kB 00:00 (39/151): glibc-2.29.9000-6.fc31.i686.rpm 27 MB/s | 3.7 MB 00:00 (40/151): libsmartcols-2.33.1-4.fc31.i686.rpm 5.3 MB/s | 115 kB 00:00 (41/151): libmount-2.33.1-4.fc31.i686.rpm 5.2 MB/s | 181 kB 00:00 (42/151): libutempter-1.1.6-16.fc30.i686.rpm 2.6 MB/s | 24 kB 00:00 (43/151): libuuid-2.33.1-4.fc31.i686.rpm 1.9 MB/s | 27 kB 00:00 (44/151): ncurses-libs-6.1-10.20180923.fc30.i68 13 MB/s | 308 kB 00:00 (45/151): pam-1.3.1-17.fc30.i686.rpm 22 MB/s | 643 kB 00:00 (46/151): zlib-1.2.11-15.fc30.i686.rpm 11 MB/s | 91 kB 00:00 (47/151): systemd-libs-241-2.gita09c170.fc31.i6 16 MB/s | 507 kB 00:00 (48/151): dwz-0.12-10.fc30.i686.rpm 12 MB/s | 105 kB 00:00 (49/151): efi-srpm-macros-4-2.fc30.noarch.rpm 4.2 MB/s | 23 kB 00:00 (50/151): file-5.36-2.fc31.i686.rpm 7.7 MB/s | 49 kB 00:00 (51/151): fpc-srpm-macros-1.2-1.fc31.noarch.rpm 1.1 MB/s | 7.5 kB 00:00 (52/151): gnat-srpm-macros-4-9.fc30.noarch.rpm 1.2 MB/s | 8.5 kB 00:00 (53/151): ghc-srpm-macros-1.4.2-9.fc30.noarch.r 625 kB/s | 7.6 kB 00:00 (54/151): go-srpm-macros-2-19.fc30.noarch.rpm 2.0 MB/s | 11 kB 00:00 (55/151): nim-srpm-macros-1-4.fc30.noarch.rpm 1.4 MB/s | 8.1 kB 00:00 (56/151): ocaml-srpm-macros-5-5.fc30.noarch.rpm 1.1 MB/s | 7.7 kB 00:00 (57/151): openblas-srpm-macros-2-5.fc30.noarch. 1.2 MB/s | 7.3 kB 00:00 (58/151): perl-srpm-macros-1-29.fc30.noarch.rpm 1.0 MB/s | 8.2 kB 00:00 (59/151): python-srpm-macros-3-42.fc30.noarch.r 1.4 MB/s | 11 kB 00:00 (60/151): qt5-srpm-macros-5.12.1-1.fc31.noarch. 1.4 MB/s | 9.1 kB 00:00 (61/151): rust-srpm-macros-6-4.fc30.noarch.rpm 1.1 MB/s | 9.0 kB 00:00 (62/151): rpm-4.14.2.1-4.fc30.1.i686.rpm 15 MB/s | 485 kB 00:00 (63/151): zip-3.0-24.fc30.i686.rpm 12 MB/s | 271 kB 00:00 (64/151): fedora-release-common-31-0.1.noarch.r 2.2 MB/s | 18 kB 00:00 (65/151): glibc-common-2.29.9000-6.fc31.i686.rp 16 MB/s | 826 kB 00:00 (66/151): elfutils-0.176-1.fc30.i686.rpm 13 MB/s | 309 kB 00:00 (67/151): guile22-2.2.4-3.fc30.i686.rpm 33 MB/s | 6.5 MB 00:00 (68/151): elfutils-libelf-0.176-1.fc30.i686.rpm 4.4 MB/s | 184 kB 00:00 (69/151): elfutils-libs-0.176-1.fc30.i686.rpm 18 MB/s | 297 kB 00:00 (70/151): pkgconf-pkg-config-1.6.0-1.fc30.i686. 802 kB/s | 11 kB 00:00 (71/151): popt-1.16-17.fc30.i686.rpm 5.6 MB/s | 57 kB 00:00 (72/151): rpm-build-libs-4.14.2.1-4.fc30.1.i686 8.4 MB/s | 100 kB 00:00 (73/151): rpm-libs-4.14.2.1-4.fc30.1.i686.rpm 20 MB/s | 299 kB 00:00 (74/151): zstd-1.3.8-2.fc30.i686.rpm 19 MB/s | 365 kB 00:00 (75/151): pcre-8.43-1.fc31.i686.rpm 18 MB/s | 186 kB 00:00 (76/151): binutils-2.32-9.fc31.i686.rpm 26 MB/s | 6.0 MB 00:00 (77/151): bzip2-libs-1.0.6-29.fc30.i686.rpm 1.2 MB/s | 38 kB 00:00 (78/151): gdb-headless-8.3.50.20190304-1.fc31.i 22 MB/s | 3.7 MB 00:00 (79/151): libcap-2.26-5.fc30.i686.rpm 1.2 MB/s | 47 kB 00:00 (80/151): ncurses-6.1-10.20180923.fc30.i686.rpm 9.0 MB/s | 363 kB 00:00 (81/151): xz-libs-5.2.4-5.fc30.i686.rpm 5.4 MB/s | 92 kB 00:00 (82/151): coreutils-common-8.31-1.fc31.i686.rpm 18 MB/s | 2.0 MB 00:00 (83/151): basesystem-11-7.fc30.noarch.rpm 568 kB/s | 6.9 kB 00:00 (84/151): openssl-libs-1.1.1b-3.fc31.i686.rpm 17 MB/s | 1.3 MB 00:00 (85/151): libgcc-9.0.1-0.10.fc30.i686.rpm 6.0 MB/s | 89 kB 00:00 (86/151): ncurses-base-6.1-10.20180923.fc30.noa 6.6 MB/s | 59 kB 00:00 (87/151): libsepol-2.9-0.rc2.1.fc31.i686.rpm 12 MB/s | 308 kB 00:00 (88/151): pcre2-10.33-0.3.RC1.fc31.i686.rpm 14 MB/s | 252 kB 00:00 (89/151): cracklib-2.9.6-19.fc30.i686.rpm 9.2 MB/s | 77 kB 00:00 (90/151): libnsl2-1.2.0-4.20180605git4a062cf.fc 11 MB/s | 57 kB 00:00 (91/151): libpwquality-1.4.0-12.fc30.i686.rpm 11 MB/s | 97 kB 00:00 (92/151): libtirpc-1.1.4-2.rc2.fc30.1.i686.rpm 10 MB/s | 105 kB 00:00 (93/151): lz4-libs-1.8.3-2.fc30.i686.rpm 6.5 MB/s | 61 kB 00:00 (94/151): libgcrypt-1.8.4-3.fc30.i686.rpm 19 MB/s | 416 kB 00:00 (95/151): libdb-5.3.28-37.fc30.i686.rpm 19 MB/s | 809 kB 00:00 (96/151): libffi-3.1-19.fc30.i686.rpm 4.6 MB/s | 30 kB 00:00 (97/151): gc-7.6.4-5.fc30.i686.rpm 6.0 MB/s | 97 kB 00:00 (98/151): libtool-ltdl-2.4.6-29.fc30.i686.rpm 4.1 MB/s | 36 kB 00:00 (99/151): libunistring-0.9.10-5.fc30.i686.rpm 17 MB/s | 423 kB 00:00 (100/151): file-libs-5.36-2.fc31.i686.rpm 18 MB/s | 552 kB 00:00 (101/151): libarchive-3.3.3-4.fc31.i686.rpm 12 MB/s | 381 kB 00:00 (102/151): libdb-utils-5.3.28-37.fc30.i686.rpm 8.6 MB/s | 135 kB 00:00 (103/151): fedora-repos-31-0.2.noarch.rpm 2.6 MB/s | 9.2 kB 00:00 (104/151): alternatives-1.11-4.fc31.i686.rpm 6.8 MB/s | 34 kB 00:00 (105/151): tzdata-2018i-2.fc30.noarch.rpm 17 MB/s | 424 kB 00:00 (106/151): elfutils-default-yama-scope-0.176-1. 2.2 MB/s | 16 kB 00:00 (107/151): expat-2.2.6-2.fc30.i686.rpm 8.9 MB/s | 94 kB 00:00 (108/151): binutils-gold-2.32-9.fc31.i686.rpm 23 MB/s | 820 kB 00:00 (109/151): libstdc++-9.0.1-0.10.fc30.i686.rpm 14 MB/s | 609 kB 00:00 (110/151): libipt-2.0-2.fc30.i686.rpm 5.8 MB/s | 61 kB 00:00 (111/151): libbabeltrace-1.5.6-2.fc30.i686.rpm 10 MB/s | 208 kB 00:00 (112/151): pkgconf-1.6.0-1.fc30.i686.rpm 5.9 MB/s | 38 kB 00:00 (113/151): pkgconf-m4-1.6.0-1.fc30.noarch.rpm 2.0 MB/s | 15 kB 00:00 (114/151): source-highlight-3.1.8-23.fc31.i686. 28 MB/s | 679 kB 00:00 (115/151): libzstd-1.3.8-2.fc30.i686.rpm 23 MB/s | 251 kB 00:00 (116/151): lua-libs-5.3.5-5.fc30.i686.rpm 14 MB/s | 119 kB 00:00 (117/151): crypto-policies-20190211-2.gite3eacf 6.9 MB/s | 51 kB 00:00 (118/151): ca-certificates-2018.2.26-3.fc30.noa 21 MB/s | 385 kB 00:00 (119/151): libcom_err-1.45.0-1.fc31.i686.rpm 2.7 MB/s | 27 kB 00:00 (120/151): krb5-libs-1.17-6.fc31.i686.rpm 29 MB/s | 769 kB 00:00 (121/151): libgpg-error-1.33-2.fc30.i686.rpm 19 MB/s | 244 kB 00:00 (122/151): libatomic_ops-7.6.10-1.fc31.i686.rpm 6.2 MB/s | 34 kB 00:00 (123/151): fedora-gpg-keys-31-0.2.noarch.rpm 17 MB/s | 102 kB 00:00 (124/151): fedora-repos-rawhide-31-0.2.noarch.r 1.5 MB/s | 8.4 kB 00:00 (125/151): libxml2-2.9.9-2.fc30.i686.rpm 33 MB/s | 696 kB 00:00 (126/151): gdbm-libs-1.18-4.fc30.i686.rpm 3.6 MB/s | 53 kB 00:00 (127/151): python-pip-wheel-19.0.3-1.fc31.noarc 22 MB/s | 1.1 MB 00:00 (128/151): python-setuptools-wheel-40.8.0-1.fc3 15 MB/s | 279 kB 00:00 (129/151): glib2-2.60.0-3.fc31.i686.rpm 20 MB/s | 2.6 MB 00:00 (130/151): sqlite-libs-3.27.2-3.fc31.i686.rpm 14 MB/s | 580 kB 00:00 (131/151): boost-regex-1.69.0-6.fc30.i686.rpm 16 MB/s | 312 kB 00:00 (132/151): ctags-5.8-25.fc30.i686.rpm 8.8 MB/s | 163 kB 00:00 (133/151): libpkgconf-1.6.0-1.fc30.i686.rpm 4.7 MB/s | 36 kB 00:00 (134/151): p11-kit-0.23.15-3.fc30.i686.rpm 10 MB/s | 237 kB 00:00 (135/151): p11-kit-trust-0.23.15-3.fc30.i686.rp 5.9 MB/s | 129 kB 00:00 (136/151): keyutils-libs-1.6-2.fc30.i686.rpm 2.5 MB/s | 30 kB 00:00 (137/151): libverto-0.3.0-7.fc30.i686.rpm 1.8 MB/s | 21 kB 00:00 (138/151): libtasn1-4.13-7.fc30.i686.rpm 4.9 MB/s | 71 kB 00:00 (139/151): curl-7.64.0-4.fc31.i686.rpm 8.8 MB/s | 324 kB 00:00 (140/151): libmetalink-0.1.3-8.fc30.i686.rpm 2.6 MB/s | 30 kB 00:00 (141/151): libcurl-7.64.0-4.fc31.i686.rpm 12 MB/s | 282 kB 00:00 (142/151): brotli-1.0.7-3.fc30.i686.rpm 11 MB/s | 313 kB 00:00 (143/151): python3-libs-3.7.2-7.fc30.i686.rpm 18 MB/s | 7.8 MB 00:00 (144/151): libidn2-2.1.1a-1.fc30.i686.rpm 1.8 MB/s | 90 kB 00:00 (145/151): libnghttp2-1.37.0-1.fc31.i686.rpm 5.3 MB/s | 77 kB 00:00 (146/151): libpsl-0.20.2-6.fc30.i686.rpm 3.7 MB/s | 58 kB 00:00 (147/151): libssh-0.8.7-1.fc31.i686.rpm 9.7 MB/s | 230 kB 00:00 (148/151): openldap-2.4.47-1.fc30.i686.rpm 9.5 MB/s | 298 kB 00:00 (149/151): publicsuffix-list-dafsa-20190128-2.f 3.9 MB/s | 54 kB 00:00 (150/151): cyrus-sasl-lib-2.1.27-0.6rc7.fc30.i6 6.8 MB/s | 97 kB 00:00 (151/151): libicu-63.1-2.fc30.i686.rpm 26 MB/s | 9.1 MB 00:00 -------------------------------------------------------------------------------- Total 40 MB/s | 78 MB 00:01 warning: /var/lib/mock/870521-fedora-rawhide-i386-1552997133.472221/root/var/cache/dnf/fedora-6cb74b5c20b9e175/packages/gawk-4.2.1-6.fc30.i686.rpm: Header V3 RSA/SHA256 Signature, key ID 3c3359c4: NOKEY Importing GPG key 0x3C3359C4: Userid : "Fedora (31) " Fingerprint: 7D22 D586 7F2A 4236 474B F7B8 50CB 390B 3C33 59C4 From : /usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-31-primary Key imported successfully Importing GPG key 0xCFC659B9: Userid : "Fedora (30) " Fingerprint: F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9 From : /usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-30-primary Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: filesystem-3.10-1.fc30.i686 1/1 Preparing : 1/1 Installing : publicsuffix-list-dafsa-20190128-2.fc30.noarch 1/151 Installing : python-setuptools-wheel-40.8.0-1.fc30.noarch 2/151 Installing : fedora-gpg-keys-31-0.2.noarch 3/151 Installing : fedora-release-common-31-0.1.noarch 4/151 Installing : fedora-release-31-0.1.noarch 5/151 Installing : fedora-repos-rawhide-31-0.2.noarch 6/151 Installing : fedora-repos-31-0.2.noarch 7/151 Installing : setup-2.13.2-1.fc31.noarch 8/151 Running scriptlet: setup-2.13.2-1.fc31.noarch 8/151 warning: /etc/hosts created as /etc/hosts.rpmnew Installing : filesystem-3.10-1.fc30.i686 9/151 Installing : basesystem-11-7.fc30.noarch 10/151 Installing : pkgconf-m4-1.6.0-1.fc30.noarch 11/151 Installing : tzdata-2018i-2.fc30.noarch 12/151 Installing : ncurses-base-6.1-10.20180923.fc30.noarch 13/151 Installing : coreutils-common-8.31-1.fc31.i686 14/151 Installing : rust-srpm-macros-6-4.fc30.noarch 15/151 Installing : qt5-srpm-macros-5.12.1-1.fc31.noarch 16/151 Installing : python-srpm-macros-3-42.fc30.noarch 17/151 Installing : perl-srpm-macros-1-29.fc30.noarch 18/151 Installing : openblas-srpm-macros-2-5.fc30.noarch 19/151 Installing : ocaml-srpm-macros-5-5.fc30.noarch 20/151 Installing : nim-srpm-macros-1-4.fc30.noarch 21/151 Installing : go-srpm-macros-2-19.fc30.noarch 22/151 Installing : gnat-srpm-macros-4-9.fc30.noarch 23/151 Installing : ghc-srpm-macros-1.4.2-9.fc30.noarch 24/151 Installing : fpc-srpm-macros-1.2-1.fc31.noarch 25/151 Installing : libgcc-9.0.1-0.10.fc30.i686 26/151 Running scriptlet: libgcc-9.0.1-0.10.fc30.i686 26/151 Installing : pcre2-10.33-0.3.RC1.fc31.i686 27/151 Installing : libselinux-2.9-0.rc2.1.fc31.i686 28/151 Installing : glibc-minimal-langpack-2.29.9000-6.fc31.i686 29/151 Installing : ncurses-libs-6.1-10.20180923.fc30.i686 30/151 Installing : glibc-common-2.29.9000-6.fc31.i686 31/151 Running scriptlet: glibc-2.29.9000-6.fc31.i686 32/151 Installing : glibc-2.29.9000-6.fc31.i686 32/151 Running scriptlet: glibc-2.29.9000-6.fc31.i686 32/151 Installing : bash-5.0.2-1.fc30.i686 33/151 Running scriptlet: bash-5.0.2-1.fc30.i686 33/151 Installing : libsepol-2.9-0.rc2.1.fc31.i686 34/151 Running scriptlet: libsepol-2.9-0.rc2.1.fc31.i686 34/151 Installing : zlib-1.2.11-15.fc30.i686 35/151 Installing : bzip2-libs-1.0.6-29.fc30.i686 36/151 Installing : xz-libs-5.2.4-5.fc30.i686 37/151 Installing : libstdc++-9.0.1-0.10.fc30.i686 38/151 Installing : elfutils-libelf-0.176-1.fc30.i686 39/151 Installing : libxcrypt-4.4.4-2.fc31.i686 40/151 Installing : libuuid-2.33.1-4.fc31.i686 41/151 Installing : popt-1.16-17.fc30.i686 42/151 Installing : libdb-5.3.28-37.fc30.i686 43/151 Installing : gmp-1:6.1.2-10.fc31.i686 44/151 Installing : readline-8.0-2.fc30.i686 45/151 Installing : libattr-2.4.48-5.fc30.i686 46/151 Installing : libacl-2.2.53-3.fc30.i686 47/151 Installing : sed-4.5-3.fc30.i686 48/151 Installing : libffi-3.1-19.fc30.i686 49/151 Installing : libcom_err-1.45.0-1.fc31.i686 50/151 Installing : libcap-2.26-5.fc30.i686 51/151 Installing : libunistring-0.9.10-5.fc30.i686 52/151 Installing : expat-2.2.6-2.fc30.i686 53/151 Installing : libzstd-1.3.8-2.fc30.i686 54/151 Installing : elfutils-default-yama-scope-0.176-1.fc30.noarch 55/151 Running scriptlet: elfutils-default-yama-scope-0.176-1.fc30.noarch 55/151 Installing : elfutils-libs-0.176-1.fc30.i686 56/151 Installing : libidn2-2.1.1a-1.fc30.i686 57/151 Installing : p11-kit-0.23.15-3.fc30.i686 58/151 Installing : mpfr-3.1.6-4.fc30.i686 59/151 Installing : unzip-6.0-43.fc30.i686 60/151 Installing : file-libs-5.36-2.fc31.i686 61/151 Installing : file-5.36-2.fc31.i686 62/151 Installing : findutils-1:4.6.0-22.fc30.i686 63/151 Installing : libcap-ng-0.7.9-7.fc31.i686 64/151 Installing : audit-libs-3.0-0.6.20181218gitbdb72c0.fc30.i686 65/151 Installing : pcre-8.43-1.fc31.i686 66/151 Installing : grep-3.1-9.fc30.i686 67/151 Installing : lz4-libs-1.8.3-2.fc30.i686 68/151 Installing : alternatives-1.11-4.fc31.i686 69/151 Installing : lua-libs-5.3.5-5.fc30.i686 70/151 Installing : xz-5.2.4-5.fc30.i686 71/151 Installing : libsemanage-2.9-0.rc2.1.fc31.i686 72/151 Installing : shadow-utils-2:4.6-9.fc31.i686 73/151 Running scriptlet: libutempter-1.1.6-16.fc30.i686 74/151 Installing : libutempter-1.1.6-16.fc30.i686 74/151 Installing : zip-3.0-24.fc30.i686 75/151 Installing : libpsl-0.20.2-6.fc30.i686 76/151 Installing : elfutils-0.176-1.fc30.i686 77/151 Installing : libmetalink-0.1.3-8.fc30.i686 78/151 Installing : tar-2:1.32-1.fc31.i686 79/151 Installing : patch-2.7.6-9.fc31.i686 80/151 Installing : libdb-utils-5.3.28-37.fc30.i686 81/151 Installing : dwz-0.12-10.fc30.i686 82/151 Installing : zstd-1.3.8-2.fc30.i686 83/151 Installing : libicu-63.1-2.fc30.i686 84/151 Installing : boost-regex-1.69.0-6.fc30.i686 85/151 Installing : libxml2-2.9.9-2.fc30.i686 86/151 Installing : bzip2-1.0.6-29.fc30.i686 87/151 Installing : sqlite-libs-3.27.2-3.fc31.i686 88/151 Installing : diffutils-3.7-2.fc30.i686 89/151 Installing : cpio-2.12-10.fc30.i686 90/151 Installing : libsigsegv-2.11-7.fc30.i686 91/151 Installing : gawk-4.2.1-6.fc30.i686 92/151 Installing : libsmartcols-2.33.1-4.fc31.i686 93/151 Installing : ncurses-6.1-10.20180923.fc30.i686 94/151 Installing : libtool-ltdl-2.4.6-29.fc30.i686 95/151 Installing : libipt-2.0-2.fc30.i686 96/151 Installing : libgpg-error-1.33-2.fc30.i686 97/151 Installing : libgcrypt-1.8.4-3.fc30.i686 98/151 Installing : libatomic_ops-7.6.10-1.fc31.i686 99/151 Installing : gc-7.6.4-5.fc30.i686 100/151 Installing : gdbm-libs-1:1.18-4.fc30.i686 101/151 Installing : ctags-5.8-25.fc30.i686 102/151 Installing : source-highlight-3.1.8-23.fc31.i686 103/151 Installing : libpkgconf-1.6.0-1.fc30.i686 104/151 Installing : pkgconf-1.6.0-1.fc30.i686 105/151 Installing : pkgconf-pkg-config-1.6.0-1.fc30.i686 106/151 Installing : keyutils-libs-1.6-2.fc30.i686 107/151 Installing : libverto-0.3.0-7.fc30.i686 108/151 Installing : libtasn1-4.13-7.fc30.i686 109/151 Installing : p11-kit-trust-0.23.15-3.fc30.i686 110/151 Running scriptlet: p11-kit-trust-0.23.15-3.fc30.i686 110/151 Installing : openssl-libs-1:1.1.1b-3.fc31.i686 111/151 Installing : coreutils-8.31-1.fc31.i686 112/151 Running scriptlet: ca-certificates-2018.2.26-3.fc30.noarch 113/151 Installing : ca-certificates-2018.2.26-3.fc30.noarch 113/151 Running scriptlet: ca-certificates-2018.2.26-3.fc30.noarch 113/151 Installing : crypto-policies-20190211-2.gite3eacfc.fc30.noarc 114/151 Running scriptlet: crypto-policies-20190211-2.gite3eacfc.fc30.noarc 114/151 Installing : krb5-libs-1.17-6.fc31.i686 115/151 Installing : libtirpc-1.1.4-2.rc2.fc30.1.i686 116/151 Installing : libblkid-2.33.1-4.fc31.i686 117/151 Running scriptlet: libblkid-2.33.1-4.fc31.i686 117/151 Installing : libmount-2.33.1-4.fc31.i686 118/151 Installing : libnsl2-1.2.0-4.20180605git4a062cf.fc30.i686 119/151 Installing : gzip-1.9-8.fc30.i686 120/151 Installing : cracklib-2.9.6-19.fc30.i686 121/151 Installing : libpwquality-1.4.0-12.fc30.i686 122/151 Installing : pam-1.3.1-17.fc30.i686 123/151 Installing : binutils-gold-2.32-9.fc31.i686 124/151 Installing : binutils-2.32-9.fc31.i686 125/151 Running scriptlet: binutils-2.32-9.fc31.i686 125/151 Installing : python-pip-wheel-19.0.3-1.fc31.noarch 126/151 Installing : python3-libs-3.7.2-7.fc30.i686 127/151 Installing : glib2-2.60.0-3.fc31.i686 128/151 Installing : libbabeltrace-1.5.6-2.fc30.i686 129/151 Installing : libfdisk-2.33.1-4.fc31.i686 130/151 Installing : libssh-0.8.7-1.fc31.i686 131/151 Installing : cyrus-sasl-lib-2.1.27-0.6rc7.fc30.i686 132/151 Installing : openldap-2.4.47-1.fc30.i686 133/151 Installing : systemd-libs-241-2.gita09c170.fc31.i686 134/151 Running scriptlet: systemd-libs-241-2.gita09c170.fc31.i686 134/151 Installing : guile22-2.2.4-3.fc30.i686 135/151 Running scriptlet: guile22-2.2.4-3.fc30.i686 135/151 Installing : libarchive-3.3.3-4.fc31.i686 136/151 Installing : brotli-1.0.7-3.fc30.i686 137/151 Installing : libnghttp2-1.37.0-1.fc31.i686 138/151 Installing : libcurl-7.64.0-4.fc31.i686 139/151 Installing : curl-7.64.0-4.fc31.i686 140/151 Installing : rpm-libs-4.14.2.1-4.fc30.1.i686 141/151 Installing : rpm-4.14.2.1-4.fc30.1.i686 142/151 Installing : efi-srpm-macros-4-2.fc30.noarch 143/151 Installing : redhat-rpm-config-128-1.fc30.noarch 144/151 Installing : gdb-headless-8.3.50.20190304-1.fc31.i686 145/151 Installing : rpm-build-libs-4.14.2.1-4.fc30.1.i686 146/151 Installing : rpm-build-4.14.2.1-4.fc30.1.i686 147/151 Installing : make-1:4.2.1-13.fc30.i686 148/151 Installing : util-linux-2.33.1-4.fc31.i686 149/151 Running scriptlet: util-linux-2.33.1-4.fc31.i686 149/151 Installing : info-6.6-1.fc30.i686 150/151 Installing : which-2.21-14.fc30.i686 151/151 Running scriptlet: filesystem-3.10-1.fc30.i686 151/151 Running scriptlet: glibc-common-2.29.9000-6.fc31.i686 151/151 Running scriptlet: glib2-2.60.0-3.fc31.i686 151/151 Running scriptlet: info-6.6-1.fc30.i686 151/151 Verifying : gawk-4.2.1-6.fc30.i686 1/151 Verifying : shadow-utils-2:4.6-9.fc31.i686 2/151 Verifying : diffutils-3.7-2.fc30.i686 3/151 Verifying : gzip-1.9-8.fc30.i686 4/151 Verifying : util-linux-2.33.1-4.fc31.i686 5/151 Verifying : make-1:4.2.1-13.fc30.i686 6/151 Verifying : bash-5.0.2-1.fc30.i686 7/151 Verifying : redhat-rpm-config-128-1.fc30.noarch 8/151 Verifying : glibc-minimal-langpack-2.29.9000-6.fc31.i686 9/151 Verifying : findutils-1:4.6.0-22.fc30.i686 10/151 Verifying : fedora-release-31-0.1.noarch 11/151 Verifying : sed-4.5-3.fc30.i686 12/151 Verifying : rpm-build-4.14.2.1-4.fc30.1.i686 13/151 Verifying : grep-3.1-9.fc30.i686 14/151 Verifying : which-2.21-14.fc30.i686 15/151 Verifying : patch-2.7.6-9.fc31.i686 16/151 Verifying : tar-2:1.32-1.fc31.i686 17/151 Verifying : info-6.6-1.fc30.i686 18/151 Verifying : unzip-6.0-43.fc30.i686 19/151 Verifying : cpio-2.12-10.fc30.i686 20/151 Verifying : coreutils-8.31-1.fc31.i686 21/151 Verifying : xz-5.2.4-5.fc30.i686 22/151 Verifying : bzip2-1.0.6-29.fc30.i686 23/151 Verifying : filesystem-3.10-1.fc30.i686 24/151 Verifying : glibc-2.29.9000-6.fc31.i686 25/151 Verifying : gmp-1:6.1.2-10.fc31.i686 26/151 Verifying : libsigsegv-2.11-7.fc30.i686 27/151 Verifying : mpfr-3.1.6-4.fc30.i686 28/151 Verifying : readline-8.0-2.fc30.i686 29/151 Verifying : audit-libs-3.0-0.6.20181218gitbdb72c0.fc30.i686 30/151 Verifying : libacl-2.2.53-3.fc30.i686 31/151 Verifying : libattr-2.4.48-5.fc30.i686 32/151 Verifying : libselinux-2.9-0.rc2.1.fc31.i686 33/151 Verifying : libsemanage-2.9-0.rc2.1.fc31.i686 34/151 Verifying : libxcrypt-4.4.4-2.fc31.i686 35/151 Verifying : setup-2.13.2-1.fc31.noarch 36/151 Verifying : libblkid-2.33.1-4.fc31.i686 37/151 Verifying : libcap-ng-0.7.9-7.fc31.i686 38/151 Verifying : libfdisk-2.33.1-4.fc31.i686 39/151 Verifying : libmount-2.33.1-4.fc31.i686 40/151 Verifying : libsmartcols-2.33.1-4.fc31.i686 41/151 Verifying : libutempter-1.1.6-16.fc30.i686 42/151 Verifying : libuuid-2.33.1-4.fc31.i686 43/151 Verifying : ncurses-libs-6.1-10.20180923.fc30.i686 44/151 Verifying : pam-1.3.1-17.fc30.i686 45/151 Verifying : systemd-libs-241-2.gita09c170.fc31.i686 46/151 Verifying : zlib-1.2.11-15.fc30.i686 47/151 Verifying : guile22-2.2.4-3.fc30.i686 48/151 Verifying : dwz-0.12-10.fc30.i686 49/151 Verifying : efi-srpm-macros-4-2.fc30.noarch 50/151 Verifying : file-5.36-2.fc31.i686 51/151 Verifying : fpc-srpm-macros-1.2-1.fc31.noarch 52/151 Verifying : ghc-srpm-macros-1.4.2-9.fc30.noarch 53/151 Verifying : gnat-srpm-macros-4-9.fc30.noarch 54/151 Verifying : go-srpm-macros-2-19.fc30.noarch 55/151 Verifying : nim-srpm-macros-1-4.fc30.noarch 56/151 Verifying : ocaml-srpm-macros-5-5.fc30.noarch 57/151 Verifying : openblas-srpm-macros-2-5.fc30.noarch 58/151 Verifying : perl-srpm-macros-1-29.fc30.noarch 59/151 Verifying : python-srpm-macros-3-42.fc30.noarch 60/151 Verifying : qt5-srpm-macros-5.12.1-1.fc31.noarch 61/151 Verifying : rpm-4.14.2.1-4.fc30.1.i686 62/151 Verifying : rust-srpm-macros-6-4.fc30.noarch 63/151 Verifying : zip-3.0-24.fc30.i686 64/151 Verifying : glibc-common-2.29.9000-6.fc31.i686 65/151 Verifying : fedora-release-common-31-0.1.noarch 66/151 Verifying : binutils-2.32-9.fc31.i686 67/151 Verifying : elfutils-0.176-1.fc30.i686 68/151 Verifying : elfutils-libelf-0.176-1.fc30.i686 69/151 Verifying : elfutils-libs-0.176-1.fc30.i686 70/151 Verifying : gdb-headless-8.3.50.20190304-1.fc31.i686 71/151 Verifying : pkgconf-pkg-config-1.6.0-1.fc30.i686 72/151 Verifying : popt-1.16-17.fc30.i686 73/151 Verifying : rpm-build-libs-4.14.2.1-4.fc30.1.i686 74/151 Verifying : rpm-libs-4.14.2.1-4.fc30.1.i686 75/151 Verifying : zstd-1.3.8-2.fc30.i686 76/151 Verifying : pcre-8.43-1.fc31.i686 77/151 Verifying : bzip2-libs-1.0.6-29.fc30.i686 78/151 Verifying : coreutils-common-8.31-1.fc31.i686 79/151 Verifying : libcap-2.26-5.fc30.i686 80/151 Verifying : ncurses-6.1-10.20180923.fc30.i686 81/151 Verifying : openssl-libs-1:1.1.1b-3.fc31.i686 82/151 Verifying : xz-libs-5.2.4-5.fc30.i686 83/151 Verifying : basesystem-11-7.fc30.noarch 84/151 Verifying : libgcc-9.0.1-0.10.fc30.i686 85/151 Verifying : libsepol-2.9-0.rc2.1.fc31.i686 86/151 Verifying : pcre2-10.33-0.3.RC1.fc31.i686 87/151 Verifying : ncurses-base-6.1-10.20180923.fc30.noarch 88/151 Verifying : cracklib-2.9.6-19.fc30.i686 89/151 Verifying : libdb-5.3.28-37.fc30.i686 90/151 Verifying : libnsl2-1.2.0-4.20180605git4a062cf.fc30.i686 91/151 Verifying : libpwquality-1.4.0-12.fc30.i686 92/151 Verifying : libtirpc-1.1.4-2.rc2.fc30.1.i686 93/151 Verifying : libgcrypt-1.8.4-3.fc30.i686 94/151 Verifying : lz4-libs-1.8.3-2.fc30.i686 95/151 Verifying : gc-7.6.4-5.fc30.i686 96/151 Verifying : libffi-3.1-19.fc30.i686 97/151 Verifying : libtool-ltdl-2.4.6-29.fc30.i686 98/151 Verifying : libunistring-0.9.10-5.fc30.i686 99/151 Verifying : file-libs-5.36-2.fc31.i686 100/151 Verifying : libarchive-3.3.3-4.fc31.i686 101/151 Verifying : libdb-utils-5.3.28-37.fc30.i686 102/151 Verifying : tzdata-2018i-2.fc30.noarch 103/151 Verifying : fedora-repos-31-0.2.noarch 104/151 Verifying : alternatives-1.11-4.fc31.i686 105/151 Verifying : binutils-gold-2.32-9.fc31.i686 106/151 Verifying : libstdc++-9.0.1-0.10.fc30.i686 107/151 Verifying : elfutils-default-yama-scope-0.176-1.fc30.noarch 108/151 Verifying : expat-2.2.6-2.fc30.i686 109/151 Verifying : libbabeltrace-1.5.6-2.fc30.i686 110/151 Verifying : libipt-2.0-2.fc30.i686 111/151 Verifying : python3-libs-3.7.2-7.fc30.i686 112/151 Verifying : source-highlight-3.1.8-23.fc31.i686 113/151 Verifying : pkgconf-1.6.0-1.fc30.i686 114/151 Verifying : pkgconf-m4-1.6.0-1.fc30.noarch 115/151 Verifying : libzstd-1.3.8-2.fc30.i686 116/151 Verifying : lua-libs-5.3.5-5.fc30.i686 117/151 Verifying : ca-certificates-2018.2.26-3.fc30.noarch 118/151 Verifying : crypto-policies-20190211-2.gite3eacfc.fc30.noarc 119/151 Verifying : krb5-libs-1.17-6.fc31.i686 120/151 Verifying : libcom_err-1.45.0-1.fc31.i686 121/151 Verifying : libgpg-error-1.33-2.fc30.i686 122/151 Verifying : libatomic_ops-7.6.10-1.fc31.i686 123/151 Verifying : libxml2-2.9.9-2.fc30.i686 124/151 Verifying : fedora-gpg-keys-31-0.2.noarch 125/151 Verifying : fedora-repos-rawhide-31-0.2.noarch 126/151 Verifying : glib2-2.60.0-3.fc31.i686 127/151 Verifying : gdbm-libs-1:1.18-4.fc30.i686 128/151 Verifying : python-pip-wheel-19.0.3-1.fc31.noarch 129/151 Verifying : python-setuptools-wheel-40.8.0-1.fc30.noarch 130/151 Verifying : sqlite-libs-3.27.2-3.fc31.i686 131/151 Verifying : boost-regex-1.69.0-6.fc30.i686 132/151 Verifying : ctags-5.8-25.fc30.i686 133/151 Verifying : libpkgconf-1.6.0-1.fc30.i686 134/151 Verifying : p11-kit-0.23.15-3.fc30.i686 135/151 Verifying : p11-kit-trust-0.23.15-3.fc30.i686 136/151 Verifying : keyutils-libs-1.6-2.fc30.i686 137/151 Verifying : libverto-0.3.0-7.fc30.i686 138/151 Verifying : libicu-63.1-2.fc30.i686 139/151 Verifying : libtasn1-4.13-7.fc30.i686 140/151 Verifying : curl-7.64.0-4.fc31.i686 141/151 Verifying : libmetalink-0.1.3-8.fc30.i686 142/151 Verifying : libcurl-7.64.0-4.fc31.i686 143/151 Verifying : brotli-1.0.7-3.fc30.i686 144/151 Verifying : libidn2-2.1.1a-1.fc30.i686 145/151 Verifying : libnghttp2-1.37.0-1.fc31.i686 146/151 Verifying : libpsl-0.20.2-6.fc30.i686 147/151 Verifying : libssh-0.8.7-1.fc31.i686 148/151 Verifying : openldap-2.4.47-1.fc30.i686 149/151 Verifying : publicsuffix-list-dafsa-20190128-2.fc30.noarch 150/151 Verifying : cyrus-sasl-lib-2.1.27-0.6rc7.fc30.i686 151/151 Installed: bash.i686 5.0.2-1.fc30 bzip2.i686 1.0.6-29.fc30 coreutils.i686 8.31-1.fc31 cpio.i686 2.12-10.fc30 diffutils.i686 3.7-2.fc30 fedora-release.noarch 31-0.1 findutils.i686 1:4.6.0-22.fc30 gawk.i686 4.2.1-6.fc30 glibc-minimal-langpack.i686 2.29.9000-6.fc31 grep.i686 3.1-9.fc30 gzip.i686 1.9-8.fc30 info.i686 6.6-1.fc30 make.i686 1:4.2.1-13.fc30 patch.i686 2.7.6-9.fc31 redhat-rpm-config.noarch 128-1.fc30 rpm-build.i686 4.14.2.1-4.fc30.1 sed.i686 4.5-3.fc30 shadow-utils.i686 2:4.6-9.fc31 tar.i686 2:1.32-1.fc31 unzip.i686 6.0-43.fc30 util-linux.i686 2.33.1-4.fc31 which.i686 2.21-14.fc30 xz.i686 5.2.4-5.fc30 alternatives.i686 1.11-4.fc31 audit-libs.i686 3.0-0.6.20181218gitbdb72c0.fc30 basesystem.noarch 11-7.fc30 binutils.i686 2.32-9.fc31 binutils-gold.i686 2.32-9.fc31 boost-regex.i686 1.69.0-6.fc30 brotli.i686 1.0.7-3.fc30 bzip2-libs.i686 1.0.6-29.fc30 ca-certificates.noarch 2018.2.26-3.fc30 coreutils-common.i686 8.31-1.fc31 cracklib.i686 2.9.6-19.fc30 crypto-policies.noarch 20190211-2.gite3eacfc.fc30 ctags.i686 5.8-25.fc30 curl.i686 7.64.0-4.fc31 cyrus-sasl-lib.i686 2.1.27-0.6rc7.fc30 dwz.i686 0.12-10.fc30 efi-srpm-macros.noarch 4-2.fc30 elfutils.i686 0.176-1.fc30 elfutils-default-yama-scope.noarch 0.176-1.fc30 elfutils-libelf.i686 0.176-1.fc30 elfutils-libs.i686 0.176-1.fc30 expat.i686 2.2.6-2.fc30 fedora-gpg-keys.noarch 31-0.2 fedora-release-common.noarch 31-0.1 fedora-repos.noarch 31-0.2 fedora-repos-rawhide.noarch 31-0.2 file.i686 5.36-2.fc31 file-libs.i686 5.36-2.fc31 filesystem.i686 3.10-1.fc30 fpc-srpm-macros.noarch 1.2-1.fc31 gc.i686 7.6.4-5.fc30 gdb-headless.i686 8.3.50.20190304-1.fc31 gdbm-libs.i686 1:1.18-4.fc30 ghc-srpm-macros.noarch 1.4.2-9.fc30 glib2.i686 2.60.0-3.fc31 glibc.i686 2.29.9000-6.fc31 glibc-common.i686 2.29.9000-6.fc31 gmp.i686 1:6.1.2-10.fc31 gnat-srpm-macros.noarch 4-9.fc30 go-srpm-macros.noarch 2-19.fc30 guile22.i686 2.2.4-3.fc30 keyutils-libs.i686 1.6-2.fc30 krb5-libs.i686 1.17-6.fc31 libacl.i686 2.2.53-3.fc30 libarchive.i686 3.3.3-4.fc31 libatomic_ops.i686 7.6.10-1.fc31 libattr.i686 2.4.48-5.fc30 libbabeltrace.i686 1.5.6-2.fc30 libblkid.i686 2.33.1-4.fc31 libcap.i686 2.26-5.fc30 libcap-ng.i686 0.7.9-7.fc31 libcom_err.i686 1.45.0-1.fc31 libcurl.i686 7.64.0-4.fc31 libdb.i686 5.3.28-37.fc30 libdb-utils.i686 5.3.28-37.fc30 libfdisk.i686 2.33.1-4.fc31 libffi.i686 3.1-19.fc30 libgcc.i686 9.0.1-0.10.fc30 libgcrypt.i686 1.8.4-3.fc30 libgpg-error.i686 1.33-2.fc30 libicu.i686 63.1-2.fc30 libidn2.i686 2.1.1a-1.fc30 libipt.i686 2.0-2.fc30 libmetalink.i686 0.1.3-8.fc30 libmount.i686 2.33.1-4.fc31 libnghttp2.i686 1.37.0-1.fc31 libnsl2.i686 1.2.0-4.20180605git4a062cf.fc30 libpkgconf.i686 1.6.0-1.fc30 libpsl.i686 0.20.2-6.fc30 libpwquality.i686 1.4.0-12.fc30 libselinux.i686 2.9-0.rc2.1.fc31 libsemanage.i686 2.9-0.rc2.1.fc31 libsepol.i686 2.9-0.rc2.1.fc31 libsigsegv.i686 2.11-7.fc30 libsmartcols.i686 2.33.1-4.fc31 libssh.i686 0.8.7-1.fc31 libstdc++.i686 9.0.1-0.10.fc30 libtasn1.i686 4.13-7.fc30 libtirpc.i686 1.1.4-2.rc2.fc30.1 libtool-ltdl.i686 2.4.6-29.fc30 libunistring.i686 0.9.10-5.fc30 libutempter.i686 1.1.6-16.fc30 libuuid.i686 2.33.1-4.fc31 libverto.i686 0.3.0-7.fc30 libxcrypt.i686 4.4.4-2.fc31 libxml2.i686 2.9.9-2.fc30 libzstd.i686 1.3.8-2.fc30 lua-libs.i686 5.3.5-5.fc30 lz4-libs.i686 1.8.3-2.fc30 mpfr.i686 3.1.6-4.fc30 ncurses.i686 6.1-10.20180923.fc30 ncurses-base.noarch 6.1-10.20180923.fc30 ncurses-libs.i686 6.1-10.20180923.fc30 nim-srpm-macros.noarch 1-4.fc30 ocaml-srpm-macros.noarch 5-5.fc30 openblas-srpm-macros.noarch 2-5.fc30 openldap.i686 2.4.47-1.fc30 openssl-libs.i686 1:1.1.1b-3.fc31 p11-kit.i686 0.23.15-3.fc30 p11-kit-trust.i686 0.23.15-3.fc30 pam.i686 1.3.1-17.fc30 pcre.i686 8.43-1.fc31 pcre2.i686 10.33-0.3.RC1.fc31 perl-srpm-macros.noarch 1-29.fc30 pkgconf.i686 1.6.0-1.fc30 pkgconf-m4.noarch 1.6.0-1.fc30 pkgconf-pkg-config.i686 1.6.0-1.fc30 popt.i686 1.16-17.fc30 publicsuffix-list-dafsa.noarch 20190128-2.fc30 python-pip-wheel.noarch 19.0.3-1.fc31 python-setuptools-wheel.noarch 40.8.0-1.fc30 python-srpm-macros.noarch 3-42.fc30 python3-libs.i686 3.7.2-7.fc30 qt5-srpm-macros.noarch 5.12.1-1.fc31 readline.i686 8.0-2.fc30 rpm.i686 4.14.2.1-4.fc30.1 rpm-build-libs.i686 4.14.2.1-4.fc30.1 rpm-libs.i686 4.14.2.1-4.fc30.1 rust-srpm-macros.noarch 6-4.fc30 setup.noarch 2.13.2-1.fc31 source-highlight.i686 3.1.8-23.fc31 sqlite-libs.i686 3.27.2-3.fc31 systemd-libs.i686 241-2.gita09c170.fc31 tzdata.noarch 2018i-2.fc30 xz-libs.i686 5.2.4-5.fc30 zip.i686 3.0-24.fc30 zlib.i686 1.2.11-15.fc30 zstd.i686 1.3.8-2.fc30 Complete! Finish: dnf install Start: creating root cache Finish: creating root cache Finish: chroot init INFO: Installed packages: Start: buildsrpm Start: rpmbuild -bs Building target platforms: i686 Building for target i686 Wrote: /builddir/build/SRPMS/icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm Finish: rpmbuild -bs INFO: chroot_scan: 3 files copied to /var/lib/copr-rpmbuild/results/chroot_scan INFO: /var/lib/mock/870521-fedora-rawhide-i386-1552997133.472221/root/var/log/dnf.rpm.log /var/lib/mock/870521-fedora-rawhide-i386-1552997133.472221/root/var/log/dnf.librepo.log /var/lib/mock/870521-fedora-rawhide-i386-1552997133.472221/root/var/log/dnf.log Finish: buildsrpm INFO: Done(/tmp/tmpgwpoikld/icestorm.spec) Config(child) 1 minutes 2 seconds INFO: Results and/or logs in: /var/lib/copr-rpmbuild/results INFO: Cleaning up build root ('cleanup_on_success=True') Start: clean chroot INFO: unmounting tmpfs. Finish: clean chroot Finish: run Running (timeout=64800): unbuffer /usr/bin/mock --rebuild /var/lib/copr-rpmbuild/results/icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm --configdir /var/lib/copr-rpmbuild/results/configs --resultdir /var/lib/copr-rpmbuild/results --uniqueext 1552997197.580194 -r child WARNING: Could not find required logging config file: /var/lib/copr-rpmbuild/results/configs/logging.ini. Using default... INFO: mock.py version 1.4.14 starting (python version = 3.6.5)... Start: init plugins INFO: tmpfs initialized INFO: selinux disabled INFO: chroot_scan: initialized INFO: compress_logs: initialized Finish: init plugins Start: run INFO: Start(/var/lib/copr-rpmbuild/results/icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm) Config(870521-fedora-rawhide-i386) Start: clean chroot Finish: clean chroot Start: chroot init INFO: mounting tmpfs at /var/lib/mock/870521-fedora-rawhide-i386-1552997197.580194/root. INFO: calling preinit hooks INFO: enabled root cache Start: unpacking root cache Finish: unpacking root cache INFO: enabled HW Info plugin Mock Version: 1.4.14 INFO: Mock Version: 1.4.14 Start: dnf update 'Copr repository' 840 kB/s | 63 kB 00:00 fedora 59 MB/s | 55 MB 00:00 Last metadata expiration check: 0:00:00 ago on Tue 19 Mar 2019 12:06:44 PM UTC. Dependencies resolved. Nothing to do. Complete! Finish: dnf update Finish: chroot init Start: build phase for icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm Start: build setup for icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm Building target platforms: i686 Building for target i686 Wrote: /builddir/build/SRPMS/icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm Last metadata expiration check: 0:00:00 ago on Tue 19 Mar 2019 12:07:12 PM UTC. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: gcc-c++ i686 9.0.1-0.10.fc30 fedora 11 M libftdi-devel i686 1.3-16.fc31 fedora 294 k python3 i686 3.7.2-7.fc30 fedora 38 k Installing dependencies: acl i686 2.2.53-3.fc30 fedora 70 k annobin i686 8.71-1.fc31 fedora 176 k cpp i686 9.0.1-0.10.fc30 fedora 9.4 M cryptsetup-libs i686 2.1.0-1.fc30 fedora 358 k dbus i686 1:1.12.12-5.fc31 fedora 11 k dbus-broker i686 18-1.fc31 fedora 162 k dbus-common noarch 1:1.12.12-5.fc31 fedora 17 k device-mapper i686 1.02.154-4.fc31 fedora 151 k device-mapper-libs i686 1.02.154-4.fc31 fedora 193 k gcc i686 9.0.1-0.10.fc30 fedora 21 M glibc-devel i686 2.29.9000-6.fc31 fedora 1.0 M glibc-headers i686 2.29.9000-6.fc31 fedora 481 k gnutls i686 3.6.6-1.fc30 fedora 891 k iptables-libs i686 1.8.0-5.fc30 fedora 52 k isl i686 0.16.1-8.fc30 fedora 971 k json-c i686 0.13.1-4.fc30 fedora 37 k kernel-headers i686 5.1.0-0.rc0.git9.1.fc31 fedora 1.2 M kmod-libs i686 26-3.fc31 fedora 64 k libargon2 i686 20161029-7.fc30 fedora 30 k libasan i686 9.0.1-0.10.fc30 fedora 441 k libatomic i686 9.0.1-0.10.fc30 fedora 26 k libconfuse i686 3.2.2-2.fc30 fedora 187 k libftdi i686 1.3-16.fc31 fedora 47 k libgomp i686 9.0.1-0.10.fc30 fedora 217 k libmpc i686 1.1.0-3.fc30 fedora 62 k libpcap i686 14:1.9.0-3.fc30 fedora 156 k libseccomp i686 2.4.0-0.fc31 fedora 58 k libstdc++-devel i686 9.0.1-0.10.fc30 fedora 2.1 M libubsan i686 9.0.1-0.10.fc30 fedora 170 k libusbx i686 1.0.22-3.fc31 fedora 68 k libusbx-devel i686 1.0.22-3.fc31 fedora 25 k libxcrypt-devel i686 4.4.4-2.fc31 fedora 35 k nettle i686 3.4.1rc1-2.fc30 fedora 314 k python3-libftdi i686 1.3-16.fc31 fedora 68 k qrencode-libs i686 3.4.4-8.fc30 fedora 55 k systemd i686 241-2.gita09c170.fc31 fedora 3.7 M systemd-pam i686 241-2.gita09c170.fc31 fedora 156 k systemd-rpm-macros noarch 241-2.gita09c170.fc31 fedora 21 k Transaction Summary ================================================================================ Install 41 Packages Total download size: 56 M Installed size: 157 M Downloading Packages: (1/41): python3-3.7.2-7.fc30.i686.rpm 5.0 MB/s | 38 kB 00:00 (2/41): libftdi-devel-1.3-16.fc31.i686.rpm 12 MB/s | 294 kB 00:00 (3/41): libmpc-1.1.0-3.fc30.i686.rpm 12 MB/s | 62 kB 00:00 (4/41): libstdc++-devel-9.0.1-0.10.fc30.i686.rp 29 MB/s | 2.1 MB 00:00 (5/41): libconfuse-3.2.2-2.fc30.i686.rpm 11 MB/s | 187 kB 00:00 (6/41): libftdi-1.3-16.fc31.i686.rpm 4.3 MB/s | 47 kB 00:00 (7/41): libusbx-1.0.22-3.fc31.i686.rpm 6.3 MB/s | 68 kB 00:00 (8/41): libusbx-devel-1.0.22-3.fc31.i686.rpm 2.6 MB/s | 25 kB 00:00 (9/41): python3-libftdi-1.3-16.fc31.i686.rpm 4.8 MB/s | 68 kB 00:00 (10/41): gcc-c++-9.0.1-0.10.fc30.i686.rpm 34 MB/s | 11 MB 00:00 (11/41): glibc-devel-2.29.9000-6.fc31.i686.rpm 25 MB/s | 1.0 MB 00:00 (12/41): isl-0.16.1-8.fc30.i686.rpm 24 MB/s | 971 kB 00:00 (13/41): libasan-9.0.1-0.10.fc30.i686.rpm 20 MB/s | 441 kB 00:00 (14/41): libatomic-9.0.1-0.10.fc30.i686.rpm 3.1 MB/s | 26 kB 00:00 (15/41): libgomp-9.0.1-0.10.fc30.i686.rpm 14 MB/s | 217 kB 00:00 (16/41): libubsan-9.0.1-0.10.fc30.i686.rpm 12 MB/s | 170 kB 00:00 (17/41): gcc-9.0.1-0.10.fc30.i686.rpm 36 MB/s | 21 MB 00:00 (18/41): glibc-headers-2.29.9000-6.fc31.i686.rp 25 MB/s | 481 kB 00:00 (19/41): cpp-9.0.1-0.10.fc30.i686.rpm 19 MB/s | 9.4 MB 00:00 (20/41): libxcrypt-devel-4.4.4-2.fc31.i686.rpm 717 kB/s | 35 kB 00:00 (21/41): acl-2.2.53-3.fc30.i686.rpm 12 MB/s | 70 kB 00:00 (22/41): cryptsetup-libs-2.1.0-1.fc30.i686.rpm 34 MB/s | 358 kB 00:00 (23/41): dbus-1.12.12-5.fc31.i686.rpm 1.6 MB/s | 11 kB 00:00 (24/41): systemd-241-2.gita09c170.fc31.i686.rpm 16 MB/s | 3.7 MB 00:00 (25/41): iptables-libs-1.8.0-5.fc30.i686.rpm 2.1 MB/s | 52 kB 00:00 (26/41): kmod-libs-26-3.fc31.i686.rpm 11 MB/s | 64 kB 00:00 (27/41): libseccomp-2.4.0-0.fc31.i686.rpm 9.3 MB/s | 58 kB 00:00 (28/41): qrencode-libs-3.4.4-8.fc30.i686.rpm 13 MB/s | 55 kB 00:00 (29/41): gnutls-3.6.6-1.fc30.i686.rpm 21 MB/s | 891 kB 00:00 (30/41): systemd-rpm-macros-241-2.gita09c170.fc 3.4 MB/s | 21 kB 00:00 (31/41): systemd-pam-241-2.gita09c170.fc31.i686 9.7 MB/s | 156 kB 00:00 (32/41): device-mapper-libs-1.02.154-4.fc31.i68 18 MB/s | 193 kB 00:00 (33/41): libargon2-20161029-7.fc30.i686.rpm 3.7 MB/s | 30 kB 00:00 (34/41): json-c-0.13.1-4.fc30.i686.rpm 2.7 MB/s | 37 kB 00:00 (35/41): kernel-headers-5.1.0-0.rc0.git9.1.fc31 41 MB/s | 1.2 MB 00:00 (36/41): dbus-broker-18-1.fc31.i686.rpm 13 MB/s | 162 kB 00:00 (37/41): nettle-3.4.1rc1-2.fc30.i686.rpm 21 MB/s | 314 kB 00:00 (38/41): libpcap-1.9.0-3.fc30.i686.rpm 18 MB/s | 156 kB 00:00 (39/41): dbus-common-1.12.12-5.fc31.noarch.rpm 5.5 MB/s | 17 kB 00:00 (40/41): device-mapper-1.02.154-4.fc31.i686.rpm 14 MB/s | 151 kB 00:00 (41/41): annobin-8.71-1.fc31.i686.rpm 27 MB/s | 176 kB 00:00 -------------------------------------------------------------------------------- Total 50 MB/s | 56 MB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : libusbx-1.0.22-3.fc31.i686 1/41 Installing : libmpc-1.1.0-3.fc30.i686 2/41 Installing : libusbx-devel-1.0.22-3.fc31.i686 3/41 Installing : kernel-headers-5.1.0-0.rc0.git9.1.fc31.i686 4/41 Running scriptlet: glibc-headers-2.29.9000-6.fc31.i686 5/41 Installing : glibc-headers-2.29.9000-6.fc31.i686 5/41 Installing : libxcrypt-devel-4.4.4-2.fc31.i686 6/41 Installing : glibc-devel-2.29.9000-6.fc31.i686 7/41 Installing : systemd-rpm-macros-241-2.gita09c170.fc31.noarch 8/41 Installing : libstdc++-devel-9.0.1-0.10.fc30.i686 9/41 Installing : cpp-9.0.1-0.10.fc30.i686 10/41 Installing : libpcap-14:1.9.0-3.fc30.i686 11/41 Installing : iptables-libs-1.8.0-5.fc30.i686 12/41 Installing : nettle-3.4.1rc1-2.fc30.i686 13/41 Installing : gnutls-3.6.6-1.fc30.i686 14/41 Installing : libargon2-20161029-7.fc30.i686 15/41 Installing : json-c-0.13.1-4.fc30.i686 16/41 Installing : qrencode-libs-3.4.4-8.fc30.i686 17/41 Installing : libseccomp-2.4.0-0.fc31.i686 18/41 Installing : kmod-libs-26-3.fc31.i686 19/41 Installing : acl-2.2.53-3.fc30.i686 20/41 Installing : device-mapper-1.02.154-4.fc31.i686 21/41 Installing : device-mapper-libs-1.02.154-4.fc31.i686 22/41 Installing : cryptsetup-libs-2.1.0-1.fc30.i686 23/41 Installing : systemd-pam-241-2.gita09c170.fc31.i686 24/41 Installing : dbus-1:1.12.12-5.fc31.i686 25/41 Running scriptlet: systemd-241-2.gita09c170.fc31.i686 26/41 Installing : systemd-241-2.gita09c170.fc31.i686 26/41 Running scriptlet: systemd-241-2.gita09c170.fc31.i686 26/41 Installing : dbus-common-1:1.12.12-5.fc31.noarch 27/41 Running scriptlet: dbus-common-1:1.12.12-5.fc31.noarch 27/41 Running scriptlet: dbus-broker-18-1.fc31.i686 28/41 Installing : dbus-broker-18-1.fc31.i686 28/41 Running scriptlet: dbus-broker-18-1.fc31.i686 28/41 Installing : libftdi-1.3-16.fc31.i686 29/41 Installing : libubsan-9.0.1-0.10.fc30.i686 30/41 Installing : libgomp-9.0.1-0.10.fc30.i686 31/41 Installing : libatomic-9.0.1-0.10.fc30.i686 32/41 Installing : libasan-9.0.1-0.10.fc30.i686 33/41 Installing : isl-0.16.1-8.fc30.i686 34/41 Installing : gcc-9.0.1-0.10.fc30.i686 35/41 Installing : libconfuse-3.2.2-2.fc30.i686 36/41 Installing : python3-3.7.2-7.fc30.i686 37/41 Installing : python3-libftdi-1.3-16.fc31.i686 38/41 Installing : libftdi-devel-1.3-16.fc31.i686 39/41 Installing : gcc-c++-9.0.1-0.10.fc30.i686 40/41 Installing : annobin-8.71-1.fc31.i686 41/41 Running scriptlet: annobin-8.71-1.fc31.i686 41/41 Running scriptlet: systemd-241-2.gita09c170.fc31.i686 41/41 Verifying : gcc-c++-9.0.1-0.10.fc30.i686 1/41 Verifying : libftdi-devel-1.3-16.fc31.i686 2/41 Verifying : python3-3.7.2-7.fc30.i686 3/41 Verifying : gcc-9.0.1-0.10.fc30.i686 4/41 Verifying : libmpc-1.1.0-3.fc30.i686 5/41 Verifying : libstdc++-devel-9.0.1-0.10.fc30.i686 6/41 Verifying : libconfuse-3.2.2-2.fc30.i686 7/41 Verifying : libftdi-1.3-16.fc31.i686 8/41 Verifying : libusbx-1.0.22-3.fc31.i686 9/41 Verifying : libusbx-devel-1.0.22-3.fc31.i686 10/41 Verifying : python3-libftdi-1.3-16.fc31.i686 11/41 Verifying : cpp-9.0.1-0.10.fc30.i686 12/41 Verifying : glibc-devel-2.29.9000-6.fc31.i686 13/41 Verifying : isl-0.16.1-8.fc30.i686 14/41 Verifying : libasan-9.0.1-0.10.fc30.i686 15/41 Verifying : libatomic-9.0.1-0.10.fc30.i686 16/41 Verifying : libgomp-9.0.1-0.10.fc30.i686 17/41 Verifying : libubsan-9.0.1-0.10.fc30.i686 18/41 Verifying : systemd-241-2.gita09c170.fc31.i686 19/41 Verifying : glibc-headers-2.29.9000-6.fc31.i686 20/41 Verifying : libxcrypt-devel-4.4.4-2.fc31.i686 21/41 Verifying : acl-2.2.53-3.fc30.i686 22/41 Verifying : cryptsetup-libs-2.1.0-1.fc30.i686 23/41 Verifying : dbus-1:1.12.12-5.fc31.i686 24/41 Verifying : gnutls-3.6.6-1.fc30.i686 25/41 Verifying : iptables-libs-1.8.0-5.fc30.i686 26/41 Verifying : kmod-libs-26-3.fc31.i686 27/41 Verifying : libseccomp-2.4.0-0.fc31.i686 28/41 Verifying : qrencode-libs-3.4.4-8.fc30.i686 29/41 Verifying : systemd-pam-241-2.gita09c170.fc31.i686 30/41 Verifying : systemd-rpm-macros-241-2.gita09c170.fc31.noarch 31/41 Verifying : kernel-headers-5.1.0-0.rc0.git9.1.fc31.i686 32/41 Verifying : device-mapper-libs-1.02.154-4.fc31.i686 33/41 Verifying : json-c-0.13.1-4.fc30.i686 34/41 Verifying : libargon2-20161029-7.fc30.i686 35/41 Verifying : dbus-broker-18-1.fc31.i686 36/41 Verifying : nettle-3.4.1rc1-2.fc30.i686 37/41 Verifying : libpcap-14:1.9.0-3.fc30.i686 38/41 Verifying : device-mapper-1.02.154-4.fc31.i686 39/41 Verifying : dbus-common-1:1.12.12-5.fc31.noarch 40/41 Verifying : annobin-8.71-1.fc31.i686 41/41 Installed: gcc-c++.i686 9.0.1-0.10.fc30 libftdi-devel.i686 1.3-16.fc31 python3.i686 3.7.2-7.fc30 acl.i686 2.2.53-3.fc30 annobin.i686 8.71-1.fc31 cpp.i686 9.0.1-0.10.fc30 cryptsetup-libs.i686 2.1.0-1.fc30 dbus.i686 1:1.12.12-5.fc31 dbus-broker.i686 18-1.fc31 dbus-common.noarch 1:1.12.12-5.fc31 device-mapper.i686 1.02.154-4.fc31 device-mapper-libs.i686 1.02.154-4.fc31 gcc.i686 9.0.1-0.10.fc30 glibc-devel.i686 2.29.9000-6.fc31 glibc-headers.i686 2.29.9000-6.fc31 gnutls.i686 3.6.6-1.fc30 iptables-libs.i686 1.8.0-5.fc30 isl.i686 0.16.1-8.fc30 json-c.i686 0.13.1-4.fc30 kernel-headers.i686 5.1.0-0.rc0.git9.1.fc31 kmod-libs.i686 26-3.fc31 libargon2.i686 20161029-7.fc30 libasan.i686 9.0.1-0.10.fc30 libatomic.i686 9.0.1-0.10.fc30 libconfuse.i686 3.2.2-2.fc30 libftdi.i686 1.3-16.fc31 libgomp.i686 9.0.1-0.10.fc30 libmpc.i686 1.1.0-3.fc30 libpcap.i686 14:1.9.0-3.fc30 libseccomp.i686 2.4.0-0.fc31 libstdc++-devel.i686 9.0.1-0.10.fc30 libubsan.i686 9.0.1-0.10.fc30 libusbx.i686 1.0.22-3.fc31 libusbx-devel.i686 1.0.22-3.fc31 libxcrypt-devel.i686 4.4.4-2.fc31 nettle.i686 3.4.1rc1-2.fc30 python3-libftdi.i686 1.3-16.fc31 qrencode-libs.i686 3.4.4-8.fc30 systemd.i686 241-2.gita09c170.fc31 systemd-pam.i686 241-2.gita09c170.fc31 systemd-rpm-macros.noarch 241-2.gita09c170.fc31 Complete! Finish: build setup for icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm Start: rpmbuild icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm Building target platforms: i686 Building for target i686 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.prrHJV + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + /usr/bin/gzip -dc /builddir/build/SOURCES/icestorm-fa1c932.tar.gz + /usr/bin/tar -xof - + STATUS=0 + '[' 0 -ne 0 ']' + cd icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + echo 'Patch #1 (icestorm-datadir.patch):' Patch #1 (icestorm-datadir.patch): + /usr/bin/patch --no-backup-if-mismatch -p1 -b --suffix .datadir --fuzz=0 patching file icebox/icebox_vlog.py Hunk #1 succeeded at 383 (offset 16 lines). + find . -name '*.py' -exec sed -i 's|/usr/bin/env python3|/usr/bin/python3|' '{}' ';' + find . -name .gitignore -delete + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.xvpegf + umask 022 + cd /builddir/build/BUILD + cd icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + make -j2 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1' 'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1' PREFIX=/usr CHIPDB_SUBDIR=icestorm 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' make -C icebox all make -C icepack all make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepack' g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -c -o icepack.o icepack.cc make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebox' python3 icebox_chipdb.py -3 > chipdb-384.new icepack.cc: In member function 'void FpgaConfig::write_ascii(std::ostream&) const': icepack.cc:53:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'std::vector >::size_type' {aka 'unsigned int'} [-Wformat=] 53 | #define error(...) do { fprintf(stderr, "Error: " __VA_ARGS__); exit(1); } while (0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | #define panic(fmt, ...) do { fprintf(stderr, "Internal Error at %s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); abort(); } while (0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 | | 56 | string vstringf(const char *fmt, va_list ap) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 | { | ~ 58 | string string; | ~~~~~~~~~~~~~~ 59 | char *str = NULL; | ~~~~~~~~~~~~~~~~~ 60 | | 61 | #ifdef _WIN32 | ~~~~~~~~~~~~~ 62 | int sz = 64, rc; | ~~~~~~~~~~~~~~~~ 63 | while (1) { | ~~~~~~~~~~~ 64 | va_list apc; | ~~~~~~~~~~~~ 65 | va_copy(apc, ap); | ~~~~~~~~~~~~~~~~~ 66 | str = (char*)realloc(str, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 67 | rc = vsnprintf(str, sz, fmt, apc); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | va_end(apc); | ~~~~~~~~~~~~ 69 | if (rc >= 0 && rc < sz) | ~~~~~~~~~~~~~~~~~~~~~~~ 70 | break; | ~~~~~~ 71 | sz *= 2; | ~~~~~~~~ 72 | } | ~ 73 | #else | ~~~~~ 74 | if (vasprintf(&str, fmt, ap) < 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | str = NULL; | ~~~~~~~~~~~ 76 | #endif | ~~~~~~ 77 | | 78 | if (str != NULL) { | ~~~~~~~~~~~~~~~~~~ 79 | string = str; | ~~~~~~~~~~~~~ 80 | free(str); | ~~~~~~~~~~ 81 | } | ~ 82 | | 83 | return string; | ~~~~~~~~~~~~~~ 84 | } | ~ 85 | | 86 | string stringf(const char *fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 87 | { | ~ 88 | string string; | ~~~~~~~~~~~~~~ 89 | va_list ap; | ~~~~~~~~~~~ 90 | | 91 | va_start(ap, fmt); | ~~~~~~~~~~~~~~~~~~ 92 | string = vstringf(fmt, ap); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 93 | va_end(ap); | ~~~~~~~~~~~ 94 | | 95 | return string; | ~~~~~~~~~~~~~~ 96 | } | ~ 97 | | 98 | // ================================================================== | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 99 | // FpgaConfig stuff | ~~~~~~~~~~~~~~~~~~~ 100 | | 101 | struct FpgaConfig | ~~~~~~~~~~~~~~~~~ 102 | { | ~ 103 | string device; | ~~~~~~~~~~~~~~ 104 | string freqrange; | ~~~~~~~~~~~~~~~~~ 105 | string nosleep; | ~~~~~~~~~~~~~~~ 106 | string warmboot; | ~~~~~~~~~~~~~~~~ 107 | | 108 | // cram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 109 | int cram_width, cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | vector>> cram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | | 112 | // bram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 113 | int bram_width, bram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | vector>> bram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | | 116 | // data before preamble | ~~~~~~~~~~~~~~~~~~~~~~~ 117 | vector initblop; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | // bitstream i/o | ~~~~~~~~~~~~~~~~ 120 | void read_bits(std::istream &ifs); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | void write_bits(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | | 123 | // icebox i/o | ~~~~~~~~~~~~~ 124 | void read_ascii(std::istream &ifs, bool nosleep); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | void write_ascii(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | | 127 | // netpbm i/o | ~~~~~~~~~~~~~ 128 | void write_cram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void write_bram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | | 131 | // query chip type metadata | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 | int chip_width() const; | ~~~~~~~~~~~~~~~~~~~~~~~ 133 | int chip_height() const; | ~~~~~~~~~~~~~~~~~~~~~~~~ 134 | vector chip_cols() const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | | 136 | // query tile metadata | ~~~~~~~~~~~~~~~~~~~~~~ 137 | string tile_type(int x, int y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | int tile_width(const string &type) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | // cram bit manipulation | ~~~~~~~~~~~~~~~~~~~~~~~~ 141 | void cram_clear(); | ~~~~~~~~~~~~~~~~~~ 142 | void cram_fill_tiles(); | ~~~~~~~~~~~~~~~~~~~~~~~ 143 | void cram_checkerboard(int m = 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | }; | ~~ 145 | | 146 | struct CramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 147 | { | ~ 148 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 149 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 150 | | 151 | string tile_type; | ~~~~~~~~~~~~~~~~~ 152 | int tile_width; | ~~~~~~~~~~~~~~~ 153 | int column_width; | ~~~~~~~~~~~~~~~~~ 154 | | 155 | bool left_right_io; | ~~~~~~~~~~~~~~~~~~~ 156 | bool right_half; | ~~~~~~~~~~~~~~~~ 157 | bool top_half; | ~~~~~~~~~~~~~~ 158 | | 159 | int bank_num; | ~~~~~~~~~~~~~ 160 | int bank_tx; | ~~~~~~~~~~~~ 161 | int bank_ty; | ~~~~~~~~~~~~ 162 | int bank_xoff; | ~~~~~~~~~~~~~~ 163 | int bank_yoff; | ~~~~~~~~~~~~~~ 164 | | 165 | CramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | void get_cram_index(int bit_x, int bit_y, int &cram_bank, int &cram_x, int &cram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | }; | ~~ 168 | | 169 | struct BramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | { | ~ 171 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 173 | | 174 | int bank_num; | ~~~~~~~~~~~~~ 175 | int bank_off; | ~~~~~~~~~~~~~ 176 | | 177 | BramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 178 | void get_bram_index(int bit_x, int bit_y, int &bram_bank, int &bram_x, int &bram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 179 | }; | ~~ 180 | | 181 | static void update_crc16(uint16_t &crc, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | { | ~ 183 | // CRC-16-CCITT, Initialize to 0xFFFF, No zero padding | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | for (int i = 7; i >= 0; i--) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | uint16_t xor_value = ((crc >> 15) ^ ((byte >> i) & 1)) ? 0x1021 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | crc = (crc << 1) ^ xor_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | } | ~ 189 | | 190 | static uint8_t read_byte(std::istream &ifs, uint16_t &crc_value, int &file_offset) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | { | ~ 192 | int byte = ifs.get(); | ~~~~~~~~~~~~~~~~~~~~~ 193 | | 194 | if (byte < 0) | ~~~~~~~~~~~~~ 195 | error("Unexpected end of file.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | | 197 | file_offset++; | ~~~~~~~~~~~~~~ 198 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | | 200 | return byte; | ~~~~~~~~~~~~ 201 | } | ~ 202 | | 203 | static void write_byte(std::ostream &ofs, uint16_t &crc_value, int &file_offset, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | { | ~ 205 | ofs << byte; | ~~~~~~~~~~~~ 206 | file_offset++; | ~~~~~~~~~~~~~~ 207 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | } | ~ 209 | | 210 | void FpgaConfig::read_bits(std::istream &ifs) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 211 | { | ~ 212 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 213 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 214 | | 215 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | info("Parsing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | | 218 | // skip initial comments until preamble is found | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | | 220 | uint32_t preamble = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 221 | | 222 | while (1) | ~~~~~~~~~ 223 | { | ~ 224 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 225 | preamble = (preamble << 8) | byte; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (preamble == 0xffffffff) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | error("No preamble found in bitstream.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | if (preamble == 0x7EAA997E) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | info("Found preamble at offset %d.\n", file_offset-4); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | break; | ~~~~~~ 231 | } | ~ 232 | initblop.push_back(byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 236 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 237 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 238 | | 239 | // main parser loop | ~~~~~~~~~~~~~~~~~~~ 240 | | 241 | int current_bank = 0; | ~~~~~~~~~~~~~~~~~~~~~ 242 | int current_width = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 243 | int current_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 244 | int current_offset = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 245 | bool wakeup = false; | ~~~~~~~~~~~~~~~~~~~~ 246 | | 247 | this->cram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 248 | this->cram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 249 | | 250 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 251 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 252 | | 253 | while (!wakeup) | ~~~~~~~~~~~~~~~ 254 | { | ~ 255 | // one command byte. the lower 4 bits of the command byte specify | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | // the length of the command payload. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | | 258 | uint8_t command = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | uint32_t payload = 0; | ~~~~~~~~~~~~~~~~~~~~~ 260 | | 261 | for (int i = 0; i < (command & 0x0f); i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | payload = (payload << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 263 | | 264 | debug("Next command at offset %d: 0x%02x 0x%0*x\n", file_offset - 1 - (command & 0x0f), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | command, 2*(command & 0x0f), payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 266 | | 267 | uint16_t end_token; | ~~~~~~~~~~~~~~~~~~~ 268 | | 269 | switch (command & 0xf0) | ~~~~~~~~~~~~~~~~~~~~~~~ 270 | { | ~ 271 | case 0x00: | ~~~~~~~~~~ 272 | switch (payload) | ~~~~~~~~~~~~~~~~ 273 | { | ~ 274 | case 0x01: | ~~~~~~~~~~ 275 | info("CRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 276 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | | 279 | this->cram_width = std::max(this->cram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | this->cram_height = std::max(this->cram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | | 282 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 283 | this->cram[current_bank].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | this->cram[current_bank][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | | 287 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | this->cram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | } | ~ 294 | } | ~ 295 | | 296 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 297 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | if (end_token) | ~~~~~~~~~~~~~~ 299 | error("Expeded 0x0000 after CRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | break; | ~~~~~~ 301 | | 302 | case 0x03: | ~~~~~~~~~~ 303 | info("BRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 304 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | | 307 | this->bram_width = std::max(this->bram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | this->bram_height = std::max(this->bram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | | 310 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 311 | this->bram[current_bank].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | this->bram[current_bank][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | | 315 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 316 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | this->bram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | } | ~ 322 | } | ~ 323 | | 324 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if (end_token) | ~~~~~~~~~~~~~~ 327 | error("Expeded 0x0000 after BRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 328 | break; | ~~~~~~ 329 | | 330 | case 0x05: | ~~~~~~~~~~ 331 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 333 | break; | ~~~~~~ 334 | | 335 | case 0x06: | ~~~~~~~~~~ 336 | info("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~ 337 | wakeup = true; | ~~~~~~~~~~~~~~ 338 | break; | ~~~~~~ 339 | | 340 | default: | ~~~~~~~~ 341 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | } | ~ 343 | break; | ~~~~~~ 344 | | 345 | case 0x10: | ~~~~~~~~~~ 346 | current_bank = payload; | ~~~~~~~~~~~~~~~~~~~~~~~ 347 | debug("Set bank to %d.\n", current_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | break; | ~~~~~~ 349 | | 350 | case 0x20: | ~~~~~~~~~~ 351 | if (crc_value != 0) | ~~~~~~~~~~~~~~~~~~~ 352 | error("CRC Check FAILED.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | info("CRC Check OK.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~ 354 | break; | ~~~~~~ 355 | | 356 | case 0x50: | ~~~~~~~~~~ 357 | if (payload == 0) | ~~~~~~~~~~~~~~~~~ 358 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 359 | else if (payload == 1) | ~~~~~~~~~~~~~~~~~~~~~~ 360 | this->freqrange = "medium"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | else if (payload == 2) | ~~~~~~~~~~~~~~~~~~~~~~ 362 | this->freqrange = "high"; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | else | ~~~~ 364 | error("Unknown freqrange payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | info("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 366 | break; | ~~~~~~ 367 | | 368 | case 0x60: | ~~~~~~~~~~ 369 | current_width = payload + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | debug("Setting bank width to %d.\n", current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | break; | ~~~~~~ 372 | | 373 | case 0x70: | ~~~~~~~~~~ 374 | current_height = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 375 | debug("Setting bank height to %d.\n", current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | break; | ~~~~~~ 377 | | 378 | case 0x80: | ~~~~~~~~~~ 379 | current_offset = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 380 | debug("Setting bank offset to %d.\n", current_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 381 | break; | ~~~~~~ 382 | | 383 | case 0x90: | ~~~~~~~~~~ 384 | switch(payload) | ~~~~~~~~~~~~~~~ 385 | { | ~ 386 | case 0: | ~~~~~~~ 387 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | break; | ~~~~~~ 390 | case 1: | ~~~~~~~ 391 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | break; | ~~~~~~ 394 | case 32: | ~~~~~~~~ 395 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | break; | ~~~~~~ 398 | case 33: | ~~~~~~~~ 399 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | break; | ~~~~~~ 402 | default: | ~~~~~~~~ 403 | error("Unknown warmboot/nosleep payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | info("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | break; | ~~~~~~ 407 | | 408 | default: | ~~~~~~~~ 409 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 410 | } | ~ 411 | } | ~ 412 | | 413 | if (this->cram_width == 182 && this->cram_height == 80) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | this->device = "384"; | ~~~~~~~~~~~~~~~~~~~~~ 415 | else if (this->cram_width == 332 && this->cram_height == 144) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | this->device = "1k"; | ~~~~~~~~~~~~~~~~~~~~ 417 | else if (this->cram_width == 872 && this->cram_height == 272) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | this->device = "8k"; | ~~~~~~~~~~~~~~~~~~~~ 419 | else if (this->cram_width == 692 && this->cram_height == 336) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | this->device = "5k"; | ~~~~~~~~~~~~~~~~~~~~ 421 | else if (this->cram_width == 692 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | this->device = "u4k"; | ~~~~~~~~~~~~~~~~~~~~~ 423 | else if (this->cram_width == 656 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | this->device = "lm4k"; | ~~~~~~~~~~~~~~~~~~~~~~ 425 | else | ~~~~ 426 | error("Failed to detect chip type.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | info("Chip type is '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | } | ~ 430 | | 431 | void FpgaConfig::write_bits(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | { | ~ 433 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 434 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 435 | | 436 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | info("Writing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | | 439 | for (auto byte : this->initblop) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | ofs << byte; | ~~~~~~~~~~~~ 441 | | 442 | debug("Writing preamble.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | write_byte(ofs, crc_value, file_offset, 0xAA); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | write_byte(ofs, crc_value, file_offset, 0x99); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 447 | | 448 | debug("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 449 | write_byte(ofs, crc_value, file_offset, 0x51); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 450 | if (this->freqrange == "low") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | else if (this->freqrange == "medium") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 453 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | else if (this->freqrange == "high") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | write_byte(ofs, crc_value, file_offset, 0x02); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | else | ~~~~ 457 | error("Unknown freqrange '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | | 459 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | write_byte(ofs, crc_value, file_offset, 0x05); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 463 | | 464 | { | ~ 465 | uint8_t nosleep_flag; | ~~~~~~~~~~~~~~~~~~~~~ 466 | debug("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 467 | write_byte(ofs, crc_value, file_offset, 0x92); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 468 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | | 470 | if (this->nosleep == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 471 | nosleep_flag = 0; | ~~~~~~~~~~~~~~~~~ 472 | else if (this->nosleep == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | nosleep_flag = 1; | ~~~~~~~~~~~~~~~~~ 474 | else | ~~~~ 475 | error("Unknown nosleep setting '%s'.\n", this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 476 | | 477 | if (this->warmboot == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | write_byte(ofs, crc_value, file_offset, 0x00 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 479 | else if (this->warmboot == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 480 | write_byte(ofs, crc_value, file_offset, 0x20 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | else | ~~~~ 482 | error("Unknown warmboot setting '%s'.\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | } | ~ 484 | | 485 | debug("CRAM: Setting bank width to %d.\n", this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 487 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 488 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 489 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 490 | debug("CRAM: Setting bank height to %d.\n", this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 491 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 492 | write_byte(ofs, crc_value, file_offset, this->cram_height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 493 | write_byte(ofs, crc_value, file_offset, this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 494 | } | ~ 495 | | 496 | debug("CRAM: Setting bank offset to 0.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 497 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | for (int cram_bank = 0; cram_bank < 4; cram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 502 | { | ~ 503 | vector cram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 504 | int height = this->cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 505 | if(this->device == "5k" && ((cram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 506 | height = height / 2 + 8; | ~~~~~~~~~~~~~~~~~~~~~~~~ 507 | for (int cram_y = 0; cram_y < height; cram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | for (int cram_x = 0; cram_x < this->cram_width; cram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 509 | cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | debug("CRAM: Setting bank height to %d.\n", height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 513 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 514 | write_byte(ofs, crc_value, file_offset, height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | write_byte(ofs, crc_value, file_offset, height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | } | ~ 517 | | 518 | debug("CRAM: Setting bank %d.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 520 | write_byte(ofs, crc_value, file_offset, cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 521 | | 522 | debug("CRAM: Writing bank %d data.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 523 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 525 | for (int i = 0; i < int(cram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 526 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 527 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 528 | byte = (byte << 1) | (cram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 530 | } | ~ 531 | | 532 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 534 | } | ~ 535 | | 536 | int bram_chunk_size = 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 537 | | 538 | if (this->bram_width && this->bram_height) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 539 | { | ~ 540 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 541 | debug("BRAM: Setting bank width to %d.\n", this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 543 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 544 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 545 | } | ~ 546 | | 547 | | 548 | debug("BRAM: Setting bank height to %d.\n", this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 549 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | write_byte(ofs, crc_value, file_offset, bram_chunk_size >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 551 | write_byte(ofs, crc_value, file_offset, bram_chunk_size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | | 553 | for (int bram_bank = 0; bram_bank < 4; bram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 554 | { | ~ 555 | debug("BRAM: Setting bank %d.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 556 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 557 | write_byte(ofs, crc_value, file_offset, bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | | 559 | for (int offset = 0; offset < this->bram_height; offset += bram_chunk_size) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 560 | { | ~ 561 | vector bram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 562 | int width = this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | if(this->device == "5k" && ((bram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 564 | width = width / 2; | ~~~~~~~~~~~~~~~~~~ 565 | for (int bram_y = 0; bram_y < bram_chunk_size; bram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 566 | for (int bram_x = 0; bram_x < width; bram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | bram_bits.push_back(this->bram[bram_bank][bram_x][bram_y+offset]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | | 569 | debug("BRAM: Setting bank offset to %d.\n", offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 571 | write_byte(ofs, crc_value, file_offset, offset >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | write_byte(ofs, crc_value, file_offset, offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 573 | | 574 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | debug("BRAM: Setting bank width to %d.\n", width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | write_byte(ofs, crc_value, file_offset, (width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | write_byte(ofs, crc_value, file_offset, (width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | } | ~ 580 | | 581 | | 582 | debug("BRAM: Writing bank %d data.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 584 | write_byte(ofs, crc_value, file_offset, 0x03); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 585 | for (int i = 0; i < int(bram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 586 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 587 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 588 | byte = (byte << 1) | (bram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 589 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 590 | } | ~ 591 | | 592 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 593 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | } | ~ 595 | } | ~ 596 | } | ~ 597 | | 598 | debug("Writing CRC value.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | write_byte(ofs, crc_value, file_offset, 0x22); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | uint8_t crc_hi = crc_value >> 8, crc_lo = crc_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | write_byte(ofs, crc_value, file_offset, crc_hi); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | write_byte(ofs, crc_value, file_offset, crc_lo); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | | 604 | debug("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~~ 605 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | write_byte(ofs, crc_value, file_offset, 0x06); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 607 | | 608 | debug("Padding byte.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 609 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 610 | } | ~ 611 | | 612 | void FpgaConfig::read_ascii(std::istream &ifs, bool nosleep) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | { | ~ 614 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | info("Parsing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | | 617 | bool got_device = false; | ~~~~~~~~~~~~~~~~~~~~~~~~ 618 | this->cram.clear(); | ~~~~~~~~~~~~~~~~~~~ 619 | this->bram.clear(); | ~~~~~~~~~~~~~~~~~~~ 620 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 621 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 622 | | 623 | bool reuse_line = true; | ~~~~~~~~~~~~~~~~~~~~~~~ 624 | string line, command; | ~~~~~~~~~~~~~~~~~~~~~ 625 | | 626 | while (reuse_line || getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | { | ~ 628 | reuse_line = false; | ~~~~~~~~~~~~~~~~~~~ 629 | | 630 | std::istringstream is(line); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 631 | is >> command; | ~~~~~~~~~~~~~~ 632 | | 633 | if (command.empty()) | ~~~~~~~~~~~~~~~~~~~~ 634 | continue; | ~~~~~~~~~ 635 | | 636 | debug("Next command: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 637 | | 638 | if (command == ".comment") | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | { | ~ 640 | this->initblop.clear(); | ~~~~~~~~~~~~~~~~~~~~~~~ 641 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 642 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 643 | | 644 | while (getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | { | ~ 646 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 648 | break; | ~~~~~~ 649 | } | ~ 650 | | 651 | for (auto ch : line) | ~~~~~~~~~~~~~~~~~~~~ 652 | this->initblop.push_back(ch); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | this->initblop.push_back(0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | } | ~ 655 | | 656 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | continue; | ~~~~~~~~~ 659 | } | ~ 660 | | 661 | if (command == ".device") | ~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | { | ~ 663 | if (got_device) | ~~~~~~~~~~~~~~~ 664 | error("More than one .device statement.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | | 666 | is >> this->device; | ~~~~~~~~~~~~~~~~~~~ 667 | | 668 | if (this->device == "384") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | this->cram_width = 182; | ~~~~~~~~~~~~~~~~~~~~~~~ 670 | this->cram_height = 80; | ~~~~~~~~~~~~~~~~~~~~~~~ 671 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 672 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 673 | } else | ~~~~~~ 674 | if (this->device == "1k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | this->cram_width = 332; | ~~~~~~~~~~~~~~~~~~~~~~~ 676 | this->cram_height = 144; | ~~~~~~~~~~~~~~~~~~~~~~~~ 677 | this->bram_width = 64; | ~~~~~~~~~~~~~~~~~~~~~~ 678 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 679 | } else | ~~~~~~ 680 | if (this->device == "8k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 681 | this->cram_width = 872; | ~~~~~~~~~~~~~~~~~~~~~~~ 682 | this->cram_height = 272; | ~~~~~~~~~~~~~~~~~~~~~~~~ 683 | this->bram_width = 128; | ~~~~~~~~~~~~~~~~~~~~~~~ 684 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 685 | } else | ~~~~~~ 686 | if (this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 687 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 688 | this->cram_height = 336; | ~~~~~~~~~~~~~~~~~~~~~~~~ 689 | this->bram_width = 160; | ~~~~~~~~~~~~~~~~~~~~~~~ 690 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | } else | ~~~~~~ 692 | if (this->device == "u4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 693 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 694 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 695 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 696 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 697 | } else | ~~~~~~ 698 | if (this->device == "lm4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 699 | this->cram_width = 656; | ~~~~~~~~~~~~~~~~~~~~~~~ 700 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 701 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 702 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | } else | ~~~~~~ 704 | error("Unsupported chip type '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 705 | | 706 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 707 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 708 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 709 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 710 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | this->cram[i][x].resize(((i % 2) == 1) ? (this->cram_height / 2 + 8) : this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | } | ~ 713 | | 714 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 715 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | int width = ((i % 2) == 1) ? (this->bram_width / 2) : this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | this->bram[i].resize(width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | for (int x = 0; x < width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | } | ~ 721 | } else { | ~~~~~~~~ 722 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 724 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | this->cram[i][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | } | ~ 727 | | 728 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 729 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | this->bram[i].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int x = 0; x < this->bram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | } | ~ 734 | } | ~ 735 | | 736 | | 737 | got_device = true; | ~~~~~~~~~~~~~~~~~~ 738 | continue; | ~~~~~~~~~ 739 | } | ~ 740 | | 741 | if (command == ".warmboot") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 742 | { | ~ 743 | is >> this->warmboot; | ~~~~~~~~~~~~~~~~~~~~~ 744 | | 745 | if (this->warmboot != "disabled" && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 746 | this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | error("Unknown warmboot setting '%s'.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~ 749 | | 750 | continue; | ~~~~~~~~~ 751 | } | ~ 752 | | 753 | // No ".nosleep" section despite sharing the same byte as .warmboot. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 754 | // ".nosleep" is specified when icepack is invoked, which is too late. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 755 | // So we inject the section based on command line argument. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 756 | if (nosleep) | ~~~~~~~~~~~~ 757 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 758 | else | ~~~~ 759 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | | 761 | if (command == ".io_tile" || command == ".logic_tile" || command == ".ramb_tile" || command == ".ramt_tile" || command.substr(0, 4) == ".dsp" || command == ".ipcon_tile") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | { | ~ 763 | if (!got_device) | ~~~~~~~~~~~~~~~~ 764 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | | 766 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 767 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 768 | | 769 | CramIndexConverter cic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 770 | | 771 | if (("." + cic.tile_type + "_tile") != command) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | error("Got %s statement for %s tile %d %d.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 773 | command.c_str(), cic.tile_type.c_str(), tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | | 775 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | { | ~ 777 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 778 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 779 | break; | ~~~~~~ 780 | } | ~ 781 | | 782 | for (int bit_x = 0; bit_x < int(line.size()) && bit_x < cic.tile_width; bit_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 783 | if (line[bit_x] == '1') { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 784 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | } | ~ 789 | | 790 | continue; | ~~~~~~~~~ 791 | } | ~ 792 | | 793 | if (command == ".ram_data") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | { | ~ 795 | if (!got_device) | ~~~~~~~~~~~~~~~~ 796 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | | 798 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 799 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 800 | | 801 | BramIndexConverter bic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 802 | | 803 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | { | ~ 805 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 806 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 807 | break; | ~~~~~~ 808 | } | ~ 809 | | 810 | for (int bit_x = 256-4, ch_idx = 0; ch_idx < int(line.size()) && bit_x >= 0; bit_x -= 4, ch_idx++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | { | ~ 812 | int value = -1; | ~~~~~~~~~~~~~~~ 813 | if ('0' <= line[ch_idx] && line[ch_idx] <= '9') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | value = line[ch_idx] - '0'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 815 | if ('a' <= line[ch_idx] && line[ch_idx] <= 'f') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 816 | value = line[ch_idx] - 'a' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 817 | if ('A' <= line[ch_idx] && line[ch_idx] <= 'F') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | value = line[ch_idx] - 'A' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | if (value < 0) | ~~~~~~~~~~~~~~ 820 | error("Not a hex character: '%c' (in line '%s')\n", line[ch_idx], line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | | 822 | for (int i = 0; i < 4; i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 823 | if ((value & (1 << i)) != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 824 | int bram_bank, bram_x, bram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | bic.get_bram_index(bit_x+i, bit_y, bram_bank, bram_x, bram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | this->bram[bram_bank][bram_x][bram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | } | ~ 828 | } | ~ 829 | } | ~ 830 | | 831 | continue; | ~~~~~~~~~ 832 | } | ~ 833 | | 834 | if (command == ".extra_bit") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 835 | { | ~ 836 | if (!got_device) | ~~~~~~~~~~~~~~~~ 837 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 838 | | 839 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 840 | is >> cram_bank >> cram_x >> cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 841 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 842 | | 843 | continue; | ~~~~~~~~~ 844 | } | ~ 845 | | 846 | if (command == ".sym") | ~~~~~~~~~~~~~~~~~~~~~~ 847 | continue; | ~~~~~~~~~ 848 | | 849 | if (command.substr(0, 1) == ".") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 850 | error("Unknown statement: %s\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 851 | error("Unexpected data line: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 852 | } | ~ 853 | } | ~ 854 | | 855 | void FpgaConfig::write_ascii(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | { | ~ 857 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | info("Writing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | | 860 | ofs << ".comment"; | ~~~~~~~~~~~~~~~~~~ 861 | bool insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 862 | for (auto ch : this->initblop) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 863 | if (ch == 0) { | ~~~~~~~~~~~~~~ 864 | insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~ 865 | } else if (ch == 0xff) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 866 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 867 | } else { | ~~~~~~~~ 868 | if (insert_newline) | ~~~~~~~~~~~~~~~~~~~ 869 | ofs << '\n'; | ~~~~~~~~~~~~ 870 | ofs << ch; | ~~~~~~~~~~ 871 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 872 | } | ~ 873 | } | ~ 874 | | 875 | ofs << stringf("\n.device %s\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 876 | if (this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 877 | ofs << stringf(".warmboot %s\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | | 879 | // As "nosleep" is an icepack command, we do not write out a ".nosleep" | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | // section. However, we parse it in read_bits() and notify the user in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | // info. | ~~~~~~~~ 882 | | 883 | typedef std::tuple tile_bit_t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 884 | std::set tile_bits; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | | 886 | for (int y = 0; y <= this->chip_height()+1; y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 887 | for (int x = 0; x <= this->chip_width()+1; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 888 | { | ~ 889 | CramIndexConverter cic(this, x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 890 | | 891 | if (cic.tile_type == "corner" || cic.tile_type == "unsupported") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 892 | continue; | ~~~~~~~~~ 893 | | 894 | ofs << stringf(".%s_tile %d %d\n", cic.tile_type.c_str(), x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 895 | | 896 | for (int bit_y = 0; bit_y < 16; bit_y++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 897 | for (int bit_x = 0; bit_x < cic.tile_width; bit_x++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 898 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 899 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 900 | tile_bits.insert(tile_bit_t(cram_bank, cram_x, cram_y)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 901 | if (cram_x > int(this->cram[cram_bank].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 902 | error("cram_x %d (bit %d, %d) larger than bank size %lu\n", cram_x, bit_x, bit_y, this->cram[cram_bank].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::vector >::size_type {aka unsigned int} icepack.cc:902:6: note: in expansion of macro 'error' 902 | error("cram_x %d (bit %d, %d) larger than bank size %lu\n", cram_x, bit_x, bit_y, this->cram[cram_bank].size()); | ^~~~~ icepack.cc:902:60: note: format string is defined here 902 | error("cram_x %d (bit %d, %d) larger than bank size %lu\n", cram_x, bit_x, bit_y, this->cram[cram_bank].size()); | ~~^ | | | long unsigned int | %u icepack.cc:53:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'std::vector::size_type' {aka 'unsigned int'} [-Wformat=] 53 | #define error(...) do { fprintf(stderr, "Error: " __VA_ARGS__); exit(1); } while (0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | #define panic(fmt, ...) do { fprintf(stderr, "Internal Error at %s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); abort(); } while (0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 | | 56 | string vstringf(const char *fmt, va_list ap) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 | { | ~ 58 | string string; | ~~~~~~~~~~~~~~ 59 | char *str = NULL; | ~~~~~~~~~~~~~~~~~ 60 | | 61 | #ifdef _WIN32 | ~~~~~~~~~~~~~ 62 | int sz = 64, rc; | ~~~~~~~~~~~~~~~~ 63 | while (1) { | ~~~~~~~~~~~ 64 | va_list apc; | ~~~~~~~~~~~~ 65 | va_copy(apc, ap); | ~~~~~~~~~~~~~~~~~ 66 | str = (char*)realloc(str, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 67 | rc = vsnprintf(str, sz, fmt, apc); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | va_end(apc); | ~~~~~~~~~~~~ 69 | if (rc >= 0 && rc < sz) | ~~~~~~~~~~~~~~~~~~~~~~~ 70 | break; | ~~~~~~ 71 | sz *= 2; | ~~~~~~~~ 72 | } | ~ 73 | #else | ~~~~~ 74 | if (vasprintf(&str, fmt, ap) < 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | str = NULL; | ~~~~~~~~~~~ 76 | #endif | ~~~~~~ 77 | | 78 | if (str != NULL) { | ~~~~~~~~~~~~~~~~~~ 79 | string = str; | ~~~~~~~~~~~~~ 80 | free(str); | ~~~~~~~~~~ 81 | } | ~ 82 | | 83 | return string; | ~~~~~~~~~~~~~~ 84 | } | ~ 85 | | 86 | string stringf(const char *fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 87 | { | ~ 88 | string string; | ~~~~~~~~~~~~~~ 89 | va_list ap; | ~~~~~~~~~~~ 90 | | 91 | va_start(ap, fmt); | ~~~~~~~~~~~~~~~~~~ 92 | string = vstringf(fmt, ap); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 93 | va_end(ap); | ~~~~~~~~~~~ 94 | | 95 | return string; | ~~~~~~~~~~~~~~ 96 | } | ~ 97 | | 98 | // ================================================================== | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 99 | // FpgaConfig stuff | ~~~~~~~~~~~~~~~~~~~ 100 | | 101 | struct FpgaConfig | ~~~~~~~~~~~~~~~~~ 102 | { | ~ 103 | string device; | ~~~~~~~~~~~~~~ 104 | string freqrange; | ~~~~~~~~~~~~~~~~~ 105 | string nosleep; | ~~~~~~~~~~~~~~~ 106 | string warmboot; | ~~~~~~~~~~~~~~~~ 107 | | 108 | // cram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 109 | int cram_width, cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | vector>> cram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | | 112 | // bram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 113 | int bram_width, bram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | vector>> bram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | | 116 | // data before preamble | ~~~~~~~~~~~~~~~~~~~~~~~ 117 | vector initblop; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | // bitstream i/o | ~~~~~~~~~~~~~~~~ 120 | void read_bits(std::istream &ifs); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | void write_bits(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | | 123 | // icebox i/o | ~~~~~~~~~~~~~ 124 | void read_ascii(std::istream &ifs, bool nosleep); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | void write_ascii(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | | 127 | // netpbm i/o | ~~~~~~~~~~~~~ 128 | void write_cram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void write_bram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | | 131 | // query chip type metadata | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 | int chip_width() const; | ~~~~~~~~~~~~~~~~~~~~~~~ 133 | int chip_height() const; | ~~~~~~~~~~~~~~~~~~~~~~~~ 134 | vector chip_cols() const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | | 136 | // query tile metadata | ~~~~~~~~~~~~~~~~~~~~~~ 137 | string tile_type(int x, int y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | int tile_width(const string &type) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | // cram bit manipulation | ~~~~~~~~~~~~~~~~~~~~~~~~ 141 | void cram_clear(); | ~~~~~~~~~~~~~~~~~~ 142 | void cram_fill_tiles(); | ~~~~~~~~~~~~~~~~~~~~~~~ 143 | void cram_checkerboard(int m = 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | }; | ~~ 145 | | 146 | struct CramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 147 | { | ~ 148 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 149 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 150 | | 151 | string tile_type; | ~~~~~~~~~~~~~~~~~ 152 | int tile_width; | ~~~~~~~~~~~~~~~ 153 | int column_width; | ~~~~~~~~~~~~~~~~~ 154 | | 155 | bool left_right_io; | ~~~~~~~~~~~~~~~~~~~ 156 | bool right_half; | ~~~~~~~~~~~~~~~~ 157 | bool top_half; | ~~~~~~~~~~~~~~ 158 | | 159 | int bank_num; | ~~~~~~~~~~~~~ 160 | int bank_tx; | ~~~~~~~~~~~~ 161 | int bank_ty; | ~~~~~~~~~~~~ 162 | int bank_xoff; | ~~~~~~~~~~~~~~ 163 | int bank_yoff; | ~~~~~~~~~~~~~~ 164 | | 165 | CramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | void get_cram_index(int bit_x, int bit_y, int &cram_bank, int &cram_x, int &cram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | }; | ~~ 168 | | 169 | struct BramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | { | ~ 171 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 173 | | 174 | int bank_num; | ~~~~~~~~~~~~~ 175 | int bank_off; | ~~~~~~~~~~~~~ 176 | | 177 | BramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 178 | void get_bram_index(int bit_x, int bit_y, int &bram_bank, int &bram_x, int &bram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 179 | }; | ~~ 180 | | 181 | static void update_crc16(uint16_t &crc, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | { | ~ 183 | // CRC-16-CCITT, Initialize to 0xFFFF, No zero padding | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | for (int i = 7; i >= 0; i--) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | uint16_t xor_value = ((crc >> 15) ^ ((byte >> i) & 1)) ? 0x1021 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | crc = (crc << 1) ^ xor_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | } | ~ 189 | | 190 | static uint8_t read_byte(std::istream &ifs, uint16_t &crc_value, int &file_offset) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | { | ~ 192 | int byte = ifs.get(); | ~~~~~~~~~~~~~~~~~~~~~ 193 | | 194 | if (byte < 0) | ~~~~~~~~~~~~~ 195 | error("Unexpected end of file.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | | 197 | file_offset++; | ~~~~~~~~~~~~~~ 198 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | | 200 | return byte; | ~~~~~~~~~~~~ 201 | } | ~ 202 | | 203 | static void write_byte(std::ostream &ofs, uint16_t &crc_value, int &file_offset, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | { | ~ 205 | ofs << byte; | ~~~~~~~~~~~~ 206 | file_offset++; | ~~~~~~~~~~~~~~ 207 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | } | ~ 209 | | 210 | void FpgaConfig::read_bits(std::istream &ifs) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 211 | { | ~ 212 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 213 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 214 | | 215 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | info("Parsing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | | 218 | // skip initial comments until preamble is found | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | | 220 | uint32_t preamble = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 221 | | 222 | while (1) | ~~~~~~~~~ 223 | { | ~ 224 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 225 | preamble = (preamble << 8) | byte; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (preamble == 0xffffffff) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | error("No preamble found in bitstream.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | if (preamble == 0x7EAA997E) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | info("Found preamble at offset %d.\n", file_offset-4); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | break; | ~~~~~~ 231 | } | ~ 232 | initblop.push_back(byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 236 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 237 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 238 | | 239 | // main parser loop | ~~~~~~~~~~~~~~~~~~~ 240 | | 241 | int current_bank = 0; | ~~~~~~~~~~~~~~~~~~~~~ 242 | int current_width = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 243 | int current_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 244 | int current_offset = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 245 | bool wakeup = false; | ~~~~~~~~~~~~~~~~~~~~ 246 | | 247 | this->cram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 248 | this->cram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 249 | | 250 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 251 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 252 | | 253 | while (!wakeup) | ~~~~~~~~~~~~~~~ 254 | { | ~ 255 | // one command byte. the lower 4 bits of the command byte specify | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | // the length of the command payload. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | | 258 | uint8_t command = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | uint32_t payload = 0; | ~~~~~~~~~~~~~~~~~~~~~ 260 | | 261 | for (int i = 0; i < (command & 0x0f); i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | payload = (payload << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 263 | | 264 | debug("Next command at offset %d: 0x%02x 0x%0*x\n", file_offset - 1 - (command & 0x0f), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | command, 2*(command & 0x0f), payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 266 | | 267 | uint16_t end_token; | ~~~~~~~~~~~~~~~~~~~ 268 | | 269 | switch (command & 0xf0) | ~~~~~~~~~~~~~~~~~~~~~~~ 270 | { | ~ 271 | case 0x00: | ~~~~~~~~~~ 272 | switch (payload) | ~~~~~~~~~~~~~~~~ 273 | { | ~ 274 | case 0x01: | ~~~~~~~~~~ 275 | info("CRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 276 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | | 279 | this->cram_width = std::max(this->cram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | this->cram_height = std::max(this->cram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | | 282 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 283 | this->cram[current_bank].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | this->cram[current_bank][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | | 287 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | this->cram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | } | ~ 294 | } | ~ 295 | | 296 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 297 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | if (end_token) | ~~~~~~~~~~~~~~ 299 | error("Expeded 0x0000 after CRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | break; | ~~~~~~ 301 | | 302 | case 0x03: | ~~~~~~~~~~ 303 | info("BRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 304 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | | 307 | this->bram_width = std::max(this->bram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | this->bram_height = std::max(this->bram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | | 310 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 311 | this->bram[current_bank].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | this->bram[current_bank][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | | 315 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 316 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | this->bram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | } | ~ 322 | } | ~ 323 | | 324 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if (end_token) | ~~~~~~~~~~~~~~ 327 | error("Expeded 0x0000 after BRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 328 | break; | ~~~~~~ 329 | | 330 | case 0x05: | ~~~~~~~~~~ 331 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 333 | break; | ~~~~~~ 334 | | 335 | case 0x06: | ~~~~~~~~~~ 336 | info("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~ 337 | wakeup = true; | ~~~~~~~~~~~~~~ 338 | break; | ~~~~~~ 339 | | 340 | default: | ~~~~~~~~ 341 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | } | ~ 343 | break; | ~~~~~~ 344 | | 345 | case 0x10: | ~~~~~~~~~~ 346 | current_bank = payload; | ~~~~~~~~~~~~~~~~~~~~~~~ 347 | debug("Set bank to %d.\n", current_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | break; | ~~~~~~ 349 | | 350 | case 0x20: | ~~~~~~~~~~ 351 | if (crc_value != 0) | ~~~~~~~~~~~~~~~~~~~ 352 | error("CRC Check FAILED.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | info("CRC Check OK.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~ 354 | break; | ~~~~~~ 355 | | 356 | case 0x50: | ~~~~~~~~~~ 357 | if (payload == 0) | ~~~~~~~~~~~~~~~~~ 358 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 359 | else if (payload == 1) | ~~~~~~~~~~~~~~~~~~~~~~ 360 | this->freqrange = "medium"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | else if (payload == 2) | ~~~~~~~~~~~~~~~~~~~~~~ 362 | this->freqrange = "high"; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | else | ~~~~ 364 | error("Unknown freqrange payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | info("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 366 | break; | ~~~~~~ 367 | | 368 | case 0x60: | ~~~~~~~~~~ 369 | current_width = payload + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | debug("Setting bank width to %d.\n", current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | break; | ~~~~~~ 372 | | 373 | case 0x70: | ~~~~~~~~~~ 374 | current_height = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 375 | debug("Setting bank height to %d.\n", current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | break; | ~~~~~~ 377 | | 378 | case 0x80: | ~~~~~~~~~~ 379 | current_offset = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 380 | debug("Setting bank offset to %d.\n", current_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 381 | break; | ~~~~~~ 382 | | 383 | case 0x90: | ~~~~~~~~~~ 384 | switch(payload) | ~~~~~~~~~~~~~~~ 385 | { | ~ 386 | case 0: | ~~~~~~~ 387 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | break; | ~~~~~~ 390 | case 1: | ~~~~~~~ 391 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | break; | ~~~~~~ 394 | case 32: | ~~~~~~~~ 395 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | break; | ~~~~~~ 398 | case 33: | ~~~~~~~~ 399 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | break; | ~~~~~~ 402 | default: | ~~~~~~~~ 403 | error("Unknown warmboot/nosleep payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | info("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | break; | ~~~~~~ 407 | | 408 | default: | ~~~~~~~~ 409 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 410 | } | ~ 411 | } | ~ 412 | | 413 | if (this->cram_width == 182 && this->cram_height == 80) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | this->device = "384"; | ~~~~~~~~~~~~~~~~~~~~~ 415 | else if (this->cram_width == 332 && this->cram_height == 144) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | this->device = "1k"; | ~~~~~~~~~~~~~~~~~~~~ 417 | else if (this->cram_width == 872 && this->cram_height == 272) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | this->device = "8k"; | ~~~~~~~~~~~~~~~~~~~~ 419 | else if (this->cram_width == 692 && this->cram_height == 336) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | this->device = "5k"; | ~~~~~~~~~~~~~~~~~~~~ 421 | else if (this->cram_width == 692 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | this->device = "u4k"; | ~~~~~~~~~~~~~~~~~~~~~ 423 | else if (this->cram_width == 656 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | this->device = "lm4k"; | ~~~~~~~~~~~~~~~~~~~~~~ 425 | else | ~~~~ 426 | error("Failed to detect chip type.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | info("Chip type is '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | } | ~ 430 | | 431 | void FpgaConfig::write_bits(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | { | ~ 433 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 434 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 435 | | 436 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | info("Writing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | | 439 | for (auto byte : this->initblop) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | ofs << byte; | ~~~~~~~~~~~~ 441 | | 442 | debug("Writing preamble.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | write_byte(ofs, crc_value, file_offset, 0xAA); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | write_byte(ofs, crc_value, file_offset, 0x99); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 447 | | 448 | debug("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 449 | write_byte(ofs, crc_value, file_offset, 0x51); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 450 | if (this->freqrange == "low") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | else if (this->freqrange == "medium") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 453 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | else if (this->freqrange == "high") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | write_byte(ofs, crc_value, file_offset, 0x02); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | else | ~~~~ 457 | error("Unknown freqrange '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | | 459 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | write_byte(ofs, crc_value, file_offset, 0x05); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 463 | | 464 | { | ~ 465 | uint8_t nosleep_flag; | ~~~~~~~~~~~~~~~~~~~~~ 466 | debug("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 467 | write_byte(ofs, crc_value, file_offset, 0x92); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 468 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | | 470 | if (this->nosleep == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 471 | nosleep_flag = 0; | ~~~~~~~~~~~~~~~~~ 472 | else if (this->nosleep == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | nosleep_flag = 1; | ~~~~~~~~~~~~~~~~~ 474 | else | ~~~~ 475 | error("Unknown nosleep setting '%s'.\n", this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 476 | | 477 | if (this->warmboot == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | write_byte(ofs, crc_value, file_offset, 0x00 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 479 | else if (this->warmboot == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 480 | write_byte(ofs, crc_value, file_offset, 0x20 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | else | ~~~~ 482 | error("Unknown warmboot setting '%s'.\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | } | ~ 484 | | 485 | debug("CRAM: Setting bank width to %d.\n", this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 487 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 488 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 489 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 490 | debug("CRAM: Setting bank height to %d.\n", this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 491 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 492 | write_byte(ofs, crc_value, file_offset, this->cram_height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 493 | write_byte(ofs, crc_value, file_offset, this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 494 | } | ~ 495 | | 496 | debug("CRAM: Setting bank offset to 0.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 497 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | for (int cram_bank = 0; cram_bank < 4; cram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 502 | { | ~ 503 | vector cram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 504 | int height = this->cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 505 | if(this->device == "5k" && ((cram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 506 | height = height / 2 + 8; | ~~~~~~~~~~~~~~~~~~~~~~~~ 507 | for (int cram_y = 0; cram_y < height; cram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | for (int cram_x = 0; cram_x < this->cram_width; cram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 509 | cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | debug("CRAM: Setting bank height to %d.\n", height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 513 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 514 | write_byte(ofs, crc_value, file_offset, height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | write_byte(ofs, crc_value, file_offset, height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | } | ~ 517 | | 518 | debug("CRAM: Setting bank %d.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 520 | write_byte(ofs, crc_value, file_offset, cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 521 | | 522 | debug("CRAM: Writing bank %d data.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 523 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 525 | for (int i = 0; i < int(cram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 526 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 527 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 528 | byte = (byte << 1) | (cram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 530 | } | ~ 531 | | 532 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 534 | } | ~ 535 | | 536 | int bram_chunk_size = 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 537 | | 538 | if (this->bram_width && this->bram_height) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 539 | { | ~ 540 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 541 | debug("BRAM: Setting bank width to %d.\n", this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 543 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 544 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 545 | } | ~ 546 | | 547 | | 548 | debug("BRAM: Setting bank height to %d.\n", this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 549 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | write_byte(ofs, crc_value, file_offset, bram_chunk_size >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 551 | write_byte(ofs, crc_value, file_offset, bram_chunk_size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | | 553 | for (int bram_bank = 0; bram_bank < 4; bram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 554 | { | ~ 555 | debug("BRAM: Setting bank %d.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 556 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 557 | write_byte(ofs, crc_value, file_offset, bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | | 559 | for (int offset = 0; offset < this->bram_height; offset += bram_chunk_size) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 560 | { | ~ 561 | vector bram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 562 | int width = this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | if(this->device == "5k" && ((bram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 564 | width = width / 2; | ~~~~~~~~~~~~~~~~~~ 565 | for (int bram_y = 0; bram_y < bram_chunk_size; bram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 566 | for (int bram_x = 0; bram_x < width; bram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | bram_bits.push_back(this->bram[bram_bank][bram_x][bram_y+offset]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | | 569 | debug("BRAM: Setting bank offset to %d.\n", offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 571 | write_byte(ofs, crc_value, file_offset, offset >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | write_byte(ofs, crc_value, file_offset, offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 573 | | 574 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | debug("BRAM: Setting bank width to %d.\n", width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | write_byte(ofs, crc_value, file_offset, (width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | write_byte(ofs, crc_value, file_offset, (width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | } | ~ 580 | | 581 | | 582 | debug("BRAM: Writing bank %d data.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 584 | write_byte(ofs, crc_value, file_offset, 0x03); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 585 | for (int i = 0; i < int(bram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 586 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 587 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 588 | byte = (byte << 1) | (bram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 589 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 590 | } | ~ 591 | | 592 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 593 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | } | ~ 595 | } | ~ 596 | } | ~ 597 | | 598 | debug("Writing CRC value.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | write_byte(ofs, crc_value, file_offset, 0x22); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | uint8_t crc_hi = crc_value >> 8, crc_lo = crc_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | write_byte(ofs, crc_value, file_offset, crc_hi); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | write_byte(ofs, crc_value, file_offset, crc_lo); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | | 604 | debug("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~~ 605 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | write_byte(ofs, crc_value, file_offset, 0x06); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 607 | | 608 | debug("Padding byte.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 609 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 610 | } | ~ 611 | | 612 | void FpgaConfig::read_ascii(std::istream &ifs, bool nosleep) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | { | ~ 614 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | info("Parsing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | | 617 | bool got_device = false; | ~~~~~~~~~~~~~~~~~~~~~~~~ 618 | this->cram.clear(); | ~~~~~~~~~~~~~~~~~~~ 619 | this->bram.clear(); | ~~~~~~~~~~~~~~~~~~~ 620 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 621 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 622 | | 623 | bool reuse_line = true; | ~~~~~~~~~~~~~~~~~~~~~~~ 624 | string line, command; | ~~~~~~~~~~~~~~~~~~~~~ 625 | | 626 | while (reuse_line || getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | { | ~ 628 | reuse_line = false; | ~~~~~~~~~~~~~~~~~~~ 629 | | 630 | std::istringstream is(line); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 631 | is >> command; | ~~~~~~~~~~~~~~ 632 | | 633 | if (command.empty()) | ~~~~~~~~~~~~~~~~~~~~ 634 | continue; | ~~~~~~~~~ 635 | | 636 | debug("Next command: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 637 | | 638 | if (command == ".comment") | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | { | ~ 640 | this->initblop.clear(); | ~~~~~~~~~~~~~~~~~~~~~~~ 641 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 642 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 643 | | 644 | while (getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | { | ~ 646 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 648 | break; | ~~~~~~ 649 | } | ~ 650 | | 651 | for (auto ch : line) | ~~~~~~~~~~~~~~~~~~~~ 652 | this->initblop.push_back(ch); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | this->initblop.push_back(0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | } | ~ 655 | | 656 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | continue; | ~~~~~~~~~ 659 | } | ~ 660 | | 661 | if (command == ".device") | ~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | { | ~ 663 | if (got_device) | ~~~~~~~~~~~~~~~ 664 | error("More than one .device statement.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | | 666 | is >> this->device; | ~~~~~~~~~~~~~~~~~~~ 667 | | 668 | if (this->device == "384") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | this->cram_width = 182; | ~~~~~~~~~~~~~~~~~~~~~~~ 670 | this->cram_height = 80; | ~~~~~~~~~~~~~~~~~~~~~~~ 671 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 672 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 673 | } else | ~~~~~~ 674 | if (this->device == "1k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | this->cram_width = 332; | ~~~~~~~~~~~~~~~~~~~~~~~ 676 | this->cram_height = 144; | ~~~~~~~~~~~~~~~~~~~~~~~~ 677 | this->bram_width = 64; | ~~~~~~~~~~~~~~~~~~~~~~ 678 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 679 | } else | ~~~~~~ 680 | if (this->device == "8k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 681 | this->cram_width = 872; | ~~~~~~~~~~~~~~~~~~~~~~~ 682 | this->cram_height = 272; | ~~~~~~~~~~~~~~~~~~~~~~~~ 683 | this->bram_width = 128; | ~~~~~~~~~~~~~~~~~~~~~~~ 684 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 685 | } else | ~~~~~~ 686 | if (this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 687 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 688 | this->cram_height = 336; | ~~~~~~~~~~~~~~~~~~~~~~~~ 689 | this->bram_width = 160; | ~~~~~~~~~~~~~~~~~~~~~~~ 690 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | } else | ~~~~~~ 692 | if (this->device == "u4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 693 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 694 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 695 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 696 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 697 | } else | ~~~~~~ 698 | if (this->device == "lm4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 699 | this->cram_width = 656; | ~~~~~~~~~~~~~~~~~~~~~~~ 700 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 701 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 702 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | } else | ~~~~~~ 704 | error("Unsupported chip type '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 705 | | 706 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 707 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 708 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 709 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 710 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | this->cram[i][x].resize(((i % 2) == 1) ? (this->cram_height / 2 + 8) : this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | } | ~ 713 | | 714 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 715 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | int width = ((i % 2) == 1) ? (this->bram_width / 2) : this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | this->bram[i].resize(width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | for (int x = 0; x < width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | } | ~ 721 | } else { | ~~~~~~~~ 722 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 724 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | this->cram[i][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | } | ~ 727 | | 728 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 729 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | this->bram[i].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int x = 0; x < this->bram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | } | ~ 734 | } | ~ 735 | | 736 | | 737 | got_device = true; | ~~~~~~~~~~~~~~~~~~ 738 | continue; | ~~~~~~~~~ 739 | } | ~ 740 | | 741 | if (command == ".warmboot") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 742 | { | ~ 743 | is >> this->warmboot; | ~~~~~~~~~~~~~~~~~~~~~ 744 | | 745 | if (this->warmboot != "disabled" && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 746 | this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | error("Unknown warmboot setting '%s'.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~ 749 | | 750 | continue; | ~~~~~~~~~ 751 | } | ~ 752 | | 753 | // No ".nosleep" section despite sharing the same byte as .warmboot. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 754 | // ".nosleep" is specified when icepack is invoked, which is too late. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 755 | // So we inject the section based on command line argument. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 756 | if (nosleep) | ~~~~~~~~~~~~ 757 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 758 | else | ~~~~ 759 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | | 761 | if (command == ".io_tile" || command == ".logic_tile" || command == ".ramb_tile" || command == ".ramt_tile" || command.substr(0, 4) == ".dsp" || command == ".ipcon_tile") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | { | ~ 763 | if (!got_device) | ~~~~~~~~~~~~~~~~ 764 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | | 766 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 767 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 768 | | 769 | CramIndexConverter cic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 770 | | 771 | if (("." + cic.tile_type + "_tile") != command) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | error("Got %s statement for %s tile %d %d.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 773 | command.c_str(), cic.tile_type.c_str(), tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | | 775 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | { | ~ 777 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 778 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 779 | break; | ~~~~~~ 780 | } | ~ 781 | | 782 | for (int bit_x = 0; bit_x < int(line.size()) && bit_x < cic.tile_width; bit_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 783 | if (line[bit_x] == '1') { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 784 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | } | ~ 789 | | 790 | continue; | ~~~~~~~~~ 791 | } | ~ 792 | | 793 | if (command == ".ram_data") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | { | ~ 795 | if (!got_device) | ~~~~~~~~~~~~~~~~ 796 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | | 798 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 799 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 800 | | 801 | BramIndexConverter bic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 802 | | 803 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | { | ~ 805 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 806 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 807 | break; | ~~~~~~ 808 | } | ~ 809 | | 810 | for (int bit_x = 256-4, ch_idx = 0; ch_idx < int(line.size()) && bit_x >= 0; bit_x -= 4, ch_idx++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | { | ~ 812 | int value = -1; | ~~~~~~~~~~~~~~~ 813 | if ('0' <= line[ch_idx] && line[ch_idx] <= '9') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | value = line[ch_idx] - '0'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 815 | if ('a' <= line[ch_idx] && line[ch_idx] <= 'f') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 816 | value = line[ch_idx] - 'a' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 817 | if ('A' <= line[ch_idx] && line[ch_idx] <= 'F') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | value = line[ch_idx] - 'A' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | if (value < 0) | ~~~~~~~~~~~~~~ 820 | error("Not a hex character: '%c' (in line '%s')\n", line[ch_idx], line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | | 822 | for (int i = 0; i < 4; i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 823 | if ((value & (1 << i)) != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 824 | int bram_bank, bram_x, bram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | bic.get_bram_index(bit_x+i, bit_y, bram_bank, bram_x, bram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | this->bram[bram_bank][bram_x][bram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | } | ~ 828 | } | ~ 829 | } | ~ 830 | | 831 | continue; | ~~~~~~~~~ 832 | } | ~ 833 | | 834 | if (command == ".extra_bit") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 835 | { | ~ 836 | if (!got_device) | ~~~~~~~~~~~~~~~~ 837 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 838 | | 839 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 840 | is >> cram_bank >> cram_x >> cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 841 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 842 | | 843 | continue; | ~~~~~~~~~ 844 | } | ~ 845 | | 846 | if (command == ".sym") | ~~~~~~~~~~~~~~~~~~~~~~ 847 | continue; | ~~~~~~~~~ 848 | | 849 | if (command.substr(0, 1) == ".") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 850 | error("Unknown statement: %s\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 851 | error("Unexpected data line: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 852 | } | ~ 853 | } | ~ 854 | | 855 | void FpgaConfig::write_ascii(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | { | ~ 857 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | info("Writing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | | 860 | ofs << ".comment"; | ~~~~~~~~~~~~~~~~~~ 861 | bool insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 862 | for (auto ch : this->initblop) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 863 | if (ch == 0) { | ~~~~~~~~~~~~~~ 864 | insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~ 865 | } else if (ch == 0xff) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 866 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 867 | } else { | ~~~~~~~~ 868 | if (insert_newline) | ~~~~~~~~~~~~~~~~~~~ 869 | ofs << '\n'; | ~~~~~~~~~~~~ 870 | ofs << ch; | ~~~~~~~~~~ 871 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 872 | } | ~ 873 | } | ~ 874 | | 875 | ofs << stringf("\n.device %s\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 876 | if (this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 877 | ofs << stringf(".warmboot %s\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | | 879 | // As "nosleep" is an icepack command, we do not write out a ".nosleep" | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | // section. However, we parse it in read_bits() and notify the user in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | // info. | ~~~~~~~~ 882 | | 883 | typedef std::tuple tile_bit_t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 884 | std::set tile_bits; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | | 886 | for (int y = 0; y <= this->chip_height()+1; y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 887 | for (int x = 0; x <= this->chip_width()+1; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 888 | { | ~ 889 | CramIndexConverter cic(this, x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 890 | | 891 | if (cic.tile_type == "corner" || cic.tile_type == "unsupported") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 892 | continue; | ~~~~~~~~~ 893 | | 894 | ofs << stringf(".%s_tile %d %d\n", cic.tile_type.c_str(), x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 895 | | 896 | for (int bit_y = 0; bit_y < 16; bit_y++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 897 | for (int bit_x = 0; bit_x < cic.tile_width; bit_x++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 898 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 899 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 900 | tile_bits.insert(tile_bit_t(cram_bank, cram_x, cram_y)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 901 | if (cram_x > int(this->cram[cram_bank].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 902 | error("cram_x %d (bit %d, %d) larger than bank size %lu\n", cram_x, bit_x, bit_y, this->cram[cram_bank].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 903 | } | ~ 904 | if (cram_y > int(this->cram[cram_bank][cram_x].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 905 | error("cram_y %d (bit %d, %d) larger than bank %d size %lu\n", cram_y, bit_x, bit_y, cram_bank, this->cram[cram_bank][cram_x].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::vector::size_type {aka unsigned int} icepack.cc:905:6: note: in expansion of macro 'error' 905 | error("cram_y %d (bit %d, %d) larger than bank %d size %lu\n", cram_y, bit_x, bit_y, cram_bank, this->cram[cram_bank][cram_x].size()); | ^~~~~ icepack.cc:905:63: note: format string is defined here 905 | error("cram_y %d (bit %d, %d) larger than bank %d size %lu\n", cram_y, bit_x, bit_y, cram_bank, this->cram[cram_bank][cram_x].size()); | ~~^ | | | long unsigned int | %u icepack.cc:53:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'std::vector >::size_type' {aka 'unsigned int'} [-Wformat=] 53 | #define error(...) do { fprintf(stderr, "Error: " __VA_ARGS__); exit(1); } while (0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | #define panic(fmt, ...) do { fprintf(stderr, "Internal Error at %s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); abort(); } while (0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 | | 56 | string vstringf(const char *fmt, va_list ap) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 | { | ~ 58 | string string; | ~~~~~~~~~~~~~~ 59 | char *str = NULL; | ~~~~~~~~~~~~~~~~~ 60 | | 61 | #ifdef _WIN32 | ~~~~~~~~~~~~~ 62 | int sz = 64, rc; | ~~~~~~~~~~~~~~~~ 63 | while (1) { | ~~~~~~~~~~~ 64 | va_list apc; | ~~~~~~~~~~~~ 65 | va_copy(apc, ap); | ~~~~~~~~~~~~~~~~~ 66 | str = (char*)realloc(str, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 67 | rc = vsnprintf(str, sz, fmt, apc); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | va_end(apc); | ~~~~~~~~~~~~ 69 | if (rc >= 0 && rc < sz) | ~~~~~~~~~~~~~~~~~~~~~~~ 70 | break; | ~~~~~~ 71 | sz *= 2; | ~~~~~~~~ 72 | } | ~ 73 | #else | ~~~~~ 74 | if (vasprintf(&str, fmt, ap) < 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | str = NULL; | ~~~~~~~~~~~ 76 | #endif | ~~~~~~ 77 | | 78 | if (str != NULL) { | ~~~~~~~~~~~~~~~~~~ 79 | string = str; | ~~~~~~~~~~~~~ 80 | free(str); | ~~~~~~~~~~ 81 | } | ~ 82 | | 83 | return string; | ~~~~~~~~~~~~~~ 84 | } | ~ 85 | | 86 | string stringf(const char *fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 87 | { | ~ 88 | string string; | ~~~~~~~~~~~~~~ 89 | va_list ap; | ~~~~~~~~~~~ 90 | | 91 | va_start(ap, fmt); | ~~~~~~~~~~~~~~~~~~ 92 | string = vstringf(fmt, ap); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 93 | va_end(ap); | ~~~~~~~~~~~ 94 | | 95 | return string; | ~~~~~~~~~~~~~~ 96 | } | ~ 97 | | 98 | // ================================================================== | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 99 | // FpgaConfig stuff | ~~~~~~~~~~~~~~~~~~~ 100 | | 101 | struct FpgaConfig | ~~~~~~~~~~~~~~~~~ 102 | { | ~ 103 | string device; | ~~~~~~~~~~~~~~ 104 | string freqrange; | ~~~~~~~~~~~~~~~~~ 105 | string nosleep; | ~~~~~~~~~~~~~~~ 106 | string warmboot; | ~~~~~~~~~~~~~~~~ 107 | | 108 | // cram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 109 | int cram_width, cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | vector>> cram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | | 112 | // bram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 113 | int bram_width, bram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | vector>> bram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | | 116 | // data before preamble | ~~~~~~~~~~~~~~~~~~~~~~~ 117 | vector initblop; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | // bitstream i/o | ~~~~~~~~~~~~~~~~ 120 | void read_bits(std::istream &ifs); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | void write_bits(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | | 123 | // icebox i/o | ~~~~~~~~~~~~~ 124 | void read_ascii(std::istream &ifs, bool nosleep); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | void write_ascii(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | | 127 | // netpbm i/o | ~~~~~~~~~~~~~ 128 | void write_cram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void write_bram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | | 131 | // query chip type metadata | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 | int chip_width() const; | ~~~~~~~~~~~~~~~~~~~~~~~ 133 | int chip_height() const; | ~~~~~~~~~~~~~~~~~~~~~~~~ 134 | vector chip_cols() const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | | 136 | // query tile metadata | ~~~~~~~~~~~~~~~~~~~~~~ 137 | string tile_type(int x, int y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | int tile_width(const string &type) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | // cram bit manipulation | ~~~~~~~~~~~~~~~~~~~~~~~~ 141 | void cram_clear(); | ~~~~~~~~~~~~~~~~~~ 142 | void cram_fill_tiles(); | ~~~~~~~~~~~~~~~~~~~~~~~ 143 | void cram_checkerboard(int m = 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | }; | ~~ 145 | | 146 | struct CramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 147 | { | ~ 148 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 149 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 150 | | 151 | string tile_type; | ~~~~~~~~~~~~~~~~~ 152 | int tile_width; | ~~~~~~~~~~~~~~~ 153 | int column_width; | ~~~~~~~~~~~~~~~~~ 154 | | 155 | bool left_right_io; | ~~~~~~~~~~~~~~~~~~~ 156 | bool right_half; | ~~~~~~~~~~~~~~~~ 157 | bool top_half; | ~~~~~~~~~~~~~~ 158 | | 159 | int bank_num; | ~~~~~~~~~~~~~ 160 | int bank_tx; | ~~~~~~~~~~~~ 161 | int bank_ty; | ~~~~~~~~~~~~ 162 | int bank_xoff; | ~~~~~~~~~~~~~~ 163 | int bank_yoff; | ~~~~~~~~~~~~~~ 164 | | 165 | CramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | void get_cram_index(int bit_x, int bit_y, int &cram_bank, int &cram_x, int &cram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | }; | ~~ 168 | | 169 | struct BramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | { | ~ 171 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 173 | | 174 | int bank_num; | ~~~~~~~~~~~~~ 175 | int bank_off; | ~~~~~~~~~~~~~ 176 | | 177 | BramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 178 | void get_bram_index(int bit_x, int bit_y, int &bram_bank, int &bram_x, int &bram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 179 | }; | ~~ 180 | | 181 | static void update_crc16(uint16_t &crc, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | { | ~ 183 | // CRC-16-CCITT, Initialize to 0xFFFF, No zero padding | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | for (int i = 7; i >= 0; i--) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | uint16_t xor_value = ((crc >> 15) ^ ((byte >> i) & 1)) ? 0x1021 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | crc = (crc << 1) ^ xor_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | } | ~ 189 | | 190 | static uint8_t read_byte(std::istream &ifs, uint16_t &crc_value, int &file_offset) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | { | ~ 192 | int byte = ifs.get(); | ~~~~~~~~~~~~~~~~~~~~~ 193 | | 194 | if (byte < 0) | ~~~~~~~~~~~~~ 195 | error("Unexpected end of file.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | | 197 | file_offset++; | ~~~~~~~~~~~~~~ 198 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | | 200 | return byte; | ~~~~~~~~~~~~ 201 | } | ~ 202 | | 203 | static void write_byte(std::ostream &ofs, uint16_t &crc_value, int &file_offset, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | { | ~ 205 | ofs << byte; | ~~~~~~~~~~~~ 206 | file_offset++; | ~~~~~~~~~~~~~~ 207 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | } | ~ 209 | | 210 | void FpgaConfig::read_bits(std::istream &ifs) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 211 | { | ~ 212 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 213 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 214 | | 215 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | info("Parsing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | | 218 | // skip initial comments until preamble is found | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | | 220 | uint32_t preamble = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 221 | | 222 | while (1) | ~~~~~~~~~ 223 | { | ~ 224 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 225 | preamble = (preamble << 8) | byte; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (preamble == 0xffffffff) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | error("No preamble found in bitstream.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | if (preamble == 0x7EAA997E) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | info("Found preamble at offset %d.\n", file_offset-4); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | break; | ~~~~~~ 231 | } | ~ 232 | initblop.push_back(byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 236 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 237 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 238 | | 239 | // main parser loop | ~~~~~~~~~~~~~~~~~~~ 240 | | 241 | int current_bank = 0; | ~~~~~~~~~~~~~~~~~~~~~ 242 | int current_width = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 243 | int current_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 244 | int current_offset = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 245 | bool wakeup = false; | ~~~~~~~~~~~~~~~~~~~~ 246 | | 247 | this->cram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 248 | this->cram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 249 | | 250 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 251 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 252 | | 253 | while (!wakeup) | ~~~~~~~~~~~~~~~ 254 | { | ~ 255 | // one command byte. the lower 4 bits of the command byte specify | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | // the length of the command payload. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | | 258 | uint8_t command = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | uint32_t payload = 0; | ~~~~~~~~~~~~~~~~~~~~~ 260 | | 261 | for (int i = 0; i < (command & 0x0f); i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | payload = (payload << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 263 | | 264 | debug("Next command at offset %d: 0x%02x 0x%0*x\n", file_offset - 1 - (command & 0x0f), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | command, 2*(command & 0x0f), payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 266 | | 267 | uint16_t end_token; | ~~~~~~~~~~~~~~~~~~~ 268 | | 269 | switch (command & 0xf0) | ~~~~~~~~~~~~~~~~~~~~~~~ 270 | { | ~ 271 | case 0x00: | ~~~~~~~~~~ 272 | switch (payload) | ~~~~~~~~~~~~~~~~ 273 | { | ~ 274 | case 0x01: | ~~~~~~~~~~ 275 | info("CRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 276 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | | 279 | this->cram_width = std::max(this->cram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | this->cram_height = std::max(this->cram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | | 282 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 283 | this->cram[current_bank].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | this->cram[current_bank][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | | 287 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | this->cram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | } | ~ 294 | } | ~ 295 | | 296 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 297 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | if (end_token) | ~~~~~~~~~~~~~~ 299 | error("Expeded 0x0000 after CRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | break; | ~~~~~~ 301 | | 302 | case 0x03: | ~~~~~~~~~~ 303 | info("BRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 304 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | | 307 | this->bram_width = std::max(this->bram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | this->bram_height = std::max(this->bram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | | 310 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 311 | this->bram[current_bank].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | this->bram[current_bank][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | | 315 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 316 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | this->bram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | } | ~ 322 | } | ~ 323 | | 324 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if (end_token) | ~~~~~~~~~~~~~~ 327 | error("Expeded 0x0000 after BRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 328 | break; | ~~~~~~ 329 | | 330 | case 0x05: | ~~~~~~~~~~ 331 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 333 | break; | ~~~~~~ 334 | | 335 | case 0x06: | ~~~~~~~~~~ 336 | info("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~ 337 | wakeup = true; | ~~~~~~~~~~~~~~ 338 | break; | ~~~~~~ 339 | | 340 | default: | ~~~~~~~~ 341 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | } | ~ 343 | break; | ~~~~~~ 344 | | 345 | case 0x10: | ~~~~~~~~~~ 346 | current_bank = payload; | ~~~~~~~~~~~~~~~~~~~~~~~ 347 | debug("Set bank to %d.\n", current_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | break; | ~~~~~~ 349 | | 350 | case 0x20: | ~~~~~~~~~~ 351 | if (crc_value != 0) | ~~~~~~~~~~~~~~~~~~~ 352 | error("CRC Check FAILED.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | info("CRC Check OK.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~ 354 | break; | ~~~~~~ 355 | | 356 | case 0x50: | ~~~~~~~~~~ 357 | if (payload == 0) | ~~~~~~~~~~~~~~~~~ 358 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 359 | else if (payload == 1) | ~~~~~~~~~~~~~~~~~~~~~~ 360 | this->freqrange = "medium"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | else if (payload == 2) | ~~~~~~~~~~~~~~~~~~~~~~ 362 | this->freqrange = "high"; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | else | ~~~~ 364 | error("Unknown freqrange payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | info("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 366 | break; | ~~~~~~ 367 | | 368 | case 0x60: | ~~~~~~~~~~ 369 | current_width = payload + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | debug("Setting bank width to %d.\n", current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | break; | ~~~~~~ 372 | | 373 | case 0x70: | ~~~~~~~~~~ 374 | current_height = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 375 | debug("Setting bank height to %d.\n", current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | break; | ~~~~~~ 377 | | 378 | case 0x80: | ~~~~~~~~~~ 379 | current_offset = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 380 | debug("Setting bank offset to %d.\n", current_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 381 | break; | ~~~~~~ 382 | | 383 | case 0x90: | ~~~~~~~~~~ 384 | switch(payload) | ~~~~~~~~~~~~~~~ 385 | { | ~ 386 | case 0: | ~~~~~~~ 387 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | break; | ~~~~~~ 390 | case 1: | ~~~~~~~ 391 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | break; | ~~~~~~ 394 | case 32: | ~~~~~~~~ 395 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | break; | ~~~~~~ 398 | case 33: | ~~~~~~~~ 399 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | break; | ~~~~~~ 402 | default: | ~~~~~~~~ 403 | error("Unknown warmboot/nosleep payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | info("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | break; | ~~~~~~ 407 | | 408 | default: | ~~~~~~~~ 409 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 410 | } | ~ 411 | } | ~ 412 | | 413 | if (this->cram_width == 182 && this->cram_height == 80) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | this->device = "384"; | ~~~~~~~~~~~~~~~~~~~~~ 415 | else if (this->cram_width == 332 && this->cram_height == 144) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | this->device = "1k"; | ~~~~~~~~~~~~~~~~~~~~ 417 | else if (this->cram_width == 872 && this->cram_height == 272) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | this->device = "8k"; | ~~~~~~~~~~~~~~~~~~~~ 419 | else if (this->cram_width == 692 && this->cram_height == 336) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | this->device = "5k"; | ~~~~~~~~~~~~~~~~~~~~ 421 | else if (this->cram_width == 692 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | this->device = "u4k"; | ~~~~~~~~~~~~~~~~~~~~~ 423 | else if (this->cram_width == 656 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | this->device = "lm4k"; | ~~~~~~~~~~~~~~~~~~~~~~ 425 | else | ~~~~ 426 | error("Failed to detect chip type.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | info("Chip type is '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | } | ~ 430 | | 431 | void FpgaConfig::write_bits(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | { | ~ 433 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 434 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 435 | | 436 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | info("Writing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | | 439 | for (auto byte : this->initblop) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | ofs << byte; | ~~~~~~~~~~~~ 441 | | 442 | debug("Writing preamble.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | write_byte(ofs, crc_value, file_offset, 0xAA); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | write_byte(ofs, crc_value, file_offset, 0x99); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 447 | | 448 | debug("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 449 | write_byte(ofs, crc_value, file_offset, 0x51); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 450 | if (this->freqrange == "low") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | else if (this->freqrange == "medium") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 453 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | else if (this->freqrange == "high") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | write_byte(ofs, crc_value, file_offset, 0x02); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | else | ~~~~ 457 | error("Unknown freqrange '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | | 459 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | write_byte(ofs, crc_value, file_offset, 0x05); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 463 | | 464 | { | ~ 465 | uint8_t nosleep_flag; | ~~~~~~~~~~~~~~~~~~~~~ 466 | debug("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 467 | write_byte(ofs, crc_value, file_offset, 0x92); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 468 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | | 470 | if (this->nosleep == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 471 | nosleep_flag = 0; | ~~~~~~~~~~~~~~~~~ 472 | else if (this->nosleep == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | nosleep_flag = 1; | ~~~~~~~~~~~~~~~~~ 474 | else | ~~~~ 475 | error("Unknown nosleep setting '%s'.\n", this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 476 | | 477 | if (this->warmboot == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | write_byte(ofs, crc_value, file_offset, 0x00 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 479 | else if (this->warmboot == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 480 | write_byte(ofs, crc_value, file_offset, 0x20 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | else | ~~~~ 482 | error("Unknown warmboot setting '%s'.\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | } | ~ 484 | | 485 | debug("CRAM: Setting bank width to %d.\n", this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 487 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 488 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 489 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 490 | debug("CRAM: Setting bank height to %d.\n", this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 491 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 492 | write_byte(ofs, crc_value, file_offset, this->cram_height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 493 | write_byte(ofs, crc_value, file_offset, this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 494 | } | ~ 495 | | 496 | debug("CRAM: Setting bank offset to 0.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 497 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | for (int cram_bank = 0; cram_bank < 4; cram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 502 | { | ~ 503 | vector cram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 504 | int height = this->cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 505 | if(this->device == "5k" && ((cram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 506 | height = height / 2 + 8; | ~~~~~~~~~~~~~~~~~~~~~~~~ 507 | for (int cram_y = 0; cram_y < height; cram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | for (int cram_x = 0; cram_x < this->cram_width; cram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 509 | cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | debug("CRAM: Setting bank height to %d.\n", height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 513 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 514 | write_byte(ofs, crc_value, file_offset, height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | write_byte(ofs, crc_value, file_offset, height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | } | ~ 517 | | 518 | debug("CRAM: Setting bank %d.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 520 | write_byte(ofs, crc_value, file_offset, cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 521 | | 522 | debug("CRAM: Writing bank %d data.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 523 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 525 | for (int i = 0; i < int(cram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 526 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 527 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 528 | byte = (byte << 1) | (cram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 530 | } | ~ 531 | | 532 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 534 | } | ~ 535 | | 536 | int bram_chunk_size = 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 537 | | 538 | if (this->bram_width && this->bram_height) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 539 | { | ~ 540 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 541 | debug("BRAM: Setting bank width to %d.\n", this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 543 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 544 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 545 | } | ~ 546 | | 547 | | 548 | debug("BRAM: Setting bank height to %d.\n", this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 549 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | write_byte(ofs, crc_value, file_offset, bram_chunk_size >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 551 | write_byte(ofs, crc_value, file_offset, bram_chunk_size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | | 553 | for (int bram_bank = 0; bram_bank < 4; bram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 554 | { | ~ 555 | debug("BRAM: Setting bank %d.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 556 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 557 | write_byte(ofs, crc_value, file_offset, bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | | 559 | for (int offset = 0; offset < this->bram_height; offset += bram_chunk_size) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 560 | { | ~ 561 | vector bram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 562 | int width = this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | if(this->device == "5k" && ((bram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 564 | width = width / 2; | ~~~~~~~~~~~~~~~~~~ 565 | for (int bram_y = 0; bram_y < bram_chunk_size; bram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 566 | for (int bram_x = 0; bram_x < width; bram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | bram_bits.push_back(this->bram[bram_bank][bram_x][bram_y+offset]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | | 569 | debug("BRAM: Setting bank offset to %d.\n", offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 571 | write_byte(ofs, crc_value, file_offset, offset >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | write_byte(ofs, crc_value, file_offset, offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 573 | | 574 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | debug("BRAM: Setting bank width to %d.\n", width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | write_byte(ofs, crc_value, file_offset, (width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | write_byte(ofs, crc_value, file_offset, (width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | } | ~ 580 | | 581 | | 582 | debug("BRAM: Writing bank %d data.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 584 | write_byte(ofs, crc_value, file_offset, 0x03); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 585 | for (int i = 0; i < int(bram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 586 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 587 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 588 | byte = (byte << 1) | (bram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 589 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 590 | } | ~ 591 | | 592 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 593 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | } | ~ 595 | } | ~ 596 | } | ~ 597 | | 598 | debug("Writing CRC value.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | write_byte(ofs, crc_value, file_offset, 0x22); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | uint8_t crc_hi = crc_value >> 8, crc_lo = crc_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | write_byte(ofs, crc_value, file_offset, crc_hi); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | write_byte(ofs, crc_value, file_offset, crc_lo); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | | 604 | debug("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~~ 605 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | write_byte(ofs, crc_value, file_offset, 0x06); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 607 | | 608 | debug("Padding byte.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 609 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 610 | } | ~ 611 | | 612 | void FpgaConfig::read_ascii(std::istream &ifs, bool nosleep) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | { | ~ 614 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | info("Parsing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | | 617 | bool got_device = false; | ~~~~~~~~~~~~~~~~~~~~~~~~ 618 | this->cram.clear(); | ~~~~~~~~~~~~~~~~~~~ 619 | this->bram.clear(); | ~~~~~~~~~~~~~~~~~~~ 620 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 621 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 622 | | 623 | bool reuse_line = true; | ~~~~~~~~~~~~~~~~~~~~~~~ 624 | string line, command; | ~~~~~~~~~~~~~~~~~~~~~ 625 | | 626 | while (reuse_line || getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | { | ~ 628 | reuse_line = false; | ~~~~~~~~~~~~~~~~~~~ 629 | | 630 | std::istringstream is(line); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 631 | is >> command; | ~~~~~~~~~~~~~~ 632 | | 633 | if (command.empty()) | ~~~~~~~~~~~~~~~~~~~~ 634 | continue; | ~~~~~~~~~ 635 | | 636 | debug("Next command: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 637 | | 638 | if (command == ".comment") | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | { | ~ 640 | this->initblop.clear(); | ~~~~~~~~~~~~~~~~~~~~~~~ 641 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 642 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 643 | | 644 | while (getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | { | ~ 646 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 648 | break; | ~~~~~~ 649 | } | ~ 650 | | 651 | for (auto ch : line) | ~~~~~~~~~~~~~~~~~~~~ 652 | this->initblop.push_back(ch); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | this->initblop.push_back(0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | } | ~ 655 | | 656 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | continue; | ~~~~~~~~~ 659 | } | ~ 660 | | 661 | if (command == ".device") | ~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | { | ~ 663 | if (got_device) | ~~~~~~~~~~~~~~~ 664 | error("More than one .device statement.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | | 666 | is >> this->device; | ~~~~~~~~~~~~~~~~~~~ 667 | | 668 | if (this->device == "384") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | this->cram_width = 182; | ~~~~~~~~~~~~~~~~~~~~~~~ 670 | this->cram_height = 80; | ~~~~~~~~~~~~~~~~~~~~~~~ 671 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 672 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 673 | } else | ~~~~~~ 674 | if (this->device == "1k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | this->cram_width = 332; | ~~~~~~~~~~~~~~~~~~~~~~~ 676 | this->cram_height = 144; | ~~~~~~~~~~~~~~~~~~~~~~~~ 677 | this->bram_width = 64; | ~~~~~~~~~~~~~~~~~~~~~~ 678 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 679 | } else | ~~~~~~ 680 | if (this->device == "8k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 681 | this->cram_width = 872; | ~~~~~~~~~~~~~~~~~~~~~~~ 682 | this->cram_height = 272; | ~~~~~~~~~~~~~~~~~~~~~~~~ 683 | this->bram_width = 128; | ~~~~~~~~~~~~~~~~~~~~~~~ 684 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 685 | } else | ~~~~~~ 686 | if (this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 687 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 688 | this->cram_height = 336; | ~~~~~~~~~~~~~~~~~~~~~~~~ 689 | this->bram_width = 160; | ~~~~~~~~~~~~~~~~~~~~~~~ 690 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | } else | ~~~~~~ 692 | if (this->device == "u4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 693 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 694 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 695 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 696 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 697 | } else | ~~~~~~ 698 | if (this->device == "lm4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 699 | this->cram_width = 656; | ~~~~~~~~~~~~~~~~~~~~~~~ 700 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 701 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 702 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | } else | ~~~~~~ 704 | error("Unsupported chip type '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 705 | | 706 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 707 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 708 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 709 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 710 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | this->cram[i][x].resize(((i % 2) == 1) ? (this->cram_height / 2 + 8) : this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | } | ~ 713 | | 714 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 715 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | int width = ((i % 2) == 1) ? (this->bram_width / 2) : this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | this->bram[i].resize(width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | for (int x = 0; x < width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | } | ~ 721 | } else { | ~~~~~~~~ 722 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 724 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | this->cram[i][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | } | ~ 727 | | 728 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 729 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | this->bram[i].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int x = 0; x < this->bram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | } | ~ 734 | } | ~ 735 | | 736 | | 737 | got_device = true; | ~~~~~~~~~~~~~~~~~~ 738 | continue; | ~~~~~~~~~ 739 | } | ~ 740 | | 741 | if (command == ".warmboot") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 742 | { | ~ 743 | is >> this->warmboot; | ~~~~~~~~~~~~~~~~~~~~~ 744 | | 745 | if (this->warmboot != "disabled" && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 746 | this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | error("Unknown warmboot setting '%s'.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~ 749 | | 750 | continue; | ~~~~~~~~~ 751 | } | ~ 752 | | 753 | // No ".nosleep" section despite sharing the same byte as .warmboot. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 754 | // ".nosleep" is specified when icepack is invoked, which is too late. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 755 | // So we inject the section based on command line argument. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 756 | if (nosleep) | ~~~~~~~~~~~~ 757 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 758 | else | ~~~~ 759 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | | 761 | if (command == ".io_tile" || command == ".logic_tile" || command == ".ramb_tile" || command == ".ramt_tile" || command.substr(0, 4) == ".dsp" || command == ".ipcon_tile") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | { | ~ 763 | if (!got_device) | ~~~~~~~~~~~~~~~~ 764 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | | 766 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 767 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 768 | | 769 | CramIndexConverter cic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 770 | | 771 | if (("." + cic.tile_type + "_tile") != command) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | error("Got %s statement for %s tile %d %d.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 773 | command.c_str(), cic.tile_type.c_str(), tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | | 775 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | { | ~ 777 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 778 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 779 | break; | ~~~~~~ 780 | } | ~ 781 | | 782 | for (int bit_x = 0; bit_x < int(line.size()) && bit_x < cic.tile_width; bit_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 783 | if (line[bit_x] == '1') { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 784 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | } | ~ 789 | | 790 | continue; | ~~~~~~~~~ 791 | } | ~ 792 | | 793 | if (command == ".ram_data") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | { | ~ 795 | if (!got_device) | ~~~~~~~~~~~~~~~~ 796 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | | 798 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 799 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 800 | | 801 | BramIndexConverter bic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 802 | | 803 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | { | ~ 805 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 806 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 807 | break; | ~~~~~~ 808 | } | ~ 809 | | 810 | for (int bit_x = 256-4, ch_idx = 0; ch_idx < int(line.size()) && bit_x >= 0; bit_x -= 4, ch_idx++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | { | ~ 812 | int value = -1; | ~~~~~~~~~~~~~~~ 813 | if ('0' <= line[ch_idx] && line[ch_idx] <= '9') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | value = line[ch_idx] - '0'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 815 | if ('a' <= line[ch_idx] && line[ch_idx] <= 'f') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 816 | value = line[ch_idx] - 'a' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 817 | if ('A' <= line[ch_idx] && line[ch_idx] <= 'F') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | value = line[ch_idx] - 'A' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | if (value < 0) | ~~~~~~~~~~~~~~ 820 | error("Not a hex character: '%c' (in line '%s')\n", line[ch_idx], line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | | 822 | for (int i = 0; i < 4; i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 823 | if ((value & (1 << i)) != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 824 | int bram_bank, bram_x, bram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | bic.get_bram_index(bit_x+i, bit_y, bram_bank, bram_x, bram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | this->bram[bram_bank][bram_x][bram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | } | ~ 828 | } | ~ 829 | } | ~ 830 | | 831 | continue; | ~~~~~~~~~ 832 | } | ~ 833 | | 834 | if (command == ".extra_bit") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 835 | { | ~ 836 | if (!got_device) | ~~~~~~~~~~~~~~~~ 837 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 838 | | 839 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 840 | is >> cram_bank >> cram_x >> cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 841 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 842 | | 843 | continue; | ~~~~~~~~~ 844 | } | ~ 845 | | 846 | if (command == ".sym") | ~~~~~~~~~~~~~~~~~~~~~~ 847 | continue; | ~~~~~~~~~ 848 | | 849 | if (command.substr(0, 1) == ".") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 850 | error("Unknown statement: %s\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 851 | error("Unexpected data line: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 852 | } | ~ 853 | } | ~ 854 | | 855 | void FpgaConfig::write_ascii(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | { | ~ 857 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | info("Writing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | | 860 | ofs << ".comment"; | ~~~~~~~~~~~~~~~~~~ 861 | bool insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 862 | for (auto ch : this->initblop) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 863 | if (ch == 0) { | ~~~~~~~~~~~~~~ 864 | insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~ 865 | } else if (ch == 0xff) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 866 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 867 | } else { | ~~~~~~~~ 868 | if (insert_newline) | ~~~~~~~~~~~~~~~~~~~ 869 | ofs << '\n'; | ~~~~~~~~~~~~ 870 | ofs << ch; | ~~~~~~~~~~ 871 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 872 | } | ~ 873 | } | ~ 874 | | 875 | ofs << stringf("\n.device %s\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 876 | if (this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 877 | ofs << stringf(".warmboot %s\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | | 879 | // As "nosleep" is an icepack command, we do not write out a ".nosleep" | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | // section. However, we parse it in read_bits() and notify the user in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | // info. | ~~~~~~~~ 882 | | 883 | typedef std::tuple tile_bit_t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 884 | std::set tile_bits; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | | 886 | for (int y = 0; y <= this->chip_height()+1; y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 887 | for (int x = 0; x <= this->chip_width()+1; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 888 | { | ~ 889 | CramIndexConverter cic(this, x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 890 | | 891 | if (cic.tile_type == "corner" || cic.tile_type == "unsupported") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 892 | continue; | ~~~~~~~~~ 893 | | 894 | ofs << stringf(".%s_tile %d %d\n", cic.tile_type.c_str(), x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 895 | | 896 | for (int bit_y = 0; bit_y < 16; bit_y++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 897 | for (int bit_x = 0; bit_x < cic.tile_width; bit_x++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 898 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 899 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 900 | tile_bits.insert(tile_bit_t(cram_bank, cram_x, cram_y)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 901 | if (cram_x > int(this->cram[cram_bank].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 902 | error("cram_x %d (bit %d, %d) larger than bank size %lu\n", cram_x, bit_x, bit_y, this->cram[cram_bank].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 903 | } | ~ 904 | if (cram_y > int(this->cram[cram_bank][cram_x].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 905 | error("cram_y %d (bit %d, %d) larger than bank %d size %lu\n", cram_y, bit_x, bit_y, cram_bank, this->cram[cram_bank][cram_x].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | } | ~ 907 | ofs << (this->cram[cram_bank][cram_x][cram_y] ? '1' : '0'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 908 | } | ~ 909 | ofs << '\n'; | ~~~~~~~~~~~~ 910 | } | ~ 911 | | 912 | if (cic.tile_type == "ramb") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 913 | { | ~ 914 | BramIndexConverter bic(this, x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 915 | ofs << stringf(".ram_data %d %d\n", x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 916 | | 917 | for (int bit_y = 0; bit_y < 16; bit_y++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 918 | for (int bit_x = 256-4; bit_x >= 0; bit_x -= 4) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 919 | int value = 0; | ~~~~~~~~~~~~~~ 920 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 921 | int bram_bank, bram_x, bram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | bic.get_bram_index(bit_x+i, bit_y, bram_bank, bram_x, bram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 923 | if (bram_x >= int(this->bram[bram_bank].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 924 | error("%d %d bram_x %d higher than loaded bram size %lu\n",bit_x+i, bit_y, bram_x, this->bram[bram_bank].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::vector >::size_type {aka unsigned int} icepack.cc:924:8: note: in expansion of macro 'error' 924 | error("%d %d bram_x %d higher than loaded bram size %lu\n",bit_x+i, bit_y, bram_x, this->bram[bram_bank].size()); | ^~~~~ icepack.cc:924:62: note: format string is defined here 924 | error("%d %d bram_x %d higher than loaded bram size %lu\n",bit_x+i, bit_y, bram_x, this->bram[bram_bank].size()); | ~~^ | | | long unsigned int | %u icepack.cc:53:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'std::vector::size_type' {aka 'unsigned int'} [-Wformat=] 53 | #define error(...) do { fprintf(stderr, "Error: " __VA_ARGS__); exit(1); } while (0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | #define panic(fmt, ...) do { fprintf(stderr, "Internal Error at %s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); abort(); } while (0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 | | 56 | string vstringf(const char *fmt, va_list ap) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 | { | ~ 58 | string string; | ~~~~~~~~~~~~~~ 59 | char *str = NULL; | ~~~~~~~~~~~~~~~~~ 60 | | 61 | #ifdef _WIN32 | ~~~~~~~~~~~~~ 62 | int sz = 64, rc; | ~~~~~~~~~~~~~~~~ 63 | while (1) { | ~~~~~~~~~~~ 64 | va_list apc; | ~~~~~~~~~~~~ 65 | va_copy(apc, ap); | ~~~~~~~~~~~~~~~~~ 66 | str = (char*)realloc(str, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 67 | rc = vsnprintf(str, sz, fmt, apc); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | va_end(apc); | ~~~~~~~~~~~~ 69 | if (rc >= 0 && rc < sz) | ~~~~~~~~~~~~~~~~~~~~~~~ 70 | break; | ~~~~~~ 71 | sz *= 2; | ~~~~~~~~ 72 | } | ~ 73 | #else | ~~~~~ 74 | if (vasprintf(&str, fmt, ap) < 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | str = NULL; | ~~~~~~~~~~~ 76 | #endif | ~~~~~~ 77 | | 78 | if (str != NULL) { | ~~~~~~~~~~~~~~~~~~ 79 | string = str; | ~~~~~~~~~~~~~ 80 | free(str); | ~~~~~~~~~~ 81 | } | ~ 82 | | 83 | return string; | ~~~~~~~~~~~~~~ 84 | } | ~ 85 | | 86 | string stringf(const char *fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 87 | { | ~ 88 | string string; | ~~~~~~~~~~~~~~ 89 | va_list ap; | ~~~~~~~~~~~ 90 | | 91 | va_start(ap, fmt); | ~~~~~~~~~~~~~~~~~~ 92 | string = vstringf(fmt, ap); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 93 | va_end(ap); | ~~~~~~~~~~~ 94 | | 95 | return string; | ~~~~~~~~~~~~~~ 96 | } | ~ 97 | | 98 | // ================================================================== | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 99 | // FpgaConfig stuff | ~~~~~~~~~~~~~~~~~~~ 100 | | 101 | struct FpgaConfig | ~~~~~~~~~~~~~~~~~ 102 | { | ~ 103 | string device; | ~~~~~~~~~~~~~~ 104 | string freqrange; | ~~~~~~~~~~~~~~~~~ 105 | string nosleep; | ~~~~~~~~~~~~~~~ 106 | string warmboot; | ~~~~~~~~~~~~~~~~ 107 | | 108 | // cram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 109 | int cram_width, cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | vector>> cram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | | 112 | // bram[BANK][X][Y] | ~~~~~~~~~~~~~~~~~~~ 113 | int bram_width, bram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | vector>> bram; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | | 116 | // data before preamble | ~~~~~~~~~~~~~~~~~~~~~~~ 117 | vector initblop; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | // bitstream i/o | ~~~~~~~~~~~~~~~~ 120 | void read_bits(std::istream &ifs); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | void write_bits(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | | 123 | // icebox i/o | ~~~~~~~~~~~~~ 124 | void read_ascii(std::istream &ifs, bool nosleep); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | void write_ascii(std::ostream &ofs) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | | 127 | // netpbm i/o | ~~~~~~~~~~~~~ 128 | void write_cram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void write_bram_pbm(std::ostream &ofs, int bank_num = -1) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | | 131 | // query chip type metadata | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 | int chip_width() const; | ~~~~~~~~~~~~~~~~~~~~~~~ 133 | int chip_height() const; | ~~~~~~~~~~~~~~~~~~~~~~~~ 134 | vector chip_cols() const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | | 136 | // query tile metadata | ~~~~~~~~~~~~~~~~~~~~~~ 137 | string tile_type(int x, int y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | int tile_width(const string &type) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | // cram bit manipulation | ~~~~~~~~~~~~~~~~~~~~~~~~ 141 | void cram_clear(); | ~~~~~~~~~~~~~~~~~~ 142 | void cram_fill_tiles(); | ~~~~~~~~~~~~~~~~~~~~~~~ 143 | void cram_checkerboard(int m = 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | }; | ~~ 145 | | 146 | struct CramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 147 | { | ~ 148 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 149 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 150 | | 151 | string tile_type; | ~~~~~~~~~~~~~~~~~ 152 | int tile_width; | ~~~~~~~~~~~~~~~ 153 | int column_width; | ~~~~~~~~~~~~~~~~~ 154 | | 155 | bool left_right_io; | ~~~~~~~~~~~~~~~~~~~ 156 | bool right_half; | ~~~~~~~~~~~~~~~~ 157 | bool top_half; | ~~~~~~~~~~~~~~ 158 | | 159 | int bank_num; | ~~~~~~~~~~~~~ 160 | int bank_tx; | ~~~~~~~~~~~~ 161 | int bank_ty; | ~~~~~~~~~~~~ 162 | int bank_xoff; | ~~~~~~~~~~~~~~ 163 | int bank_yoff; | ~~~~~~~~~~~~~~ 164 | | 165 | CramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | void get_cram_index(int bit_x, int bit_y, int &cram_bank, int &cram_x, int &cram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | }; | ~~ 168 | | 169 | struct BramIndexConverter | ~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | { | ~ 171 | const FpgaConfig *fpga; | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 173 | | 174 | int bank_num; | ~~~~~~~~~~~~~ 175 | int bank_off; | ~~~~~~~~~~~~~ 176 | | 177 | BramIndexConverter(const FpgaConfig *fpga, int tile_x, int tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 178 | void get_bram_index(int bit_x, int bit_y, int &bram_bank, int &bram_x, int &bram_y) const; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 179 | }; | ~~ 180 | | 181 | static void update_crc16(uint16_t &crc, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | { | ~ 183 | // CRC-16-CCITT, Initialize to 0xFFFF, No zero padding | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | for (int i = 7; i >= 0; i--) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | uint16_t xor_value = ((crc >> 15) ^ ((byte >> i) & 1)) ? 0x1021 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | crc = (crc << 1) ^ xor_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | } | ~ 189 | | 190 | static uint8_t read_byte(std::istream &ifs, uint16_t &crc_value, int &file_offset) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | { | ~ 192 | int byte = ifs.get(); | ~~~~~~~~~~~~~~~~~~~~~ 193 | | 194 | if (byte < 0) | ~~~~~~~~~~~~~ 195 | error("Unexpected end of file.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | | 197 | file_offset++; | ~~~~~~~~~~~~~~ 198 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | | 200 | return byte; | ~~~~~~~~~~~~ 201 | } | ~ 202 | | 203 | static void write_byte(std::ostream &ofs, uint16_t &crc_value, int &file_offset, uint8_t byte) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | { | ~ 205 | ofs << byte; | ~~~~~~~~~~~~ 206 | file_offset++; | ~~~~~~~~~~~~~~ 207 | update_crc16(crc_value, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | } | ~ 209 | | 210 | void FpgaConfig::read_bits(std::istream &ifs) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 211 | { | ~ 212 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 213 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 214 | | 215 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | info("Parsing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | | 218 | // skip initial comments until preamble is found | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | | 220 | uint32_t preamble = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 221 | | 222 | while (1) | ~~~~~~~~~ 223 | { | ~ 224 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 225 | preamble = (preamble << 8) | byte; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (preamble == 0xffffffff) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | error("No preamble found in bitstream.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | if (preamble == 0x7EAA997E) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | info("Found preamble at offset %d.\n", file_offset-4); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | break; | ~~~~~~ 231 | } | ~ 232 | initblop.push_back(byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 236 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 237 | initblop.pop_back(); | ~~~~~~~~~~~~~~~~~~~~ 238 | | 239 | // main parser loop | ~~~~~~~~~~~~~~~~~~~ 240 | | 241 | int current_bank = 0; | ~~~~~~~~~~~~~~~~~~~~~ 242 | int current_width = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 243 | int current_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 244 | int current_offset = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 245 | bool wakeup = false; | ~~~~~~~~~~~~~~~~~~~~ 246 | | 247 | this->cram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 248 | this->cram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 249 | | 250 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 251 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 252 | | 253 | while (!wakeup) | ~~~~~~~~~~~~~~~ 254 | { | ~ 255 | // one command byte. the lower 4 bits of the command byte specify | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | // the length of the command payload. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | | 258 | uint8_t command = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | uint32_t payload = 0; | ~~~~~~~~~~~~~~~~~~~~~ 260 | | 261 | for (int i = 0; i < (command & 0x0f); i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | payload = (payload << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 263 | | 264 | debug("Next command at offset %d: 0x%02x 0x%0*x\n", file_offset - 1 - (command & 0x0f), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | command, 2*(command & 0x0f), payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 266 | | 267 | uint16_t end_token; | ~~~~~~~~~~~~~~~~~~~ 268 | | 269 | switch (command & 0xf0) | ~~~~~~~~~~~~~~~~~~~~~~~ 270 | { | ~ 271 | case 0x00: | ~~~~~~~~~~ 272 | switch (payload) | ~~~~~~~~~~~~~~~~ 273 | { | ~ 274 | case 0x01: | ~~~~~~~~~~ 275 | info("CRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 276 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | | 279 | this->cram_width = std::max(this->cram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | this->cram_height = std::max(this->cram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | | 282 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 283 | this->cram[current_bank].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | this->cram[current_bank][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | | 287 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | this->cram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | } | ~ 294 | } | ~ 295 | | 296 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 297 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | if (end_token) | ~~~~~~~~~~~~~~ 299 | error("Expeded 0x0000 after CRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | break; | ~~~~~~ 301 | | 302 | case 0x03: | ~~~~~~~~~~ 303 | info("BRAM Data [%d]: %d x %d bits = %d bits = %d bytes\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 304 | current_bank, current_width, current_height, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305 | current_height*current_width, (current_height*current_width)/8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | | 307 | this->bram_width = std::max(this->bram_width, current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | this->bram_height = std::max(this->bram_height, current_offset + current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | | 310 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 311 | this->bram[current_bank].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | for (int x = 0; x < current_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | this->bram[current_bank][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | | 315 | for (int i = 0; i < (current_height*current_width)/8; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 316 | uint8_t byte = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | for (int j = 0; j < 8; j++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | int x = (i*8 + j) % current_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | int y = (i*8 + j) / current_width + current_offset; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | this->bram[current_bank][x][y] = ((byte << j) & 0x80) != 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | } | ~ 322 | } | ~ 323 | | 324 | end_token = read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | end_token = (end_token << 8) | read_byte(ifs, crc_value, file_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if (end_token) | ~~~~~~~~~~~~~~ 327 | error("Expeded 0x0000 after BRAM data, got 0x%04x\n", end_token); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 328 | break; | ~~~~~~ 329 | | 330 | case 0x05: | ~~~~~~~~~~ 331 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 333 | break; | ~~~~~~ 334 | | 335 | case 0x06: | ~~~~~~~~~~ 336 | info("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~ 337 | wakeup = true; | ~~~~~~~~~~~~~~ 338 | break; | ~~~~~~ 339 | | 340 | default: | ~~~~~~~~ 341 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | } | ~ 343 | break; | ~~~~~~ 344 | | 345 | case 0x10: | ~~~~~~~~~~ 346 | current_bank = payload; | ~~~~~~~~~~~~~~~~~~~~~~~ 347 | debug("Set bank to %d.\n", current_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | break; | ~~~~~~ 349 | | 350 | case 0x20: | ~~~~~~~~~~ 351 | if (crc_value != 0) | ~~~~~~~~~~~~~~~~~~~ 352 | error("CRC Check FAILED.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | info("CRC Check OK.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~ 354 | break; | ~~~~~~ 355 | | 356 | case 0x50: | ~~~~~~~~~~ 357 | if (payload == 0) | ~~~~~~~~~~~~~~~~~ 358 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 359 | else if (payload == 1) | ~~~~~~~~~~~~~~~~~~~~~~ 360 | this->freqrange = "medium"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | else if (payload == 2) | ~~~~~~~~~~~~~~~~~~~~~~ 362 | this->freqrange = "high"; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | else | ~~~~ 364 | error("Unknown freqrange payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | info("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 366 | break; | ~~~~~~ 367 | | 368 | case 0x60: | ~~~~~~~~~~ 369 | current_width = payload + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | debug("Setting bank width to %d.\n", current_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | break; | ~~~~~~ 372 | | 373 | case 0x70: | ~~~~~~~~~~ 374 | current_height = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 375 | debug("Setting bank height to %d.\n", current_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | break; | ~~~~~~ 377 | | 378 | case 0x80: | ~~~~~~~~~~ 379 | current_offset = payload; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 380 | debug("Setting bank offset to %d.\n", current_offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 381 | break; | ~~~~~~ 382 | | 383 | case 0x90: | ~~~~~~~~~~ 384 | switch(payload) | ~~~~~~~~~~~~~~~ 385 | { | ~ 386 | case 0: | ~~~~~~~ 387 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | break; | ~~~~~~ 390 | case 1: | ~~~~~~~ 391 | this->warmboot = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | break; | ~~~~~~ 394 | case 32: | ~~~~~~~~ 395 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | break; | ~~~~~~ 398 | case 33: | ~~~~~~~~ 399 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | break; | ~~~~~~ 402 | default: | ~~~~~~~~ 403 | error("Unknown warmboot/nosleep payload 0x%02x\n", payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | info("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | break; | ~~~~~~ 407 | | 408 | default: | ~~~~~~~~ 409 | error("Unknown command: 0x%02x 0x%02x\n", command, payload); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 410 | } | ~ 411 | } | ~ 412 | | 413 | if (this->cram_width == 182 && this->cram_height == 80) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | this->device = "384"; | ~~~~~~~~~~~~~~~~~~~~~ 415 | else if (this->cram_width == 332 && this->cram_height == 144) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | this->device = "1k"; | ~~~~~~~~~~~~~~~~~~~~ 417 | else if (this->cram_width == 872 && this->cram_height == 272) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | this->device = "8k"; | ~~~~~~~~~~~~~~~~~~~~ 419 | else if (this->cram_width == 692 && this->cram_height == 336) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | this->device = "5k"; | ~~~~~~~~~~~~~~~~~~~~ 421 | else if (this->cram_width == 692 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | this->device = "u4k"; | ~~~~~~~~~~~~~~~~~~~~~ 423 | else if (this->cram_width == 656 && this->cram_height == 176) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | this->device = "lm4k"; | ~~~~~~~~~~~~~~~~~~~~~~ 425 | else | ~~~~ 426 | error("Failed to detect chip type.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | info("Chip type is '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | } | ~ 430 | | 431 | void FpgaConfig::write_bits(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | { | ~ 433 | int file_offset = 0; | ~~~~~~~~~~~~~~~~~~~~ 434 | uint16_t crc_value = 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 435 | | 436 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | info("Writing bitstream file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | | 439 | for (auto byte : this->initblop) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | ofs << byte; | ~~~~~~~~~~~~ 441 | | 442 | debug("Writing preamble.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | write_byte(ofs, crc_value, file_offset, 0xAA); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | write_byte(ofs, crc_value, file_offset, 0x99); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | write_byte(ofs, crc_value, file_offset, 0x7E); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 447 | | 448 | debug("Setting freqrange to '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 449 | write_byte(ofs, crc_value, file_offset, 0x51); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 450 | if (this->freqrange == "low") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | else if (this->freqrange == "medium") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 453 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | else if (this->freqrange == "high") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | write_byte(ofs, crc_value, file_offset, 0x02); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | else | ~~~~ 457 | error("Unknown freqrange '%s'.\n", this->freqrange.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | | 459 | debug("Resetting CRC.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | write_byte(ofs, crc_value, file_offset, 0x05); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | crc_value = 0xffff; | ~~~~~~~~~~~~~~~~~~~ 463 | | 464 | { | ~ 465 | uint8_t nosleep_flag; | ~~~~~~~~~~~~~~~~~~~~~ 466 | debug("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 467 | write_byte(ofs, crc_value, file_offset, 0x92); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 468 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | | 470 | if (this->nosleep == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 471 | nosleep_flag = 0; | ~~~~~~~~~~~~~~~~~ 472 | else if (this->nosleep == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | nosleep_flag = 1; | ~~~~~~~~~~~~~~~~~ 474 | else | ~~~~ 475 | error("Unknown nosleep setting '%s'.\n", this->nosleep.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 476 | | 477 | if (this->warmboot == "disabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | write_byte(ofs, crc_value, file_offset, 0x00 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 479 | else if (this->warmboot == "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 480 | write_byte(ofs, crc_value, file_offset, 0x20 | nosleep_flag); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | else | ~~~~ 482 | error("Unknown warmboot setting '%s'.\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | } | ~ 484 | | 485 | debug("CRAM: Setting bank width to %d.\n", this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 487 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 488 | write_byte(ofs, crc_value, file_offset, (this->cram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 489 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 490 | debug("CRAM: Setting bank height to %d.\n", this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 491 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 492 | write_byte(ofs, crc_value, file_offset, this->cram_height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 493 | write_byte(ofs, crc_value, file_offset, this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 494 | } | ~ 495 | | 496 | debug("CRAM: Setting bank offset to 0.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 497 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | for (int cram_bank = 0; cram_bank < 4; cram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 502 | { | ~ 503 | vector cram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 504 | int height = this->cram_height; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 505 | if(this->device == "5k" && ((cram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 506 | height = height / 2 + 8; | ~~~~~~~~~~~~~~~~~~~~~~~~ 507 | for (int cram_y = 0; cram_y < height; cram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | for (int cram_x = 0; cram_x < this->cram_width; cram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 509 | cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | debug("CRAM: Setting bank height to %d.\n", height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 513 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 514 | write_byte(ofs, crc_value, file_offset, height >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | write_byte(ofs, crc_value, file_offset, height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | } | ~ 517 | | 518 | debug("CRAM: Setting bank %d.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 520 | write_byte(ofs, crc_value, file_offset, cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 521 | | 522 | debug("CRAM: Writing bank %d data.\n", cram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 523 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 525 | for (int i = 0; i < int(cram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 526 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 527 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 528 | byte = (byte << 1) | (cram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 530 | } | ~ 531 | | 532 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 534 | } | ~ 535 | | 536 | int bram_chunk_size = 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 537 | | 538 | if (this->bram_width && this->bram_height) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 539 | { | ~ 540 | if(this->device != "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 541 | debug("BRAM: Setting bank width to %d.\n", this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 543 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 544 | write_byte(ofs, crc_value, file_offset, (this->bram_width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 545 | } | ~ 546 | | 547 | | 548 | debug("BRAM: Setting bank height to %d.\n", this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 549 | write_byte(ofs, crc_value, file_offset, 0x72); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | write_byte(ofs, crc_value, file_offset, bram_chunk_size >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 551 | write_byte(ofs, crc_value, file_offset, bram_chunk_size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | | 553 | for (int bram_bank = 0; bram_bank < 4; bram_bank++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 554 | { | ~ 555 | debug("BRAM: Setting bank %d.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 556 | write_byte(ofs, crc_value, file_offset, 0x11); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 557 | write_byte(ofs, crc_value, file_offset, bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | | 559 | for (int offset = 0; offset < this->bram_height; offset += bram_chunk_size) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 560 | { | ~ 561 | vector bram_bits; | ~~~~~~~~~~~~~~~~~~~~~~~ 562 | int width = this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | if(this->device == "5k" && ((bram_bank % 2) == 1)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 564 | width = width / 2; | ~~~~~~~~~~~~~~~~~~ 565 | for (int bram_y = 0; bram_y < bram_chunk_size; bram_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 566 | for (int bram_x = 0; bram_x < width; bram_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | bram_bits.push_back(this->bram[bram_bank][bram_x][bram_y+offset]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | | 569 | debug("BRAM: Setting bank offset to %d.\n", offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | write_byte(ofs, crc_value, file_offset, 0x82); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 571 | write_byte(ofs, crc_value, file_offset, offset >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | write_byte(ofs, crc_value, file_offset, offset); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 573 | | 574 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | debug("BRAM: Setting bank width to %d.\n", width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | write_byte(ofs, crc_value, file_offset, 0x62); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | write_byte(ofs, crc_value, file_offset, (width-1) >> 8); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | write_byte(ofs, crc_value, file_offset, (width-1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | } | ~ 580 | | 581 | | 582 | debug("BRAM: Writing bank %d data.\n", bram_bank); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 584 | write_byte(ofs, crc_value, file_offset, 0x03); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 585 | for (int i = 0; i < int(bram_bits.size()); i += 8) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 586 | uint8_t byte = 0; | ~~~~~~~~~~~~~~~~~ 587 | for (int j = 0; j < 8; j++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 588 | byte = (byte << 1) | (bram_bits[i+j] ? 1 : 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 589 | write_byte(ofs, crc_value, file_offset, byte); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 590 | } | ~ 591 | | 592 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 593 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | } | ~ 595 | } | ~ 596 | } | ~ 597 | | 598 | debug("Writing CRC value.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | write_byte(ofs, crc_value, file_offset, 0x22); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | uint8_t crc_hi = crc_value >> 8, crc_lo = crc_value; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | write_byte(ofs, crc_value, file_offset, crc_hi); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | write_byte(ofs, crc_value, file_offset, crc_lo); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | | 604 | debug("Wakeup.\n"); | ~~~~~~~~~~~~~~~~~~~ 605 | write_byte(ofs, crc_value, file_offset, 0x01); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | write_byte(ofs, crc_value, file_offset, 0x06); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 607 | | 608 | debug("Padding byte.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 609 | write_byte(ofs, crc_value, file_offset, 0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 610 | } | ~ 611 | | 612 | void FpgaConfig::read_ascii(std::istream &ifs, bool nosleep) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | { | ~ 614 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | info("Parsing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | | 617 | bool got_device = false; | ~~~~~~~~~~~~~~~~~~~~~~~~ 618 | this->cram.clear(); | ~~~~~~~~~~~~~~~~~~~ 619 | this->bram.clear(); | ~~~~~~~~~~~~~~~~~~~ 620 | this->freqrange = "low"; | ~~~~~~~~~~~~~~~~~~~~~~~~ 621 | this->warmboot = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 622 | | 623 | bool reuse_line = true; | ~~~~~~~~~~~~~~~~~~~~~~~ 624 | string line, command; | ~~~~~~~~~~~~~~~~~~~~~ 625 | | 626 | while (reuse_line || getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | { | ~ 628 | reuse_line = false; | ~~~~~~~~~~~~~~~~~~~ 629 | | 630 | std::istringstream is(line); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 631 | is >> command; | ~~~~~~~~~~~~~~ 632 | | 633 | if (command.empty()) | ~~~~~~~~~~~~~~~~~~~~ 634 | continue; | ~~~~~~~~~ 635 | | 636 | debug("Next command: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 637 | | 638 | if (command == ".comment") | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | { | ~ 640 | this->initblop.clear(); | ~~~~~~~~~~~~~~~~~~~~~~~ 641 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 642 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 643 | | 644 | while (getline(ifs, line)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | { | ~ 646 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 648 | break; | ~~~~~~ 649 | } | ~ 650 | | 651 | for (auto ch : line) | ~~~~~~~~~~~~~~~~~~~~ 652 | this->initblop.push_back(ch); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | this->initblop.push_back(0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | } | ~ 655 | | 656 | this->initblop.push_back(0x00); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | this->initblop.push_back(0xff); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | continue; | ~~~~~~~~~ 659 | } | ~ 660 | | 661 | if (command == ".device") | ~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | { | ~ 663 | if (got_device) | ~~~~~~~~~~~~~~~ 664 | error("More than one .device statement.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | | 666 | is >> this->device; | ~~~~~~~~~~~~~~~~~~~ 667 | | 668 | if (this->device == "384") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | this->cram_width = 182; | ~~~~~~~~~~~~~~~~~~~~~~~ 670 | this->cram_height = 80; | ~~~~~~~~~~~~~~~~~~~~~~~ 671 | this->bram_width = 0; | ~~~~~~~~~~~~~~~~~~~~~ 672 | this->bram_height = 0; | ~~~~~~~~~~~~~~~~~~~~~~ 673 | } else | ~~~~~~ 674 | if (this->device == "1k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | this->cram_width = 332; | ~~~~~~~~~~~~~~~~~~~~~~~ 676 | this->cram_height = 144; | ~~~~~~~~~~~~~~~~~~~~~~~~ 677 | this->bram_width = 64; | ~~~~~~~~~~~~~~~~~~~~~~ 678 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 679 | } else | ~~~~~~ 680 | if (this->device == "8k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 681 | this->cram_width = 872; | ~~~~~~~~~~~~~~~~~~~~~~~ 682 | this->cram_height = 272; | ~~~~~~~~~~~~~~~~~~~~~~~~ 683 | this->bram_width = 128; | ~~~~~~~~~~~~~~~~~~~~~~~ 684 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 685 | } else | ~~~~~~ 686 | if (this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 687 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 688 | this->cram_height = 336; | ~~~~~~~~~~~~~~~~~~~~~~~~ 689 | this->bram_width = 160; | ~~~~~~~~~~~~~~~~~~~~~~~ 690 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | } else | ~~~~~~ 692 | if (this->device == "u4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 693 | this->cram_width = 692; | ~~~~~~~~~~~~~~~~~~~~~~~ 694 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 695 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 696 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 697 | } else | ~~~~~~ 698 | if (this->device == "lm4k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 699 | this->cram_width = 656; | ~~~~~~~~~~~~~~~~~~~~~~~ 700 | this->cram_height = 176; | ~~~~~~~~~~~~~~~~~~~~~~~~ 701 | this->bram_width = 80; | ~~~~~~~~~~~~~~~~~~~~~~ 702 | this->bram_height = 2 * 128; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | } else | ~~~~~~ 704 | error("Unsupported chip type '%s'.\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 705 | | 706 | this->cram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 707 | if(this->device == "5k") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 708 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 709 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 710 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | this->cram[i][x].resize(((i % 2) == 1) ? (this->cram_height / 2 + 8) : this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | } | ~ 713 | | 714 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 715 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | int width = ((i % 2) == 1) ? (this->bram_width / 2) : this->bram_width; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | this->bram[i].resize(width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | for (int x = 0; x < width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | } | ~ 721 | } else { | ~~~~~~~~ 722 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | this->cram[i].resize(this->cram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 724 | for (int x = 0; x < this->cram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | this->cram[i][x].resize(this->cram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | } | ~ 727 | | 728 | this->bram.resize(4); | ~~~~~~~~~~~~~~~~~~~~~ 729 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | this->bram[i].resize(this->bram_width); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int x = 0; x < this->bram_width; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | this->bram[i][x].resize(this->bram_height); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | } | ~ 734 | } | ~ 735 | | 736 | | 737 | got_device = true; | ~~~~~~~~~~~~~~~~~~ 738 | continue; | ~~~~~~~~~ 739 | } | ~ 740 | | 741 | if (command == ".warmboot") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 742 | { | ~ 743 | is >> this->warmboot; | ~~~~~~~~~~~~~~~~~~~~~ 744 | | 745 | if (this->warmboot != "disabled" && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 746 | this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | error("Unknown warmboot setting '%s'.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~ 749 | | 750 | continue; | ~~~~~~~~~ 751 | } | ~ 752 | | 753 | // No ".nosleep" section despite sharing the same byte as .warmboot. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 754 | // ".nosleep" is specified when icepack is invoked, which is too late. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 755 | // So we inject the section based on command line argument. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 756 | if (nosleep) | ~~~~~~~~~~~~ 757 | this->nosleep = "enabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 758 | else | ~~~~ 759 | this->nosleep = "disabled"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | | 761 | if (command == ".io_tile" || command == ".logic_tile" || command == ".ramb_tile" || command == ".ramt_tile" || command.substr(0, 4) == ".dsp" || command == ".ipcon_tile") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | { | ~ 763 | if (!got_device) | ~~~~~~~~~~~~~~~~ 764 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | | 766 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 767 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 768 | | 769 | CramIndexConverter cic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 770 | | 771 | if (("." + cic.tile_type + "_tile") != command) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | error("Got %s statement for %s tile %d %d.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 773 | command.c_str(), cic.tile_type.c_str(), tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | | 775 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | { | ~ 777 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 778 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 779 | break; | ~~~~~~ 780 | } | ~ 781 | | 782 | for (int bit_x = 0; bit_x < int(line.size()) && bit_x < cic.tile_width; bit_x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 783 | if (line[bit_x] == '1') { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 784 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | } | ~ 789 | | 790 | continue; | ~~~~~~~~~ 791 | } | ~ 792 | | 793 | if (command == ".ram_data") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | { | ~ 795 | if (!got_device) | ~~~~~~~~~~~~~~~~ 796 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | | 798 | int tile_x, tile_y; | ~~~~~~~~~~~~~~~~~~~ 799 | is >> tile_x >> tile_y; | ~~~~~~~~~~~~~~~~~~~~~~~ 800 | | 801 | BramIndexConverter bic(this, tile_x, tile_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 802 | | 803 | for (int bit_y = 0; bit_y < 16 && getline(ifs, line); bit_y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | { | ~ 805 | if (line.substr(0, 1) == ".") { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 806 | reuse_line = true; | ~~~~~~~~~~~~~~~~~~ 807 | break; | ~~~~~~ 808 | } | ~ 809 | | 810 | for (int bit_x = 256-4, ch_idx = 0; ch_idx < int(line.size()) && bit_x >= 0; bit_x -= 4, ch_idx++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | { | ~ 812 | int value = -1; | ~~~~~~~~~~~~~~~ 813 | if ('0' <= line[ch_idx] && line[ch_idx] <= '9') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | value = line[ch_idx] - '0'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 815 | if ('a' <= line[ch_idx] && line[ch_idx] <= 'f') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 816 | value = line[ch_idx] - 'a' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 817 | if ('A' <= line[ch_idx] && line[ch_idx] <= 'F') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | value = line[ch_idx] - 'A' + 10; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | if (value < 0) | ~~~~~~~~~~~~~~ 820 | error("Not a hex character: '%c' (in line '%s')\n", line[ch_idx], line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | | 822 | for (int i = 0; i < 4; i++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 823 | if ((value & (1 << i)) != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 824 | int bram_bank, bram_x, bram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | bic.get_bram_index(bit_x+i, bit_y, bram_bank, bram_x, bram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | this->bram[bram_bank][bram_x][bram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | } | ~ 828 | } | ~ 829 | } | ~ 830 | | 831 | continue; | ~~~~~~~~~ 832 | } | ~ 833 | | 834 | if (command == ".extra_bit") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 835 | { | ~ 836 | if (!got_device) | ~~~~~~~~~~~~~~~~ 837 | error("Missing .device statement before %s.\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 838 | | 839 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 840 | is >> cram_bank >> cram_x >> cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 841 | this->cram[cram_bank][cram_x][cram_y] = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 842 | | 843 | continue; | ~~~~~~~~~ 844 | } | ~ 845 | | 846 | if (command == ".sym") | ~~~~~~~~~~~~~~~~~~~~~~ 847 | continue; | ~~~~~~~~~ 848 | | 849 | if (command.substr(0, 1) == ".") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 850 | error("Unknown statement: %s\n", command.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 851 | error("Unexpected data line: %s\n", line.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 852 | } | ~ 853 | } | ~ 854 | | 855 | void FpgaConfig::write_ascii(std::ostream &ofs) const | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | { | ~ 857 | debug("## %s\n", __PRETTY_FUNCTION__); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | info("Writing ascii file..\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | | 860 | ofs << ".comment"; | ~~~~~~~~~~~~~~~~~~ 861 | bool insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 862 | for (auto ch : this->initblop) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 863 | if (ch == 0) { | ~~~~~~~~~~~~~~ 864 | insert_newline = true; | ~~~~~~~~~~~~~~~~~~~~~~ 865 | } else if (ch == 0xff) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 866 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 867 | } else { | ~~~~~~~~ 868 | if (insert_newline) | ~~~~~~~~~~~~~~~~~~~ 869 | ofs << '\n'; | ~~~~~~~~~~~~ 870 | ofs << ch; | ~~~~~~~~~~ 871 | insert_newline = false; | ~~~~~~~~~~~~~~~~~~~~~~~ 872 | } | ~ 873 | } | ~ 874 | | 875 | ofs << stringf("\n.device %s\n", this->device.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 876 | if (this->warmboot != "enabled") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 877 | ofs << stringf(".warmboot %s\n", this->warmboot.c_str()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | | 879 | // As "nosleep" is an icepack command, we do not write out a ".nosleep" | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | // section. However, we parse it in read_bits() and notify the user in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | // info. | ~~~~~~~~ 882 | | 883 | typedef std::tuple tile_bit_t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 884 | std::set tile_bits; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | | 886 | for (int y = 0; y <= this->chip_height()+1; y++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 887 | for (int x = 0; x <= this->chip_width()+1; x++) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 888 | { | ~ 889 | CramIndexConverter cic(this, x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 890 | | 891 | if (cic.tile_type == "corner" || cic.tile_type == "unsupported") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 892 | continue; | ~~~~~~~~~ 893 | | 894 | ofs << stringf(".%s_tile %d %d\n", cic.tile_type.c_str(), x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 895 | | 896 | for (int bit_y = 0; bit_y < 16; bit_y++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 897 | for (int bit_x = 0; bit_x < cic.tile_width; bit_x++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 898 | int cram_bank, cram_x, cram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 899 | cic.get_cram_index(bit_x, bit_y, cram_bank, cram_x, cram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 900 | tile_bits.insert(tile_bit_t(cram_bank, cram_x, cram_y)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 901 | if (cram_x > int(this->cram[cram_bank].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 902 | error("cram_x %d (bit %d, %d) larger than bank size %lu\n", cram_x, bit_x, bit_y, this->cram[cram_bank].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 903 | } | ~ 904 | if (cram_y > int(this->cram[cram_bank][cram_x].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 905 | error("cram_y %d (bit %d, %d) larger than bank %d size %lu\n", cram_y, bit_x, bit_y, cram_bank, this->cram[cram_bank][cram_x].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | } | ~ 907 | ofs << (this->cram[cram_bank][cram_x][cram_y] ? '1' : '0'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 908 | } | ~ 909 | ofs << '\n'; | ~~~~~~~~~~~~ 910 | } | ~ 911 | | 912 | if (cic.tile_type == "ramb") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 913 | { | ~ 914 | BramIndexConverter bic(this, x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 915 | ofs << stringf(".ram_data %d %d\n", x, y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 916 | | 917 | for (int bit_y = 0; bit_y < 16; bit_y++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 918 | for (int bit_x = 256-4; bit_x >= 0; bit_x -= 4) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 919 | int value = 0; | ~~~~~~~~~~~~~~ 920 | for (int i = 0; i < 4; i++) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 921 | int bram_bank, bram_x, bram_y; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | bic.get_bram_index(bit_x+i, bit_y, bram_bank, bram_x, bram_y); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 923 | if (bram_x >= int(this->bram[bram_bank].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 924 | error("%d %d bram_x %d higher than loaded bram size %lu\n",bit_x+i, bit_y, bram_x, this->bram[bram_bank].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 925 | break; | ~~~~~~ 926 | } | ~ 927 | if (bram_y >= int(this->bram[bram_bank][bram_x].size())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 928 | error("bram_y %d higher than loaded bram size %lu\n", bram_y, this->bram[bram_bank][bram_x].size()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::vector::size_type {aka unsigned int} icepack.cc:928:8: note: in expansion of macro 'error' 928 | error("bram_y %d higher than loaded bram size %lu\n", bram_y, this->bram[bram_bank][bram_x].size()); | ^~~~~ icepack.cc:928:56: note: format string is defined here 928 | error("bram_y %d higher than loaded bram size %lu\n", bram_y, this->bram[bram_bank][bram_x].size()); | ~~^ | | | long unsigned int | %u g++ -o icepack -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld icepack.o -lm -lstdc++ ln -sf icepack iceunpack make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepack' make -C iceprog all make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/iceprog' cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -c -o iceprog.o iceprog.c cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -c -o mpsse.o mpsse.c cc -o iceprog -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld iceprog.o mpsse.o -L/usr/local/lib -lm -lftdi1 -lusb-1.0 make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/iceprog' make -C icemulti all make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icemulti' g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -c -o icemulti.o icemulti.cc g++ -o icemulti -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld icemulti.o -lm -lstdc++ make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icemulti' make -C icepll all make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepll' g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -c -o icepll.o icepll.cc g++ -o icepll -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld icepll.o -lm -lstdc++ make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepll' python3 icebox_chipdb.py > chipdb-1k.new mv chipdb-384.new chipdb-384.txt python3 icebox_chipdb.py -8 > chipdb-8k.new mv chipdb-1k.new chipdb-1k.txt python3 icebox_chipdb.py -5 > chipdb-5k.new mv chipdb-5k.new chipdb-5k.txt python3 icebox_chipdb.py -4 > chipdb-lm4k.new mv chipdb-8k.new chipdb-8k.txt python3 icebox_chipdb.py -u > chipdb-u4k.new mv chipdb-lm4k.new chipdb-lm4k.txt make -C icetime all make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icetime' python3 timings.py > timings.inc.new mv timings.inc.new timings.inc g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -DPREFIX='"/usr"' -DCHIPDB_SUBDIR='"icestorm"' -c -o iceutil.o iceutil.cc g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -DPREFIX='"/usr"' -DCHIPDB_SUBDIR='"icestorm"' -c -o icetime.o icetime.cc mv chipdb-u4k.new chipdb-u4k.txt make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebox' make -C icebram all make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebram' g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/libftdi1 -c -o icebram.o icebram.cc g++ -o icebram -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld icebram.o -lm -lstdc++ make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebram' g++ -o icetime -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld icetime.o iceutil.o -lm -lstdc++ make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icetime' + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.70baLL + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 '!=' / ']' + rm -rf /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 ++ dirname /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 + cd icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + /usr/bin/make install DESTDIR=/builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 'INSTALL=/usr/bin/install -p' PREFIX=/usr for dir in icebox icepack iceprog icemulti icepll icetime icebram; do \ /usr/bin/make -C $dir install || exit; \ done make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebox' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin cp chipdb-384.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ cp chipdb-1k.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ cp chipdb-8k.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ cp chipdb-5k.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ cp chipdb-u4k.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ cp chipdb-lm4k.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ cp icebox.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox.py cp iceboxdb.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/iceboxdb.py cp icebox_chipdb.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_chipdb cp icebox_diff.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_diff cp icebox_explain.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_explain cp icebox_asc2hlc.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_asc2hlc cp icebox_hlc2asc.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_hlc2asc cp icebox_colbuf.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_colbuf cp icebox_html.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_html cp icebox_maps.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_maps cp icebox_vlog.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_vlog cp icebox_stat.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox_stat make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebox' make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepack' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin cp icepack /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icepack ln -sf icepack /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/iceunpack make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepack' make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/iceprog' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin cp iceprog /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/iceprog make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/iceprog' make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icemulti' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin cp icemulti /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icemulti make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icemulti' make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepll' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin cp icepll /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icepll make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icepll' make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icetime' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox cp icetime /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icetime cp ../icefuzz/timings_*.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox/ make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icetime' make[1]: Entering directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebram' mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin cp icebram /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebram make[1]: Leaving directory '/builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1/icebram' + chmod +x /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebox.py + mv /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icebox /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icestorm + mv /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/iceboxdb.py /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icestorm + install -pm644 icefuzz/timings_hx1k.txt icefuzz/timings_hx8k.txt icefuzz/timings_lp1k.txt icefuzz/timings_lp384.txt icefuzz/timings_lp8k.txt icefuzz/timings_u4k.txt icefuzz/timings_up5k.txt /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/icestorm + /usr/lib/rpm/find-debuginfo.sh -j2 --strict-build-id -m -i --build-id-seed 0-0.7.20190311gitfa1c932.fc31 --unique-debug-suffix -0-0.7.20190311gitfa1c932.fc31.i386 --unique-debug-src-base icestorm-0-0.7.20190311gitfa1c932.fc31.i386 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 50000000 -S debugsourcefiles.list /builddir/build/BUILD/icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 explicitly decompress any DWARF compressed ELF sections in /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebram explicitly decompress any DWARF compressed ELF sections in /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icetime extracting debug info from /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icebram extracting debug info from /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icetime explicitly decompress any DWARF compressed ELF sections in /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icepll extracting debug info from /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icepll explicitly decompress any DWARF compressed ELF sections in /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icemulti extracting debug info from /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icemulti explicitly decompress any DWARF compressed ELF sections in /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/iceprog extracting debug info from /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/iceprog explicitly decompress any DWARF compressed ELF sections in /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icepack extracting debug info from /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/bin/icepack /usr/lib/rpm/sepdebugcrcfix: Updated 6 CRC32s, 0 CRC32s did match. 1802 blocks + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig + /usr/lib/rpm/brp-compress + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python3 1 0 + /usr/lib/rpm/brp-python-hardlink + /usr/lib/rpm/redhat/brp-mangle-shebangs Processing files: icestorm-0-0.7.20190311gitfa1c932.fc31.i686 Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.JYxj5s + umask 022 + cd /builddir/build/BUILD + cd icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + DOCDIR=/builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/doc/icestorm + export LC_ALL=C + LC_ALL=C + export DOCDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/doc/icestorm + cp -pr examples /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/doc/icestorm + exit 0 Executing(%license): /bin/sh -e /var/tmp/rpm-tmp.TUM5ra + umask 022 + cd /builddir/build/BUILD + cd icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + LICENSEDIR=/builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/licenses/icestorm + export LC_ALL=C + LC_ALL=C + export LICENSEDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/licenses/icestorm + cp -pr README /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386/usr/share/licenses/icestorm + exit 0 Provides: icestorm = 0-0.7.20190311gitfa1c932.fc31 icestorm(x86-32) = 0-0.7.20190311gitfa1c932.fc31 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires: /usr/bin/python3 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.1.3) libc.so.6(GLIBC_2.3.4) libc.so.6(GLIBC_2.4) libc.so.6(GLIBC_2.7) libc.so.6(GLIBC_2.8) libftdi1.so.2 libgcc_s.so.1 libgcc_s.so.1(GCC_3.0) libm.so.6 libm.so.6(GLIBC_2.29) libstdc++.so.6 libstdc++.so.6(CXXABI_1.3) libstdc++.so.6(CXXABI_1.3.9) libstdc++.so.6(GLIBCXX_3.4) libstdc++.so.6(GLIBCXX_3.4.11) libstdc++.so.6(GLIBCXX_3.4.14) libstdc++.so.6(GLIBCXX_3.4.20) libstdc++.so.6(GLIBCXX_3.4.21) libstdc++.so.6(GLIBCXX_3.4.9) rtld(GNU_HASH) Processing files: icestorm-debugsource-0-0.7.20190311gitfa1c932.fc31.i686 Provides: icestorm-debugsource = 0-0.7.20190311gitfa1c932.fc31 icestorm-debugsource(x86-32) = 0-0.7.20190311gitfa1c932.fc31 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Processing files: icestorm-debuginfo-0-0.7.20190311gitfa1c932.fc31.i686 Provides: debuginfo(build-id) = 06f9037ab1c651d04d457a2232eb417c7ba6b01a debuginfo(build-id) = 137eac5a79bff429178fa8bd1baa822f62e5303b debuginfo(build-id) = 52b128f5804d8650c234e03d209b18b82fecf2aa debuginfo(build-id) = bf8d7783f56da9ed0f66b02bc855c4abdfad1198 debuginfo(build-id) = d894bf3440f2bfce9c5839f499d3b3eed3f61b71 debuginfo(build-id) = de483b3d7e23bf8dac443e8d66568ae3ad5f89ec icestorm-debuginfo = 0-0.7.20190311gitfa1c932.fc31 icestorm-debuginfo(x86-32) = 0-0.7.20190311gitfa1c932.fc31 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Recommends: icestorm-debugsource(x86-32) = 0-0.7.20190311gitfa1c932.fc31 Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 Wrote: /builddir/build/RPMS/icestorm-0-0.7.20190311gitfa1c932.fc31.i686.rpm Wrote: /builddir/build/RPMS/icestorm-debugsource-0-0.7.20190311gitfa1c932.fc31.i686.rpm Wrote: /builddir/build/RPMS/icestorm-debuginfo-0-0.7.20190311gitfa1c932.fc31.i686.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.R3gjAK + umask 022 + cd /builddir/build/BUILD + cd icestorm-fa1c932452e8efe1dfcc6ff095e3f7130a7906b1 + /usr/bin/rm -rf /builddir/build/BUILDROOT/icestorm-0-0.7.20190311gitfa1c932.fc31.i386 + exit 0 Finish: rpmbuild icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm INFO: chroot_scan: 3 files copied to /var/lib/copr-rpmbuild/results/chroot_scan INFO: /var/lib/mock/870521-fedora-rawhide-i386-1552997197.580194/root/var/log/dnf.log /var/lib/mock/870521-fedora-rawhide-i386-1552997197.580194/root/var/log/dnf.librepo.log /var/lib/mock/870521-fedora-rawhide-i386-1552997197.580194/root/var/log/dnf.rpm.log Finish: build phase for icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm INFO: Done(/var/lib/copr-rpmbuild/results/icestorm-0-0.7.20190311gitfa1c932.fc31.src.rpm) Config(child) 4 minutes 55 seconds INFO: Results and/or logs in: /var/lib/copr-rpmbuild/results INFO: Cleaning up build root ('cleanup_on_success=True') Start: clean chroot INFO: unmounting tmpfs. Finish: clean chroot Finish: run