其他分享
首页 > 其他分享> > Verilog编译指令

Verilog编译指令

作者:互联网

编译指令

编译指令(Compiler directive)能够让仿真器和综合工具执行一些特殊的操作。特点:

  1. 以`(重音符号)为前缀
  2. 从处理位置一直保持有效,除非被其他指令覆盖或者取消
  3. `resetall指令将所有编译指令复位成默认值

主要的编译指令:

  1. celldefine和endcelldefine:
  1. default_nettype
  1. define和undef
//Compare two 32-bit signed number
`define gt(x,y) ((x[32] == 0 && y[31] == 0) ? (x[30:0] > y[30:0]) : \
                 (x[31] == 1 && y[31] == 1) ? (x[30:0] > y[30:0]) : \
                 (x[31] == 0 && y[31] == 1) ? 1 : 0)
//pay attention that there is no ";" next to the ending of `define sentence!
reg [31:0] pig,dig;

if (`gt(pig,dog)) $display ("Info : Pig is greater than dog");
  1. include
  1. ifdef,else,elsif,endif,ifndef
  1. resetall
  1. line
  1. timescale
  1. unconnected_drive和nounconnected_drive
  1. begin_keywords和end_keywords
  1. pragma

掌握常用的编译指令就好

标签:模块,31,编译,指令,Verilog,resetall,include
来源: https://www.cnblogs.com/xing-usetc/p/16585290.html