当前位置:网站首页>Introduction to FPGA (I) - the first FPGA project
Introduction to FPGA (I) - the first FPGA project
2022-07-26 12:02:00 【TARS_ 90%Honesty】
Verilog Code writing and related grammar
test.v
// The module name is consistent with the file name
module test(
input port_a , // Only wire, No, reg, Default wire
input port_b ,
input port_c ,
output wire port_d , // Default wire( conductor ), Also have reg( register )
output wire port_e ,
output wire port_f ,
output wire port_g ,
output wire port_h
);
// assign : Yes wire Type
// always : Yes reg Type
assign port_d = port_a & port_b; // Bitwise AND
assign port_e = port_a | port_c; // Press bit or
assign port_f = ~port_a; // Bitwise non
assign port_g = port_b ^ port_c; // Exclusive or
assign port_h = port_a ^~ port_c; // Same as or
endmodule
tb_test.v
// `timescale 1ns/1ps // Time unit / Time precision ( Similar to the scale , Company cm, precision ms)
`timescale 1ns / 1ns // Time precision can also be equal to time units
module tb_test; // The test module has no input and output ports
// Three wires of the signal source
reg test_a;
reg test_b;
reg test_c;
// Connect the five wires of the oscilloscope
wire rslt_d;
wire rslt_e;
wire rslt_f;
wire rslt_g;
wire rslt_h;
// initial Assigned signal , Must be defined as reg type
initial begin
test_a = 1; // stay 0 Time gives initial value
test_b = 0;
test_c = 1;
#5 // Time delay 5ns
test_a = 0;
test_b = 1;
test_c = 1;
#5
test_a = 0;
test_b = 0;
test_c = 0;
end
// Modularization ( Similar to function call )
test test_inst(
.port_a (test_a),
.port_b (test_b),
.port_c (test_c),
.port_d (rslt_d),
.port_e (rslt_e),
.port_f (rslt_f),
.port_g (rslt_g),
.port_h (rslt_h)
);
endmodule
Modelsim Simulation steps
- First step : New project .

- The second step : Specify the project name and save path , The rest remain unchanged by default .
- Project Name:aaa
- Project Location:./sim

- The third step : Add an existing file test.v and tb_test.v.


- Step four : Compile the added file .

- After successful compilation , You can see the file status Turn to green check .

The prompt message is displayed successfully .
- After successful compilation , You can see the file status Turn to green check .
- Step five : Switch to Library Next , find work file , Click on + Number , Find out test and tb_test file .


- Step six : Yes tb_test File start simulation , Right click on the file ,
Simulate without Optimization
- Step seven : Pop up sim Window , You can see the name of the instantiated module

- Step eight : stay tb_test Right click to add Wave, stay test_inst Right click to add Wave.


- Step nine : take Wave The window is displayed independently , Click the following icon in the default layout .

- Step 10 :Wave Left side of window , Test ports and module ports have been shown in the form of a list .

- Click on the icon in the lower left corner , Don't show paths , More concise


- Click on the icon in the lower left corner , Don't show paths , More concise
- Step 11 : Smart grouping ,Ctrl + A,Ctrl + G.

- The twelfth step : Modify the running time , Click on Run


- Thirteenth Step : Click on Run after , The waveform is not obvious , Click global preview

- Zoom in at the cursor

- Zoom in at the cursor
- The fourteenth step : Check whether the waveform is correct , So as to check whether the code logic is correct .
边栏推荐
- Cohere博客:在生产环境中运行大型语言模型-推理框架概览
- 尤雨溪向初学者推荐Vite 【为什么使用Vite】
- Substance painter 2021 software installation package download and installation tutorial
- [Anhui University] information sharing of postgraduate entrance examination and re examination
- Pycharm is really strong
- 数智转型,管理先行|JNPF全力打造“全生命周期管理”平台
- 【活动早知道】LiveVideoStack近期活动一览
- Pytest interface automated testing framework | using multiple fixtures
- Flutter 学习之路
- Server memory failure prediction can actually do this!
猜你喜欢
![[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)](/img/84/640de0bf779cd45498204909be56d1.png)
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)

音视频技术开发周刊 | 255

pytest接口自动化测试框架 | pytest常用插件
![[countdown 10 days] Tencent cloud audio and video special is about to meet, and the thousand yuan prize is waiting for you!](/img/a0/4910970a089cab198875944c7ae88c.png)
[countdown 10 days] Tencent cloud audio and video special is about to meet, and the thousand yuan prize is waiting for you!

使用fastJson中的JSONObject对象简化POST请求传参

Audio and video technology development weekly | 255

什么是Per-Title编码?

Ga-rpn: recommended area network for guiding anchors

Miccai2022 paper | evolutionary multi-objective architecture search framework: application in covid-19 3D CT classification

An online duplicate of a hidden bug
随机推荐
Pytest interface automated testing framework | introduction to fixture of pytest
Substance painter 2021 software installation package download and installation tutorial
3.1 create menu and game page - up
基于 Flink CDC 实现海量数据的实时同步和转换
程序员培训学习后好找工作吗?
MySQL组合索引(多列索引)使用与优化
Win10 uses NVM to install node, NPM, and cnpm
PyCharm是真的强
[download attached] a powerful web automated vulnerability scanning tool - Xray
系统调用捕获和分析—Ring0层kprobe劫持系统调用
pytest接口自动化测试框架 | 通过标记表达式执行用例
Test cases should never be used casually, recording the thinking caused by the exception of a test case
SSJ-21B时间继电器
Didi was fined 8billion! The era of making money from user data is over
Koin
Talking about web vitals
Pycharm is really strong
[communication principle] Chapter 1 -- Introduction
大佬们,cdc oracle 怎么设置从指定scn号开始读取,或是怎么设置只读全量的归档,不去读取快
Pytest interface automation test framework | setup and teardown functions of pytest