FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

ハードウェア開発用の依存関係解決ツールBenderについて (2. 実際に使ってみる)

PULPの開発する、ハードウェア開発用の依存関係解決ツールBenderについて調査している。

github.com

試しに、以下のようなリポジトリを作ってみよう。 repo_A リポジトリと repo_B リポジトリはそれぞれモジュール AB を管理している。

$ cd repo_A
$ cat A.sv
$ git init && git add A.sv
$ git commit -a -m "Add A.sv"
module A;

B inst_B
(
 .inA (in_a),
 .inB (in_b),
 .outC (out_c)
 );

endmodule // A
$ cd repo_B
$ cat B.sv
$ git init && git add A.sv
$ git commit -a -m "Add B.sv"
module B
  (
   input  inA,
   input  inB,
   output outC
   );

assign outC = inA + inB;

endmodule // B

repo_B には、Benderでバージョン管理をするためのタグを打っておく。

$ git tag 0.0.0

repo_A に戻って、Benderを初期化してみよう。

$ bender init

Bender.ymlが作られた:

# A more detailed description of the manifest format `Bender.yml` can be found here:
# https://github.com/pulp-platform/bender#manifest-format-benderyml

package:
  name: repo_A
  authors:
    - "msyksphinz-self <msyksphinz.dev@gmail.com>"

dependencies:

sources:
  # Source files grouped in levels. Files in level 0 have no dependencies on files in this
  # package. Files in level 1 only depend on files in level 0, files in level 2 on files in
  # levels 1 and 0, etc. Files within a level are ordered alphabetically.
  # Level 0

この先どうやっていくのかな?まずは依存関係を持つrepo_Bを依存リポジトリとして登録したい。以下のように Bender.yml を追記した。

dependencies:
  repo_B : { git: "git@github.com:msyksphinz-self/bender_repo_B.git", version: "0.0.0" }

# Additional workspace configuration. Optional.
workspace:
  checkout_dir: deps

これで、依存するリポジトリ repo_B をチェックアウトできる。

$ bender checkout
    Checkout repo_b (git@github.com:msyksphinz-self/bender_repo_B.git)
    Fetching repo_b (git@github.com:msyksphinz-self/bender_repo_B.git)

deps リポジトリに依存する repo_Bがチェックアウトされた:

.
|-- A.sv
|-- Bender.lock
|-- Bender.yml
`-- deps
    `-- repo_b
        `-- B.sv

2 directories, 4 files