飞道的博客

【FPGA】基本实验步骤演示 | Verilog编码 | 运行合成 | 设备/引脚分配 | 综合/实施 | 设备配置

353人阅读  评论(0)

写在前面:本章的目的是让你理解与门、或门和非门的行为,并使用 Verilog 语言实现多输入与门、或门和非门。在生成输入信号之后,你需要通过模拟来验证这些门的操作,并使用 FPGA 来验证 Verilog 实现的电路的行为。

0x00 引入:与门、或门与非门

构成数字系统电路的最基本元素,以集成电路的形式实现逻辑代数中0和1的运算,作为这些逻辑代数基础的门有与门、或门、非门等,它们的组合可以生成多种形式的门。

0x01 与门(AND)

接收两个或多个输入信号的门,所有信号都必须是高信号才能输出高信号,除此之外还必须输出低信号。布尔表达式中的乘法表示如下:

0x02 或门(OR)

接收两个或多个信号,其中一个信号在高信号时输出高值,在没有高信号时输出低值。布尔表达式中的乘法表示如下:

0x03 非门(NOT)

NOT 门(Inverter),通过反转输入值输出。BUFFER 门由两个 NOT gate 组成,信号不变,但增强了信号强度。

0x04 传播延迟(Propagation Delay Time)

从输入到输出的信号值变化所需的平均时间,影响逻辑门的延迟和数量。

0x05 验证 FPGA 行为

动作验证阶段:

  • Verilog coding
  • Run synthesis
  • Device/Pin assignment
  • Synthesis / Implement
  • Device configuration

例子:非门 Verilog coding

Device assignment:

 Device assignment → Device : xc7a75tfgg484(Artix7)

Pin assignment

链接你希望在 FPGA pin list 中分配的 Pin 和 Verilog 源端口:


  
  1. set_property -dict {PACKAGE_PIN G21 IOSTANDARD LVCMOS33} [get_ports a]
  2. set_property -dict {PACKAGE_PIN F15 IOSTANDARD LVCMOS33} [get_ports y]

 

 

Synthesis / Implementation:

Device configuration:

我的板子是 FPGA Starter Kit Ⅲ :

板子的初始化状态如下所示:

Open Target →  点击 auto connect,自动连接:

选择 Program Device:

🚩 输出结果演示:

0x06 练习:4-input 或门 

比较(A)和(B)的布尔表达式

完成(A)和(B)的 Verilog 编码

通过(A)和(B)模拟比较输出结果

比较(A)和(B)的动作与 FPGA 的动作

 完成 4-input OR gate 的真值表

💬 or.v


  
  1. `timescale 1ns / 1 ps
  2. module input_4_OR (
  3. input A,
  4. input B,
  5. input C,
  6. input D,
  7. output E,
  8. output F,
  9. output G
  10. );
  11. assign E = A | B;
  12. assign F = C | E;
  13. assign G = D | F;
  14. endmodule

💬 or.tb


  
  1. `timescale 1ns / 1ps
  2. module input_4_OR_tb;
  3. reg A;
  4. reg B;
  5. reg C;
  6. reg D;
  7. wire E;
  8. wire F;
  9. wire G;
  10. input_4_OR u_input_4_OR(
  11. .A(A ),
  12. .B(B ),
  13. .C(C ),
  14. .D(D ),
  15. .E(E ),
  16. .F(F ),
  17. .G(G )
  18. );
  19. initial begin
  20. A = 1'b0;
  21. B = 1'b0;
  22. C = 1'b0;
  23. D = 1'b0;
  24. end
  25. always@(A or B or C or D) begin
  26. A <= # 20 ~A;
  27. B <= # 30 ~B;
  28. C <= # 40 ~C;
  29. D <= # 50 ~D;
  30. end
  31. initial begin
  32. # 1000
  33. $finish;
  34. end
  35. endmodule

🚩 Simulation 结果如下:


  
  1. 📌 [ 笔者 ]   王亦优
  2. 📃 [ 更新 ]    2023.1 .3
  3. ❌ [ 勘误 ]   /* 暂无 */
  4. 📜 [ 声明 ]   由于作者水平有限,本文有错误和不准确之处在所难免,
  5. 本人也很想知道这些错误,恳望读者批评指正!

📜 参考资料 

Introduction to Logic and Computer Design, Alan Marcovitz, McGrawHill, 2008

Microsoft. MSDN(Microsoft Developer Network)[EB/OL]. []. .

百度百科[EB/OL]. []. https://baike.baidu.com/.


转载:https://blog.csdn.net/weixin_50502862/article/details/128517299
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场