IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

バージョンが異なるのでツールの微妙な差異があります。

書籍:Vivado 2016.2 環境:Vivado 2017.3

p.186

Add IPのアイコンが変わっている。

p.247

メニューから[Tools]->[Create and Package IP...]を実行

Package New IPに代わっていました。

f:id:naotoogawa:20180108130337p:plain

p.261

そこで「Customization Parameters」を選択し、ペイン上部の「Merge changes from ~」をクリックします。これによりすべての項目が緑のチェックマークになり解決しました。

すべてではありませんでした。File Groupsが緑のチェックマークになりませんでした。これもペイン上部の「Merge changes from ~」をクリックすると、解決できるようです。

f:id:naotoogawa:20180108132812p:plain

FPGAボードに電源を入れてみる

FPGAはここで購入しました。通販ではなく、実際に店舗に行って購入しました。店舗の雰囲気は初心者お断りの雰囲気があるのですが、店員さんは親切です。店の中をキョロキョロしていたところ、店員さんに声をかけられ、買いたい商品の型番を知らせると、すぐに在庫の確認をしてくれて、商品が置いてある場所を教えてくれました。

ZYBO Zynq−7000 評価ボード: 目的別 秋月電子通商 電子部品 ネット通販

電源の入れ方はマニュアルに書いてあります。

マニュアル

f:id:naotoogawa:20180104190504p:plain

ライセンス付きを買ったので、パッケージの中にライセンスのバウチャーが入っています。

f:id:naotoogawa:20180104190517p:plain

開封の儀

f:id:naotoogawa:20180104190534p:plain

USBは別途購入が必要。

f:id:naotoogawa:20180104190548p:plain

右中央にある、赤と緑のLEDがつけば起動完了です。

f:id:naotoogawa:20180104190559p:plain

デフォルトで入っているアプリをディスプレイに表示させました。

情報源はここです。 yuki-sato.com

開封してから気づいたのですが、いわゆる筐体がないので、ケースを用意する必要があります。

keitetsu.blogspot.jp

3Dプリンタがあれば、ケース作れると思ったのですが、すでにやっている人いますね。

www.thingiverse.com

clashのインストール (Mac成功 / Windows失敗)

clashのインストールをしています。

www.clash-lang.org

Macではインストールができましたが、Windowsではできませんでした。

  • Macの環境
    • OS X Yosemite 10.10.5
    • The Glorious Glasgow Haskell Compilation System, version 8.2.1
    • stack 1.6.3 x86_64 hpack-0.20.0
  • Windowsの環境
    • エディション Windows 10 Pro / ビルド 1709 / OSビルド 16299.125
    • The Glorious Glasgow Haskell Compilation System, version 8.2.1
    • Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
    • Haskell Platformでインストールしたmsys2のターミナルから操作

インストール方法は、clashgithubwikigetting started通りです。

$ git clone https://github.com/clash-lang/clash-compiler.git
$ cd clash-compiler
$ git submodule update --init
$ stack build

Macの場合

(root)blender:clash-compiler ogawanaoto$ stack build
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.2.1.
Installed GHC.
...

clash-prelude-0.99: copy/register
clash-lib-0.99: configure (lib)
clash-lib-0.99: build (lib)
clash-lib-0.99: copy/register
Building all executables for `clash-ghc' once. After a successful build of all of them, only specified executables will be rebuilt.
clash-ghc-0.99: configure (lib + exe)
clash-ghc-0.99: build (lib + exe)
clash-ghc-0.99: copy/register
Completed 90 action(s).
Log files have been written to: /Users/foo/work11/fpga01/clash-compiler/.stack-work/logs/

問題なく終了しました。

Windowsの場合

$ stack build

...

fgl-5.5.4.0: configure
fgl-5.5.4.0: build
optparse-applicative-0.14.0.0: configure
optparse-applicative-0.14.0.0: build
ghc-tcplugins-extra-0.2.1: configure
ghc-tcplugins-extra-0.2.1: build
aeson-1.2.1.0: configure
aeson-1.2.1.0: build
ghc-tcplugins-extra-0.2.1: copy/register

--  While building custom Setup.hs for package aeson-1.2.1.0 using:
      C:\Users\User\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.0.0.2_ghc-8.2.1.exe --builddir=.stack-work\dist\e53504d9 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 3
    Logs have been written to: C:\Program Files\Haskell Platform\8.2.2\msys\home\User\work02\work03\clash-compiler\.stack-work\logs\aeson-1.2.1.0.log

    Configuring aeson-1.2.1.0...
    Preprocessing library for aeson-1.2.1.0..
    Building library for aeson-1.2.1.0..
    [ 1 of 23] Compiling Data.Aeson.Internal.Functions ( Data\Aeson\Internal\Functions.hs, .stack-work\dist\e53504d9\build\Data\Aeson\Internal\Functions.o )
    [ 2 of 23] Compiling Data.Aeson.Parser.UnescapePure ( pure\Data\Aeson\Parser\UnescapePure.hs, .stack-work\dist\e53504d9\build\Data\Aeson\Parser\UnescapePure.o )
    [ 3 of 23] Compiling Data.Aeson.Parser.Unescape ( Data\Aeson\Parser\Unescape.hs, .stack-work\dist\e53504d9\build\Data\Aeson\Parser\Unescape.o )
    [ 4 of 23] Compiling Data.Aeson.Types.Generic ( Data\Aeson\Types\Generic.hs, .stack-work\dist\e53504d9\build\Data\Aeson\Types\Generic.o )
    [ 5 of 23] Compiling Data.Aeson.Types.Internal ( Data\Aeson\Types\Internal.hs, .stack-work\dist\e53504d9\build\Data\Aeson\Types\Internal.o )
    [ 6 of 23] Compiling Data.Aeson.Parser.Internal ( Data\Aeson\Parser\Internal.hs, .stack-work\dist\e53504d9\build\Data\Aeson\Parser\Internal.o )
    ghc.EXE: internal error: mkPath failed converting char* to wchar_t*
        (GHC version 8.2.1 for x86_64_unknown_mingw32)
        Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.


--  While building custom Setup.hs for package optparse-applicative-0.14.0.0 using:
      C:\Users\User\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.0.0.2_ghc-8.2.1.exe --builddir=.stack-work\dist\e53504d9 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 3
    Logs have been written to: C:\Program Files\Haskell Platform\8.2.2\msys\home\User\work02\work03\clash-compiler\.stack-work\logs\optparse-applicative-0.14.0.0.log

    Configuring optparse-applicative-0.14.0.0...
    Preprocessing library for optparse-applicative-0.14.0.0..
    Building library for optparse-applicative-0.14.0.0..
    [ 1 of 16] Compiling Options.Applicative.Help.Levenshtein ( Options\Applicative\Help\Levenshtein.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Help\Levenshtein.o )
    [ 2 of 16] Compiling Options.Applicative.Help.Pretty ( Options\Applicative\Help\Pretty.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Help\Pretty.o )
    [ 3 of 16] Compiling Options.Applicative.Help.Chunk ( Options\Applicative\Help\Chunk.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Help\Chunk.o )
    [ 4 of 16] Compiling Options.Applicative.Help.Types ( Options\Applicative\Help\Types.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Help\Types.o )
    [ 5 of 16] Compiling Options.Applicative.Types ( Options\Applicative\Types.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Types.o )
    [ 6 of 16] Compiling Options.Applicative.Internal ( Options\Applicative\Internal.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Internal.o )
    [ 7 of 16] Compiling Options.Applicative.Common ( Options\Applicative\Common.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Common.o )
    [ 8 of 16] Compiling Options.Applicative.Help.Core ( Options\Applicative\Help\Core.hs, .stack-work\dist\e53504d9\build\Options\Applicative\Help\Core.o )
    ghc.EXE: internal error: mkPath failed converting char* to wchar_t*
        (GHC version 8.2.1 for x86_64_unknown_mingw32)
        Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.


--  While building custom Setup.hs for package fgl-5.5.4.0 using:
      C:\Users\User\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.0.0.2_ghc-8.2.1.exe --builddir=.stack-work\dist\e53504d9 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 3
    Logs have been written to: C:\Program Files\Haskell Platform\8.2.2\msys\home\User\work02\work03\clash-compiler\.stack-work\logs\fgl-5.5.4.0.log

    Configuring fgl-5.5.4.0...
    Preprocessing library for fgl-5.5.4.0..
    Building library for fgl-5.5.4.0..
    [ 1 of 29] Compiling Data.Graph.Inductive.Graph ( Data\Graph\Inductive\Graph.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Graph.o )
    [ 2 of 29] Compiling Data.Graph.Inductive.Internal.Heap ( Data\Graph\Inductive\Internal\Heap.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Internal\Heap.o )
    [ 3 of 29] Compiling Data.Graph.Inductive.Internal.Queue ( Data\Graph\Inductive\Internal\Queue.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Internal\Queue.o )
    [ 4 of 29] Compiling Data.Graph.Inductive.Internal.RootPath ( Data\Graph\Inductive\Internal\RootPath.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Internal\RootPath.o )
    [ 5 of 29] Compiling Data.Graph.Inductive.Internal.Thread ( Data\Graph\Inductive\Internal\Thread.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Internal\Thread.o )
    [ 6 of 29] Compiling Data.Graph.Inductive.Basic ( Data\Graph\Inductive\Basic.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Basic.o )
    [ 7 of 29] Compiling Data.Graph.Inductive.Monad ( Data\Graph\Inductive\Monad.hs, .stack-work\dist\e53504d9\build\Data\Graph\Inductive\Monad.o )
    ghc.EXE: internal error: mkPath failed converting char* to wchar_t*
        (GHC version 8.2.1 for x86_64_unknown_mingw32)
        Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

MSYS ~/work02/work03/clash-compiler
$

このようなエラーがでてしまいます。コマンドプロンプトからstack buildしても同様でした。

ghc.EXE: internal error: mkPath failed converting char to wchar_t

次の情報がありました。

#14398 (Fail to install haskell platform on Windows) – GHC

ghcのコードの該当箇所は下記のようです。

ghc/PathUtils.c at master · ghc/ghc · GitHub

mkPathとあるのでパスにスペースがある部分がよくないのかもしれないと思い、スペースがないフォルダにて試しましたが、同じエラーが出ました。(ただしエラー対象になるパッケージは別)

せっかくWindowsマシンを買ったのにHaskellが使えないのはちょっと残念です。

stack自体のupdateの作業ログ (2018年01月)

stack buildをすると、cabalのバージョン不整合のエラーがでました。

$ stack build
Unable to parse cabal file: FromString "This package requires at least Cabal version 2.0" Nothing

確認すると不整合はなさそうです。

$ cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library

stackoverflowに情報がありました。stack自体のバージョンが1.5以上である必要があるとのこと。

stackoverflow.com

バージョンを確認すると、1.1.2でした。

$ stack --version
Version 1.1.2, Git revision cebe10e845fed4420b6224d97dcabf20477bbd4b (3646 commits) x86_64 hpack-0.14.0

本家サイトでアップデート方法を確認します。

Install/upgrade - The Haskell Tool Stack

それに従ってコマンドを入力するとエラーとなります。

$ curl -sSL https://get.haskellstack.org/ | sh
Stack Version 1.1.2 already appears to be installed at:
  /usr/local/bin/stack
Use 'stack upgrade' or your OS's package manager to upgrade,
or pass '-f' to this script to over-write the existing binary, e.g.:
  curl -sSL https://get.haskellstack.org/ | sh -s - -f

エラーメッセージに従って、コマンドを入力すると最新版のダウンロードとインストールが始まりました。

$ stack upgrade
remote: Counting objects: 13480, done.
remote: Compressing objects: 100% (11071/11071), done.
remote: Total 13480 (delta 3490), reused 10929 (delta 2132), pack-reused 0
Receiving objects: 100% (13480/13480), 3.87 MiB | 655.00 KiB/s, done.
Resolving deltas: 100% (3490/3490), completed with 1189 local objects.
From https://github.com/commercialhaskell/all-cabal-hashes
 + 89bc508...936cc04 hackage    -> origin/hackage  (forced update)
 - [tag update]      current-hackage -> current-hackage
Fetched package index.
Populated index cache.
stack-1.6.3: download
Downloaded lts-9.14 build plan.

途中でワーニングが出ました。

Right Nothing
Did not find .cabal file for Agda-2.5.3 with Git SHA of 82d11286c281716649dc25e0820b3e25214af971
Right Nothing
WARNING: Ignoring unknown field "custom-setup" in package description
WARNING: Ignoring unknown field "custom-setup" in package description
No packages found in snapshot which provide a "hsc2hs" executable, which is a build-tool dependency of "stack"
No packages found in snapshot which provide a "hsc2hs" executable, which is a build-tool dependency of "stack"
Missing build-tools may be caused by dependencies of the build-tool being overridden by extra-deps.
This should be fixed soon - see this issue https://github.com/commercialhaskell/stack/issues/595

stack自体のコンパイルが実行されます。ここが時間がかかりました。

Configuring stack-1.6.3...
stack-1.6.3: build
Preprocessing library stack-1.6.3...
[  1 of 126] Compiling System.Terminal  ( .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/System/Terminal.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/System/Terminal.o )
[  2 of 126] Compiling Stack.Prelude    ( src/Stack/Prelude.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Stack/Prelude.o )
[  3 of 126] Compiling Stack.StaticBytes ( src/Stack/StaticBytes.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Stack/StaticBytes.o )

最後にパスの問題でワーニングが出てしまいました。

[1 of 2] Compiling Paths_stack      ( .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/autogen/Paths_stack.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/stack/stack-tmp/Paths_stack.o )
[2 of 2] Compiling Main             ( src/main/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/stack/stack-tmp/Main.o )
Linking .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/stack/stack ...
stack-1.6.3: copy/register
Installing library in
/private/var/folders/hw/p4bp49hd7v9_1j60sjvmhqnr0000gn/T/stack-upgrade57634/stack-1.6.3/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/lib/x86_64-osx-ghc-8.0.2/stack-1.6.3-6ncwAxsY27uGm82EJKrhWo
Installing executable(s) in
/private/var/folders/hw/p4bp49hd7v9_1j60sjvmhqnr0000gn/T/stack-upgrade57634/stack-1.6.3/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/bin
Registering stack-1.6.3...
Completed 179 action(s).
Copying from /private/var/folders/hw/p4bp49hd7v9_1j60sjvmhqnr0000gn/T/stack-upgrade57634/stack-1.6.3/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/bin/stack to /Users/foo/.local/bin/stack

Copied executables to /Users/foo/.local/bin:
- stack

WARNING: Installation path /Users/foo/.local/bin not found on the PATH environment variable

絶対パスで確認するとインストールされています。

$ /Users/foo/.local/bin/stack  --version
Version 1.6.3 x86_64 hpack-0.20.0
$

リンクを付け替えます。

$ ls -al /usr/local/bin | grep stack
lrwxr-xr-x    1 foo  admin        45 11 12  2016 resolve_stack_dump -> ../Cellar/mysql/5.7.16/bin/resolve_stack_dump
lrwxr-xr-x    1 root        admin        43 10 30  2016 stack -> /Library/Haskell/ghc-8.0.1-x86_64/bin/stack
$ ln -s /Users/ogawanaoto/.local/bin/stack /usr/local/bin/stack
ln: /usr/local/bin/stack: File exists
$ ln -sf /Users/ogawanaoto/.local/bin/stack /usr/local/bin/stack
$ stack --version
Version 1.6.3 x86_64 hpack-0.20.0

cabal自身のバージョンアップの作業ログ (2018年01月時点)

cabalは2017年8月からバージョンが2になっています。アップデートをサボっていたので更新作業をしまし。

バージョンの確認とパッケージ情報の更新をします。

$ cabal --version
cabal-install version 1.24.0.0
compiled using version 1.24.0.0 of the Cabal library
$ cabal update
Downloading the latest package list from hackage.haskell.org

cabalupdateで検索するとcabalがインストールするパッケージのアップデートの方法の情報がたくさんヒットします。cabal自体のアップデートの情報はヒットしません。そこで、本家のサイトを確認します。

The Haskell Cabal

cabal install cabal cabal-installと記載がされています。そのコマンドを実行します。

$ cabal install cabal cabal-install
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: cabal-0.0.0.0 (user goal)
next goal: youProbablyWantCapitalCabal (dependency of cabal-0.0.0.0)
Dependency tree exhaustively searched.

エラーが出てしまいます。解決方法はこちらに出ていました。cabalがなくても大丈夫なようです。

$ cabal install cabal cabal-install errors · Issue #4178 · haskell/cabal · GitHub

$ cabal install cabal-install
Resolving dependencies...
Downloading Cabal-2.0.1.1...
Downloading HTTP-4000.3.9...
Configuring HTTP-4000.3.9...
Downloading cryptohash-sha256-0.11.101.0...
Configuring cryptohash-sha256-0.11.101.0...
Downloading echo-0.1.3...
Configuring echo-0.1.3...
Downloading ed25519-0.0.5.0...
Downloading edit-distance-0.2.2.1...
Configuring Cabal-2.0.1.1...
Downloading tar-0.5.0.3...
Building HTTP-4000.3.9...
Building cryptohash-sha256-0.11.101.0...
Building echo-0.1.3...
Building Cabal-2.0.1.1...
Installed echo-0.1.3
Configuring edit-distance-0.2.2.1...
Configuring ed25519-0.0.5.0...
Installed cryptohash-sha256-0.11.101.0
Building edit-distance-0.2.2.1...
Building ed25519-0.0.5.0...
Configuring tar-0.5.0.3...
Installed ed25519-0.0.5.0
Building tar-0.5.0.3...
Installed edit-distance-0.2.2.1
Installed HTTP-4000.3.9
Installed tar-0.5.0.3
Installed Cabal-2.0.1.1
Downloading hackage-security-0.5.2.2...
Configuring hackage-security-0.5.2.2...
Building hackage-security-0.5.2.2...
Installed hackage-security-0.5.2.2
Downloading cabal-install-2.0.0.1...
Configuring cabal-install-2.0.0.1...
Building cabal-install-2.0.0.1...
Installed cabal-install-2.0.0.1
Updating documentation index
/Users/foo/Library/Haskell/share/doc/x86_64-osx-ghc-8.0.1/index.html

バージョンの確認をしてみると、変わっていません。

$ cabal --version
cabal-install version 1.24.0.0
compiled using version 1.24.0.0 of the Cabal library

絶対パスで指定すると期待したバージョンになっています。

$ which cabal
/Users/ogawanaoto/Library/Haskell/bin/cabal
$ /Users/ogawanaoto/Library/Haskell/bin/cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library
$

なので、設定の再読込をしました。

$ source ~/.bash_profile
$ cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library
$

2017年度末に中古のWindowsマシンを買った

事情があってWindowsPCが必要になりました。購入の条件は以下を考えていました。

  • 64bit
  • Windows 10
  • Core i5 以上
  • メモリ8GB 以上
  • ディスク SSD 120GB 以上
  • Officeあれば尚可

秋葉原の中古PCショップを周りました。中古市場に出ているPCは、メモリは4Gが中心でした。ディスクはHDDが中心です。希望する条件が厳しいようでした。どれかの条件を緩くすれば、秋葉原の中古PCショップで、お手頃な価格帯の中古PCはたくさんあると感じました。

新品のPCも、秋葉原の家電量販店を見て回ったのですが、希望するスペックに近いPCだと最低でも12〜13万円程度はする感じでした。

いろいろ店舗を巡って、やっぱり新品のPCを買ったほうが良いかとも悩みました。Surfaceの一番低いスペックのもので15万円代もありました。これは、完全に大幅な予算オーバーなのですが、店舗で実機を触ってみると、欲しくもなりました。

いろいろ迷いましたが、結局Amazonで中古PCを購入しました。ノートPCのページに行くと左側で条件を選択できるようになっていて、そこで絞り込みをして、条件に合う中古ショップから購入しました。

アマゾンのノートPCのページ

中古を買うということで少し心配していたのですが、アマゾンでのショップの評価も良かったことと、秋葉原の中古PCショップを巡って感じた相場の価格帯より安かったので、アマゾン経由で買うこととしました。年末ということで、配送遅延も心配したのですが、遅延なく配送されました(むしろ早すぎたくらい)。ドライバやWindwosのアップデートで時間を取られましたが、とくに大きな問題もなく使えそうで、お買い得だったと思っています。

f:id:naotoogawa:20180104180614p:plain

DVDのリーダーライターもついていました。

f:id:naotoogawa:20180104180635p:plain

プチプチに包まれていました。

f:id:naotoogawa:20180104180657p:plain

レッツノートです。

f:id:naotoogawa:20180104180710p:plain

f:id:naotoogawa:20180104180720p:plain

サクッと起動します。(SSDだから?)

f:id:naotoogawa:20180104180728p:plain

↑↓希望するスペックでした。

f:id:naotoogawa:20180104180736p:plain

Windows環境のVivadoが起動しなくなった

Vivadoが起動しなくなりかなり焦りました。Windowsマシンにいろいろアプリケーションをインストールしているので、それらが影響したのかと思い、PATH設定を見直しましたが、関係ありませんでした。どうやら、Windowsアップデートの影響(?)で起動しなくなったようです。解決方法は下のリンク先に書いてあります。なんでこんな野暮ったいやりかたで解決するのか不思議です。

forums.xilinx.com

https://www.xilinx.com/support/answers/69908.html