Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
b3exp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2022
b3exp
Wiki
Verilator
Changes
Page history
New page
Templates
Clone repository
Update Verilator
authored
4 years ago
by
Toru Koizumi
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Verilator.md
+8
-4
8 additions, 4 deletions
Verilator.md
with
8 additions
and
4 deletions
Verilator.md
View page @
69a561f6
...
...
@@ -7,7 +7,7 @@ VerilatorはオープンソースのVerilog HDLシミュレータです。
Verilog HDLの記述をC++に変換し、コンパイル後にシミュレーションするため非常に高速という特徴があります。
一方、高速化のためにVerilog HDLの一部の機能が使えないという制約があります。
また、テストベンチをC
/C
++で書く必要があります。
また、テストベンチをC++で書く必要があります。
## Verilatorのインストール
...
...
@@ -23,7 +23,7 @@ $ sudo apt-get install verilator
適当な作業ディレクトリを用意し、そこにVerilog HDLのソースファイルを置いたとします。
そのディレクトリに、C
/C
++で書かれたテストベンチファイルを作成します。例を一番下に書きました。
そのディレクトリに、C++で書かれたテストベンチファイルを作成します。例を一番下に書きました。
`$ verilator --cc top.v -exe test_bench.cpp`
とコマンドを実行することで、
`obj_dir`
というディレクトリが作成されます(Vivadoでは出ないLintエラーの警告が出るかもしれません)。このディレクトリの中には、C++に変換された
`top.v`
である
`Vtop.cpp`
などが含まれています。
...
...
@@ -65,8 +65,12 @@ void uart_rx(unsigned int u) {
int main() {
Vtop top;
top.sysclk = 0;
top.eval();
top.sysclk = 1;
top.eval();
top.cpu_resetn = 0;
top.eval();
top.sysclk = 0;
top.eval();
top.sysclk = 1;
...
...
@@ -80,7 +84,7 @@ int main() {
top.eval();
top.sysclk = 1;
top.eval();
uart_rx(top.uart_
rx_ou
t);
uart_rx(top.uart_t
x
);
timer_ps += 1000000000000 / clock_Hz;
}
}
...
...
This diff is collapsed.
Click to expand it.