SystemVerilog提供了三种类型的精化时间常数:
 
•参数:与最初的Verilog标准相同,可以以相同的方式使用。
 
•localparameter:与参数类似,但不能被上层覆盖模块。
 
•specparam:用于指定延迟和定时值;因此,该值不是
 
在Vivado合成中得到支持。
 
还有一个名为const的运行时常量声明。
 
类型运算符
 
类型运算符允许将参数指定为数据类型,这允许模块具有
 
不同实例的不同类型的参数。
 
铸造
 
在SystemVerilog中,将一种数据类型的值分配给不同的数据类型是非法的。
 
但是,解决方法是使用强制转换运算符(')。强制转换运算符转换数据类型
 
在不同类型之间分配时。用法是:
 
casting_type'(表达式)
 
casting_type是以下类型之一:
 
•整数类型
 
•non_integer_type
 
•real_type
 
•无符号常量
 
•用户创建的签名值类型
 
聚合数据类型
 
在聚合数据类型中,存在结构和并集,如下所述小节。
 
结构
 
结构是可以作为一个值或单个成员引用的数据集合结构的。这类似于记录的VHDL概念。用于指定的格式
 
结构为:
 
struct{struct_member1;struct_mmember2;…struct_mmberx;}struct_name;
 
工会
 
并集是可以以不同方式引用的数据的单个部分。的格式指定并集是:
 
typedef联合打包的{union_mber1;union_mber 2…union_mmberx;}
 
unions_name;
 
打包和非打包阵列
 
Vivado synthesis同时支持打包和非打包阵列:
 
逻辑[5:0]sig1//压缩阵列逻辑sig2[5:0]//非压缩数组具有预定宽度的数据类型不需要声明的压缩维度:
 
整数sig3//等效于逻辑符号[31:0]sig3
 
 Processes  
 
 Always Procedures  
 
 There are four  always  procedures:  
 
 • always  
 
 • always_comb  
 
 • always_latch  
 
 • always_ff  
 
 The procedure  always_comb  describes combinational logic. A sensitivity list is inferred by the  
 
 logic driving the  always_comb  statement.  
 
 For  always  you must provide the sensitivity list. The following examples use a sensitivity list of  
 
 in1  and  in2 :  
 
 always@(in1 or in2)  
 
 out1 = in1 & in2;  
 
 always_comb out1 = in1 & in2;  
 
 The procedure  always_latch  provides a quick way to create a latch. Like  always_comb , a  
 
 sensitivity list is inferred, but you must specify a control signal for the latch enable, as in the  
 
 following example:  
 
 always_latch  
 
 if(gate_en) q <= d;  
 
 The procedure  always_ff  is a way to create Flip-Flops. Again, you must specify a sensitivity  
 
 list:  
 
 always_ff@(posedge clk)  
 
 out1 <= in1;  
 
 阻止语句
 块语句提供了一种将语句集分组在一起的机制。顺序块在陈述的前后各有一个开头和结尾。块可以声明自己的变量,以及变量是特定于该块的。顺序块也可以具有与关联的名称那个街区。格式如下:
  begin [: block name]  
  [declarations]  
  [statements]  
  end [: block name]  
  begin : my_block logic temp;  
  temp = in1 & in2; out1 = temp;  
  end : my_block  
  在前面的示例中,块名称也在结束语句之后指定。这使得代码可读性更强,但不是必需的。
 注意:Vivado合成中不支持并行块(或分叉连接块)。
 程序时间控制
 SystemVerilog有两种类型的定时控制:
 •延迟控制:指定语句执行之间的时间量。这不是对合成有用,Vivado合成在创建逻辑的同时忽略了时间语句任务。
 •事件控制:使分配与特定事件一起发生;例如
 总是@(posedge clk)。这是Verilog的标准配置,但SystemVerilog包含额外的功能。
 逻辑或运算符是一种提供任意数量的事件的能力,因此任何事件都会触发声明的执行。要执行此操作,请使用特定的或,或在中用逗号分隔敏感度列表。例如,以下两个语句是相同的:
  always@(a or b or c)  
  always@(a,b,c)  
  SystemVerilog还支持隐式事件表达式@*。这有助于消除由于灵敏度列表不正确而导致的模拟不匹配。
 例如
  Logic always@* begin 
  有关模拟的Verilog格式,请参阅Vivado设计套件用户指南:逻辑模拟(UG900)。
 操作员
 Vivado合成支持以下SystemVerilog运算符:
  • Assignment operators ( =, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=, <<<=,  
  >>>= )  
  • Unary operators ( +, -, !, ~, &, ~&, |, ~|, ^, ~^, ^~ )  
  • Increment/decrement operators  (++, -- )  
  • Binary operators ( +, -, *, /, %, ==, ~=, ===, ~==, &&, ||, **, <, <=, >,  
  >=, &, |, ^, ^~, ~^, >>, <<, >>>, <<< )  
  Note :  A**B  is supported if  A  is a power of 2 or  B  is a constant.  
  • Conditional operator ( ? : )  
  • Concatenation operator ( {...} ) 
  签名表达式
 Vivado合成同时支持有符号和无符号运算。信号可以声明为
 未签名或已签名。例如
  logic [5:0] reg1;  
  logic signed [5:0] reg2;