Skip to content

Commit

Permalink
deploy: f8ee485
Browse files Browse the repository at this point in the history
  • Loading branch information
dalance committed Jan 3, 2025
1 parent 23da072 commit 5734c2a
Show file tree
Hide file tree
Showing 23 changed files with 240 additions and 114 deletions.
2 changes: 1 addition & 1 deletion nightly/book/03_getting_started/02_hello_world.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ <h2 id="build-code"><a class="header" href="#build-code">Build Code</a></h2>
<p>Additionally, <code>hello.f</code> which is the filelist of generated codes will be generated.
You can use it for SystemVerilog compiler.
The following example is to use <a href="https://www.veripool.org/verilator/">Verilator</a>.</p>
<pre><code>$ verilator --cc -f hello.f
<pre><code>$ verilator --binary -f hello.f
</code></pre>
<h2 id="clean-up-the-generated-code"><a class="header" href="#clean-up-the-generated-code">Clean up the Generated Code</a></h2>
<p>The generated code can be cleaned up by <code>veryl clean</code>.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,17 @@ <h1 class="menu-title">The Veryl Hardware Description Language</h1>
<h1 id="function-call"><a class="header" href="#function-call">Function Call</a></h1>
<p>Function can be call by <code>function_name(argument)</code>.
System function of SystemVerilog like <code>$clog2</code> can be used too.</p>
<pre><code class="language-veryl playground">module ModuleA {
let _a: logic = PackageA::FunctionA(1, 1);
let _b: logic = $clog2(1, 1);
}

package PackageA {
<pre><code class="language-veryl playground">package PackageA {
function FunctionA (
a: input logic,
b: input logic,
) {}
}

module ModuleA {
let _a: logic = PackageA::FunctionA(1, 1);
let _b: logic = $clog2(1, 1);
}
</code></pre>

</main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ <h1 id="import--export"><a class="header" href="#import--export">Import / Export
<pre><code class="language-veryl playground">// file scope import
import $sv::SvPackage::*;

package PackageA {
const paramA: u32 = 1;
}

module ModuleA {
import PackageA::*;
import PackageA::paramA;
}

package PackageA {
const paramA: u32 = 1;
}
</code></pre>
<p><code>export</code> declaration exports symbols from the package to other.
<code>export *</code> represents to export all symbols.</p>
Expand Down
26 changes: 26 additions & 0 deletions nightly/book/05_language_reference/07_module.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,32 @@ <h1 id="module"><a class="header" href="#module">Module</a></h1>
}
}
</code></pre>
<h2 id="default-value-of-port"><a class="header" href="#default-value-of-port">Default value of port</a></h2>
<p>Ports of module can have default value. Ports which have default value can be omitted at the instantiation, and the default values are assigned to the omitted ports.
As default value, the following values are allowed:</p>
<ul>
<li>Input port: literal, and <code>const</code> in package</li>
<li>Output port: <code>_</code> (anonymous identifier)</li>
</ul>
<pre><code class="language-veryl playground">module ModuleA (
a: input logic ,
b: input logic = 1,
x: output logic ,
y: output logic = _,
) {
assign x = a;
assign y = b;
}

module ModubeB {
inst instA: ModuleA (
a: 1,
// b is omitted
x: _,
// y is omitted
);
}
</code></pre>
<h2 id="generic-interface"><a class="header" href="#generic-interface">Generic interface</a></h2>
<p>Generic interface is a special port direction.
If <code>interface</code> is specified as the port direction, the port can be connected to arbitrary interface.
Expand Down
22 changes: 11 additions & 11 deletions nightly/book/05_language_reference/14_generics.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,22 @@ <h2 id="generic-moduleinterface"><a class="header" href="#generic-moduleinterfac
module ModuleD for ProtoA {}
</code></pre>
<h2 id="generic-package"><a class="header" href="#generic-package">Generic Package</a></h2>
<pre><code class="language-veryl playground">module ModuleA {
const A: u32 = PackageA::&lt;1&gt;::X;
const B: u32 = PackageA::&lt;2&gt;::X;
<pre><code class="language-veryl playground">package PackageA::&lt;T: const&gt; {
const X: u32 = T;
}

package PackageA::&lt;T: const&gt; {
const X: u32 = T;
module ModuleA {
const A: u32 = PackageA::&lt;1&gt;::X;
const B: u32 = PackageA::&lt;2&gt;::X;
}
</code></pre>
<h2 id="generic-struct"><a class="header" href="#generic-struct">Generic Struct</a></h2>
<pre><code class="language-veryl playground">module ModuleA {
<pre><code class="language-veryl playground">package PackageA {
type TypeB = u32;
type TypeC = u64;
}

module ModuleA {
type TypeA = i32;

struct StructA::&lt;T: type&gt; {
Expand All @@ -286,11 +291,6 @@ <h2 id="generic-struct"><a class="header" href="#generic-struct">Generic Struct<
var _b: StructA::&lt;PackageA::TypeB&gt;;
var _c: StructA::&lt;PackageA::TypeC&gt;;
}

package PackageA {
type TypeB = u32;
type TypeC = u64;
}
</code></pre>

</main>
Expand Down
7 changes: 7 additions & 0 deletions nightly/book/06_development_environment/02_dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ <h2 id="version-requirement"><a class="header" href="#version-requirement">Versi
</ul>
<p>The <code>version</code> field allows other version requirement representation like <code>=0.1.0</code>.
Please see version requirement of Rust for detailed information: <a href="https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-cratesio">Specifying Dependencies</a>.</p>
<h2 id="relative-path-dependency"><a class="header" href="#relative-path-dependency">Relative path dependency</a></h2>
<p>For local development, dependency to a local file path is useful in some cases.
Relative path dependency can be specified like below:</p>
<pre><code class="language-toml">[dependencies]
"../../library/path" = "0.1.0"
</code></pre>
<p>If there are relative path dependencies in a project, the project can’t be published through <code>veryl publish</code>.</p>

</main>

Expand Down
8 changes: 6 additions & 2 deletions nightly/book/07_appendix/01_formal_syntax.html
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ <h1 id="formal-syntax"><a class="header" href="#formal-syntax">Formal Syntax</a>
Expression12: { ( UnaryOperator | Operator09 | Operator05 | Operator03 | Operator04 ) } Factor;

Factor: Number
| ExpressionIdentifier [ FunctionCall ]
| IdentifierFactor
| LParen Expression RParen
| LBrace ConcatenationList RBrace
| QuoteLBrace ArrayLiteralList RBrace
Expand All @@ -661,6 +661,8 @@ <h1 id="formal-syntax"><a class="header" href="#formal-syntax">Formal Syntax</a>
| FactorType
;

IdentifierFactor: ExpressionIdentifier [ FunctionCall ];

FunctionCall: LParen [ ArgumentList ] RParen;

ArgumentList: ArgumentItem { Comma ArgumentItem } [ Comma ];
Expand Down Expand Up @@ -949,7 +951,9 @@ <h1 id="formal-syntax"><a class="header" href="#formal-syntax">Formal Syntax</a>

PortDeclarationItem: Identifier Colon ( PortTypeConcrete | PortTypeAbstract );

PortTypeConcrete: Direction [ ClockDomain ] ArrayType;
PortTypeConcrete: Direction [ ClockDomain ] ArrayType [ Equ PortDefaultValue ];

PortDefaultValue: Expression;

PortTypeAbstract: [ ClockDomain ] Interface [ ColonColon Identifier ] [ Array ];

Expand Down
11 changes: 4 additions & 7 deletions nightly/book/ja/02_features.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ <h1 id="特徴"><a class="header" href="#特徴">特徴</a></h1>
</ul>
<h2 id="real-time-diagnostics"><a class="header" href="#real-time-diagnostics">リアルタイム診断</a></h2>
<p>変数の未定義・未使用・未代入といった問題はエディタでの編集中にリアルタイムに通知されます。次の例では、未使用変数として通知された変数に <code>_</code> プレフィックスを付加することで未使用であることを明示し、警告を抑制しています。</p>
<p><img src="./img/diagnostics.gif" alt="diagnostics" /></p>
<p>ビデオが再生されない場合<sup class="footnote-reference"><a href="#1">1</a></sup></p>
<video src="./img/diagnostics.mp4" autoplay loop muted>
</video>
<h2 id="auto-formatting"><a class="header" href="#auto-formatting">自動フォーマット</a></h2>
<p>エディタと連携した自動フォーマット機能のほか、コマンドラインでのフォーマットやCIでのフォーマットチェックも可能です。</p>
<p><img src="./img/format.gif" alt="format" /></p>
<p>ビデオが再生されない場合<sup class="footnote-reference"><a href="#1">1</a></sup></p>
<video src="./img/format.mp4" autoplay loop muted>
</video>
<h2 id="integrated-test"><a class="header" href="#integrated-test">組み込みテスト</a></h2>
<p>SystemVerilogまたは<a href="https://www.cocotb.org">cocotb</a>で書かれたテストコードをVerylに埋め込み、<code>veryl test</code> コマンドで実行することができます。</p>
<pre><code class="language-veryl">#[test(test1)]
Expand Down Expand Up @@ -661,9 +661,6 @@ <h2 id="visibility-control"><a class="header" href="#visibility-control">可視
</td>
</tr>
</table>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p>いくつかのブラウザはデフォルトでGIF動画の再生を停止しています。ブラウザの設定を確認してください。</p>
</div>

</main>

Expand Down
2 changes: 1 addition & 1 deletion nightly/book/ja/03_getting_started/02_hello_world.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ <h2 id="ビルドする"><a class="header" href="#ビルドする">ビルドす
endmodule
</code></pre>
<p>さらに、生成されたコードのファイルリスト <code>hello.f</code> も生成されます。これは SystemVerilog コンパイラで使用できます。<a href="https://www.veripool.org/verilator/">Verilator</a> で使用するには以下のようにします。</p>
<pre><code>$ verilator --cc -f hello.f
<pre><code>$ verilator --binary -f hello.f
</code></pre>
<h2 id="生成されたコードを片づける"><a class="header" href="#生成されたコードを片づける">生成されたコードを片づける</a></h2>
<p>生成されたコードは <code>veryl clean</code> コマンドで削除することができます。</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,17 @@ <h1 class="menu-title">The Veryl Hardware Description Language</h1>
<main>
<h1 id="関数呼び出し"><a class="header" href="#関数呼び出し">関数呼び出し</a></h1>
<p>関数は <code>function_name(argument)</code> の形式で呼び出すことができます。<code>$clog2</code> のような SystemVerilog のシステム関数も使えます。</p>
<pre><code class="language-veryl playground">module ModuleA {
let _a: logic = PackageA::FunctionA(1, 1);
let _b: logic = $clog2(1, 1);
}

package PackageA {
<pre><code class="language-veryl playground">package PackageA {
function FunctionA (
a: input logic,
b: input logic,
) {}
}

module ModuleA {
let _a: logic = PackageA::FunctionA(1, 1);
let _b: logic = $clog2(1, 1);
}
</code></pre>

</main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ <h1 id="import--export"><a class="header" href="#import--export">Import / Export
<pre><code class="language-veryl playground">// ファイルスコープインポート
import $sv::SvPackage::*;

package PackageA {
const paramA: u32 = 1;
}

module ModuleA {
import PackageA::*;
import PackageA::paramA;
}

package PackageA {
const paramA: u32 = 1;
}
</code></pre>
<p><code>export</code> 宣言は宣言したパッケージからシンボルをエクスポートします。全てのシンボルをエクスポートするには <code>export *</code> を使用します。</p>
<pre><code class="language-veryl playground">package PackageA {
Expand Down
25 changes: 25 additions & 0 deletions nightly/book/ja/05_language_reference/07_module.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,31 @@ <h1 id="モジュール"><a class="header" href="#モジュール">モジュー
}
}
</code></pre>
<h2 id="ポートのデフォルト値"><a class="header" href="#ポートのデフォルト値">ポートのデフォルト値</a></h2>
<p>モジュールのポートはデフォルトを持つことができます。デフォルト値を持つポートはインスタンス時に省略することができ、省略されたポートにはデフォルト値が割り当てられます。デフォルト値としては以下の値を取ることができます。</p>
<ul>
<li>入力ポート: リテラル、パッケージ内の <code>const</code></li>
<li>出力ポート: <code>_</code> (無名識別子)</li>
</ul>
<pre><code class="language-veryl playground">module ModuleA (
a: input logic ,
b: input logic = 1,
x: output logic ,
y: output logic = _,
) {
assign x = a;
assign y = b;
}

module ModubeB {
inst instA: ModuleA (
a: 1,
// b は省略
x: _,
// y は省略
);
}
</code></pre>
<h2 id="ジェネリックインターフェース"><a class="header" href="#ジェネリックインターフェース">ジェネリックインターフェース</a></h2>
<p>ジェネリックインターフェースは特別なポート方向指定です。<code>interface</code> が指定されたとき、そのポートには任意のインターフェースを接続可能です。<code>interface::ModPort</code> のように modport を付けることもできます。この場合、<code>ModPort</code> を持つインターフェースだけが接続できます。</p>
<pre><code class="language-veryl playground">module ModuleA (
Expand Down
22 changes: 11 additions & 11 deletions nightly/book/ja/05_language_reference/14_generics.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,22 @@ <h2 id="ジェネリックモジュールインターフェース"><a class="hea
module ModuleD for ProtoA {}
</code></pre>
<h2 id="ジェネリックパッケージ"><a class="header" href="#ジェネリックパッケージ">ジェネリックパッケージ</a></h2>
<pre><code class="language-veryl playground">module ModuleA {
const A: u32 = PackageA::&lt;1&gt;::X;
const B: u32 = PackageA::&lt;2&gt;::X;
<pre><code class="language-veryl playground">package PackageA::&lt;T: const&gt; {
const X: u32 = T;
}

package PackageA::&lt;T: const&gt; {
const X: u32 = T;
module ModuleA {
const A: u32 = PackageA::&lt;1&gt;::X;
const B: u32 = PackageA::&lt;2&gt;::X;
}
</code></pre>
<h2 id="ジェネリック構造体"><a class="header" href="#ジェネリック構造体">ジェネリック構造体</a></h2>
<pre><code class="language-veryl playground">module ModuleA {
<pre><code class="language-veryl playground">package PackageA {
type TypeB = u32;
type TypeC = u64;
}

module ModuleA {
type TypeA = i32;

struct StructA::&lt;T: type&gt; {
Expand All @@ -278,11 +283,6 @@ <h2 id="ジェネリック構造体"><a class="header" href="#ジェネリック
var _b: StructA::&lt;PackageA::TypeB&gt;;
var _c: StructA::&lt;PackageA::TypeC&gt;;
}

package PackageA {
type TypeB = u32;
type TypeC = u64;
}
</code></pre>

</main>
Expand Down
8 changes: 6 additions & 2 deletions nightly/book/ja/07_appendix/01_formal_syntax.html
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ <h1 id="構文"><a class="header" href="#構文">構文</a></h1>
Expression12: { ( UnaryOperator | Operator09 | Operator05 | Operator03 | Operator04 ) } Factor;

Factor: Number
| ExpressionIdentifier [ FunctionCall ]
| IdentifierFactor
| LParen Expression RParen
| LBrace ConcatenationList RBrace
| QuoteLBrace ArrayLiteralList RBrace
Expand All @@ -660,6 +660,8 @@ <h1 id="構文"><a class="header" href="#構文">構文</a></h1>
| FactorType
;

IdentifierFactor: ExpressionIdentifier [ FunctionCall ];

FunctionCall: LParen [ ArgumentList ] RParen;

ArgumentList: ArgumentItem { Comma ArgumentItem } [ Comma ];
Expand Down Expand Up @@ -948,7 +950,9 @@ <h1 id="構文"><a class="header" href="#構文">構文</a></h1>

PortDeclarationItem: Identifier Colon ( PortTypeConcrete | PortTypeAbstract );

PortTypeConcrete: Direction [ ClockDomain ] ArrayType;
PortTypeConcrete: Direction [ ClockDomain ] ArrayType [ Equ PortDefaultValue ];

PortDefaultValue: Expression;

PortTypeAbstract: [ ClockDomain ] Interface [ ColonColon Identifier ] [ Array ];

Expand Down
Binary file added nightly/book/ja/img/diagnostics.mp4
Binary file not shown.
Binary file added nightly/book/ja/img/format.mp4
Binary file not shown.
Loading

0 comments on commit 5734c2a

Please sign in to comment.