例化UDP的verilog语法规则如下图1所示:
图1:UDP例化语法
module内的 UDP 例化方式与我们前面博客介绍的门原语的例化方式相同,下面举几个UDP例化的例子。如果我们在module外定义了一个D触发器的UDP原语:
primitive d_edge_ff (q, clock, data);
output q; reg q;
input clock, data;
table
// clock data q q+
// obtain output on rising edge of clock
(01) 0 : ? : 0 ;
(01) 1 : ? : 1 ;
(0?) 1 : 1 : 1 ;
(0?) 0 : 0 : 0 ;
// ignore negative edge of clock
(?0) ? : ? : - ;
// ignore data changes on steady clock
? (??) : ? : - ;
endtable
endprimitive
当我们在module中例化该UDP时,例化方式如下:
点赞加关注博主(ID:FPGA小飞)的博文,咱们一起系统学习verilog最终标准IEEE Std 1364-2005吧!