当前位置:网站首页>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 .
边栏推荐
- The latest heart-shaped puzzle applet source code + with flow master
- Miccai2022 paper | evolutionary multi-objective architecture search framework: application in covid-19 3D CT classification
- pytest接口自动化测试框架 | 通过标记表达式执行用例
- 什么是Per-Title编码?
- pytest接口自动化测试框架 | pytest的setup和teardown函数
- Pytest interface automated testing framework | common plug-ins of pytest
- Cohere博客:在生产环境中运行大型语言模型-推理框架概览
- 最新心形拼图小程序源码+带流量主
- [communication principle] Chapter 1 -- Introduction
- Pycharm is really strong
猜你喜欢

网络协议:TCP/IP协议

什么是Per-Title编码?

Marriage seeking story

SSJ-21B时间继电器

Li Kai: the interesting and cutting-edge audio and video industry has always attracted me

4.1 configure MySQL and register login module

【倒计时10天】腾讯云音视频专场即将见面,千元大奖等你来拿!

Leetcode / Scala - sum of two numbers, three numbers, four numbers, and N numbers
![[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)

CVPR 2022 new SOTA for monocular depth estimation new CRFs: neural window fullyconnected CRFs
随机推荐
以太网驱动详解之RMII、SMII、GMII、RGMII接口
3.2 create menu and game pages (Part 2)
Sword finger offer 25. merge two sorted linked lists
Koin
Redis实现Single单点登入--系统框架搭建(一)
How did the $50000 annual salary run out
代码实例详解【可重入锁】和【不可重入锁】区别?
Hashtable
Redis实现Single单点登入详解
干货|语义网、Web3.0、Web3、元宇宙这些概念还傻傻分不清楚?(中)
一些实用、常用、效率越来越高的 Kubernetes 别名
Modeling essay series 151 SCLC engineering experiment 4-sclc object
Live broadcast preview at 19:30 on July 27: harmonyos3 and Huawei's full scene new product launch
pytest接口自动化测试框架 | 使用装饰器修饰需要运行的用例
3.1 create menu and game page - up
Talking about web vitals
Pytest interface automated testing framework | confitest.py
面试官:如何理解QPS,TPS,RT?
11 "pocket" universities in China! Running on campus and leaving the school before accelerating
y9000p2022重装win10问题