# VIVADO開發流程(Simulation)

本篇整理一些網路文章做整理與教學講解，以xilinx vivado作為開發環境，建立一個簡單的小電路、testbench流程說明

## 1. Create project

首先找到vivado程式開啟後，點選Create project建立一個新專案．<br>

<figure><img src="https://docs.amd.com/api/khub/maps/0QO6TGlEn15XdcCJQZ6NTA/resources/ac5CjwXEql5rNBdDMr2hqw/content?Ft-Calling-App=ft%2Fturnkey-portal&#x26;Ft-Calling-App-Version=4.3.22" alt=""><figcaption></figcaption></figure>

Next下一個畫面會問你要新增範例或是imort檔案，這邊依照需求選擇

<figure><img src="https://ithelp.ithome.com.tw/upload/images/20171213/20107543BOjBaRXSAr.jpg" alt=""><figcaption></figcaption></figure>

接著會進到選擇晶片/電路的步驟，根據你使用或目標電路搜尋、選擇

<figure><img src="/files/6Nx8sdBhR5ZjyFHqZltl" alt=""><figcaption><p>選擇電路、晶片的視窗範例</p></figcaption></figure>

## 2. Create source file/add source file

* 建立好專案之後，從Flow navigator找到add source並create 空的verilog檔進行程式撰寫&#x20;
* 可參考網路上的open source進行改寫&#x20;
* 撰寫時，隨時參考對應的裝置，確保開發的功能符合IC SPEC

<figure><img src="https://ithelp.ithome.com.tw/upload/images/20171213/20107543mF6RnfysMs.jpg" alt=""><figcaption><p>選擇左上角的add source並選擇新增source file時，會跳出的視窗</p></figcaption></figure>

## 3. Simulaiton

* testbench寫法比較向一般的程式非單純電路，synthesis會出現錯誤，因此務必要進行區分&#x20;
* 我個人比較喜歡將testbench跟合成電路放在自建的額外資料夾，在使用add source分別引入Design source以及simulation，此作法好處是在要複製的時候容易整包帶走，又可以在執行合成電路與模擬的動作區分&#x20;
* 注意下圖中add create simulation source與一般的design source標題不同

<figure><img src="/files/IGo3Fm2rDxHtWMjY4BIo" alt=""><figcaption><p>在add sources欄位內找到simulation的選項，會跳出以上的視窗</p></figcaption></figure>

<figure><img src="/files/le3xmEywFFNalj86Zm6g" alt=""><figcaption><p>參考右圖粉紅色區塊，可發現design 與simulation source不同</p></figcaption></figure>

* 進行模擬前建議先進setting調整runtime，從1000ns調整至10000ns，避免測試時間太短，尚未看到自己想測試的信號。&#x20;
* 選擇在Flow navigator當中的Run simulation，即可產生右圖，並檢查信號是否與規劃相同

<figure><img src="/files/oMtxTCYWfrOit2LyXxjK" alt=""><figcaption></figcaption></figure>

> 本篇參考文獻
>
> <https://docs.amd.com/r/en-US/ug888-vivado-design-flows-overview-tutorial/>
>
> verilog 從放棄到有趣 <https://ithelp.ithome.com.tw/articles/10191483>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://soups-misc.gitbook.io/fpga-training/vivado-kai-fa-liu-cheng-simulation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
