SystemVerilogveriflcation精品PPT课件
合集下载
verilog数字系统设计教程PPT课件

数字系统设计的核心知识
• 复杂数字系统的构成; • 基本电路和 Verilog 的对应关系; • 同步有限状态机在电路中的作用; • 时钟树与自动综合技术
数字逻辑电路的构成
- 组合逻辑:输出只是输入逻辑电平的函
数(有延时),与电路的原始状态无关。
• 时序逻辑:输出不只是输入的逻辑电
平的函数,还与电路所处的状态有关。
8 ‘ d 31
8‘d
t
out[15:0]
202
16 ‘ d
16‘ d
t
Sn 开
93
606
t 关
全局时钟网和平衡树结构
触发器1
全局时钟网络 触发器 图1 全局时钟网示意图
缓冲器
触发器n
图2 平衡树结构示意图
避免冒险和竞争
• 由于组合逻辑和布线的延迟引起
a
c
b
a
b
t
c
t
clock
避免冒险和竞争与流水线
t
t
带寄存器的八位数据通路控制器的波形
ControlSwitch
in[7]
out[7]
CLOCK
out[7]
D Q[7]
ControlSwitch
in[0]
out[0]
CLOCK
out[0]
D Q[0]
带寄存器的八位数据通路控制器的Verilog描述
`define ON 1 ‘b 1 `define OFF 1 ‘b 0 wire ControlSwitch; wire clock wire [7:0] out, in;
ControlSwitch in[7]
out[7]
…... …...
in[0]
• 复杂数字系统的构成; • 基本电路和 Verilog 的对应关系; • 同步有限状态机在电路中的作用; • 时钟树与自动综合技术
数字逻辑电路的构成
- 组合逻辑:输出只是输入逻辑电平的函
数(有延时),与电路的原始状态无关。
• 时序逻辑:输出不只是输入的逻辑电
平的函数,还与电路所处的状态有关。
8 ‘ d 31
8‘d
t
out[15:0]
202
16 ‘ d
16‘ d
t
Sn 开
93
606
t 关
全局时钟网和平衡树结构
触发器1
全局时钟网络 触发器 图1 全局时钟网示意图
缓冲器
触发器n
图2 平衡树结构示意图
避免冒险和竞争
• 由于组合逻辑和布线的延迟引起
a
c
b
a
b
t
c
t
clock
避免冒险和竞争与流水线
t
t
带寄存器的八位数据通路控制器的波形
ControlSwitch
in[7]
out[7]
CLOCK
out[7]
D Q[7]
ControlSwitch
in[0]
out[0]
CLOCK
out[0]
D Q[0]
带寄存器的八位数据通路控制器的Verilog描述
`define ON 1 ‘b 1 `define OFF 1 ‘b 0 wire ControlSwitch; wire clock wire [7:0] out, in;
ControlSwitch in[7]
out[7]
…... …...
in[0]
VerilogHDL数字系统设计技巧精品PPT课件

module clk ( o_clk, i_clk, rst_n );
output o_clk; input i_clk; input rst_n; parameter N = N_even; // 设置偶数倍分频 parameter M = ?; // M="N/2-1" // bit_of_N: N_even的二进制位宽 reg [(bit_of_N - 1):0] cnt; // 计数器单元 reg o_clk;
cnt <= cnt + 1'b1; end end
恰恰分频:任意整数和小数分频的Verilog实现
// 生成上升沿时钟 // 0~(N/2-1) ↑ -> 1; (N/2)~(N-1) ↑ -> 0 always @ (posedge i_clk, negedge rst_n) begin
if (!rst_n) o_clk <= 0;
偶数分频器的实现非常简单,通过计数器计数 就完全可以实现。 如进行N倍偶数分频,就可以通过由待分频的 时钟触发计数器计数。 当计数器从0计数到N/2-1时,输出时钟进行翻 转,并给计数器一个复位信号,以使下一个时 钟从零开始计数。 以此循环,就可以实现任意的偶数分频。
恰恰分频:任意整数和小数分频的Verilog实现
恰恰分频:任意整数和小数分频的Verilog实现
always@(negedge clk or negedge rst_n) begin if(!rst_n) begin cnt2<=0; end else if(cnt2==2'b10) begin cnt2<=0; end else begin cnt2<=cnt2+1; end end
output o_clk; input i_clk; input rst_n; parameter N = N_even; // 设置偶数倍分频 parameter M = ?; // M="N/2-1" // bit_of_N: N_even的二进制位宽 reg [(bit_of_N - 1):0] cnt; // 计数器单元 reg o_clk;
cnt <= cnt + 1'b1; end end
恰恰分频:任意整数和小数分频的Verilog实现
// 生成上升沿时钟 // 0~(N/2-1) ↑ -> 1; (N/2)~(N-1) ↑ -> 0 always @ (posedge i_clk, negedge rst_n) begin
if (!rst_n) o_clk <= 0;
偶数分频器的实现非常简单,通过计数器计数 就完全可以实现。 如进行N倍偶数分频,就可以通过由待分频的 时钟触发计数器计数。 当计数器从0计数到N/2-1时,输出时钟进行翻 转,并给计数器一个复位信号,以使下一个时 钟从零开始计数。 以此循环,就可以实现任意的偶数分频。
恰恰分频:任意整数和小数分频的Verilog实现
恰恰分频:任意整数和小数分频的Verilog实现
always@(negedge clk or negedge rst_n) begin if(!rst_n) begin cnt2<=0; end else if(cnt2==2'b10) begin cnt2<=0; end else begin cnt2<=cnt2+1; end end
systemVerilog快速入门PPT

// 4态,Verilog-2001(位宽可变)数据类型 //4态,Verilog-2001(32位)有符号数据类型 //4态,(位宽可变) 0,1,x,或者 z //2态,(位宽可变) 1位 0 或 1 //2态,(8位)有符号整型数 //2态,(16位)有符号整型数 //2态,(32位)有符号整型数 //2态,(64位)有符号整型数
极大地提高了仿真速度
仅一种语言就能解决设计和测试问题
Co-sim HDL Simultion Overhead
testbench
使得我们有可能使用更 高速度的仿真工具,加 速了设计的完成
SystemVerilog
testbench
设计和验证语言的统一提高了设计效率,学习周期 设计和验证语言的统一提高了设计效率, 很短,设计和验证人员都乐意采用: 很短,设计和验证人员都乐意采用: 可自动生成高级的受约束-随机测试信号语句, - 可自动生成高级的受约束-随机测试信号语句,大 大降低了设计和验证的复杂度; 大降低了设计和验证的复杂度; - 完整的统一的断言技术改善了设计小组和验证小 组之间的交流。 组之间的交流。
SystemVerilog 是Verilog-2001扩展后的超集 扩展后的超集
---------------------------------- Verilog -2001 -------------------------------
ANSI C style ports standard file I/O (* attributes *) generate $value$plusargs configurations localparam `ifndef `elsif `line memory part selects constant functions @* variable part select
《Verilog设计入门》PPT课件

精选PPT
18
3.1 组合电路的Verilog描述
3.1.2 4选1多路选择器及其case语句表述方式 6.赋值操作符 “<=”,只能用于顺序语句,不能用于assign引 导的并行语句
两种过程赋值操作: (1)阻塞式赋值“=”:语句执行结束,右侧表达式的值立刻赋给左侧 目标变量。
对于always引导的块语句中含有多条阻塞式赋值语句时,当执行某 一条语句时,其它语句不允许执行,被阻塞了,具有顺序执行的特点。
module h_adder (a,b,so,co); input a,b; output so,co; assign {co,so} = a + b;
endmodule
精选PPT
30
3.1 组合电路的Verilog描述
3.1.5 加法器及其Verilog描述 4. 算数操作符的使用
精选PPT
31
endmodule
精选PPT
34
3.1 组合电路的Verilog描述
3.1.5 加法器及其Verilog描述 5. 全加器描述----用半加器、或门模块及例化语句描述
精选PPT
35
3.1 组合电路的Verilog描述
3.1.5 加法器及其Verilog描述 5. 全加器描述----顶层文件及例化语句描述
3.1 组合电路的Verilog描述
3.1.5 加法器及其Verilog描述 5. 全加器描述----用半加器模块和或门模块描述
精选PPT
32
3.1 组合电路的Verilog描述
3.1.5 加法器及其Verilog描述 5. 全加器描述----用半加器、或门模块及例化语句描述
module or2a(a,b,c); input a,b; output c; assign c = a | b;
SystemVerilog_veriflcation

Extensive support for verilog-2001 in simulation and synthesis
Synthesis tool support for system verilog is limited
“This is a major drawback which is restricting people to accept SystemVerilog as a Design language”
Why SystemVerilog?
Constrained Randomization
OOP support
Easy c model integration
New data types ie,logic
System Verilog
Assertions Coverage support
Narrow gap b/w design & verification engineer
3. /
Books :
1. Writing Testbenches using SystemVerilog - Janick Bergeron 2. Verification Methodology Manual - Janick Bergeron 3. SystemVerilog For Verification - Chris Spear
It has features inherited from Verilog HDL,VHDL,C,C++ Adds extended features to verilog
What is SystemVerilog?
System verilog is the superset of verilog
第17章Verilog中的高级结构ppt课件

if (en_mult) multme (tmp1, tmp2, out); // 任务调用
end
运算
always @( negedge en_mult) begin // 中止
disable multme ; // *** 禁止任务
***
禁止命名块和任务
• disable语句终结一个命名块或任务的所有活动。也就是说,在一个 命名块或任务中的所有语句执行完之前就返回。 语法: disable <块名称> 或 disable <任务名_or_and;
d, e;
input [7:0] a, b, c,
if (e = = 1)
| b) & (c | d);
f_or_and = (a
else
函数中不能有时序控制,但调用它的过f_程or可_以an有d 时= 序0;控制。
函数名f_or_and在e函n数df中un作ct为iornegister使用
显式FSM: • 利于结构化 • 易于处理缺省条件 • 能处理复杂的状态改变 • 所有综合工具都支持
有限状态机
• 在隐式FSM中,只要数据在一个时钟沿写入并在另一个周期读出, 则会生成寄存器。
• 所有FSM必须有复位,且状态改变必须在单一时钟信号的同一边 沿。
• 通常,如果状态改变简单明确,且综合工具接受隐式状态机,就 可以使用隐式类型。如果状态改变很复杂,则显式类型更加有效。
reg [15: 0] out;
always @( posedge clk)
begin : arith_block // *** 命名块
***
// *** 局部变量 ***
reg [3: 0] tmp1, tmp2;
verilog第一~第六讲PPT

5) 开关级(switch-level)
西安电子科技大学
雷达信号处理国防科技重点实验室
1.1
门级结构描述
一个逻辑网络是由许多逻辑门和开关所组成,因此用逻辑门的模型 来描述逻辑网络是最直观的。Verilog HDL提供了一些门类型的关键 字,可以用于门级结构建模。
1.1.1 与非门、或门和反向器等及其说明语法
西安电子科技大学 雷达信号处理国防科技重点实验室
2.1
加法器
在数字信号处理的快速运算电路中常常用到多位数字 量的加法运算,这时需要用到并行加法器。并行加法器比串 行加法器快得多,电路结构也不太复杂。
用Verilog HDL 来描述加法器是相当容易的,只需要把运 算表达式写出就可以了。
module add_4( X, Y, sum, C); input [3 : 0] X, Y; output [3: 0] sum; output C; assign {C, Sum } = X + Y; endmodule
1) flop f1op_d( d1, clk, clrb, q, qn); 2) flop flop_d (.clock(clk),.q(q),.clear(clrb),.qb(qn),.data(d1));
显而易见,通过Verilog HDL模块的调用,可以构成任 何复杂结构的电路。这种以结构方式所建立的硬件模型不仅 是可以仿真的,也是可综合的,这就是以门级为基础的结构 描述建模的基本思路。
综合工具能自 动把以上源代码综 合成一个八位比较 器
雷达信号处理国防科技重点实验室
2.4 多路器
多路器是一 个多输入、单输 出的组合逻辑电 路,在数字系统 中有着广泛的应 用。它可以根据 地址码的不同, 从多个输入数据 中选取一个,让 其输出到公共的 输出端。
西安电子科技大学
雷达信号处理国防科技重点实验室
1.1
门级结构描述
一个逻辑网络是由许多逻辑门和开关所组成,因此用逻辑门的模型 来描述逻辑网络是最直观的。Verilog HDL提供了一些门类型的关键 字,可以用于门级结构建模。
1.1.1 与非门、或门和反向器等及其说明语法
西安电子科技大学 雷达信号处理国防科技重点实验室
2.1
加法器
在数字信号处理的快速运算电路中常常用到多位数字 量的加法运算,这时需要用到并行加法器。并行加法器比串 行加法器快得多,电路结构也不太复杂。
用Verilog HDL 来描述加法器是相当容易的,只需要把运 算表达式写出就可以了。
module add_4( X, Y, sum, C); input [3 : 0] X, Y; output [3: 0] sum; output C; assign {C, Sum } = X + Y; endmodule
1) flop f1op_d( d1, clk, clrb, q, qn); 2) flop flop_d (.clock(clk),.q(q),.clear(clrb),.qb(qn),.data(d1));
显而易见,通过Verilog HDL模块的调用,可以构成任 何复杂结构的电路。这种以结构方式所建立的硬件模型不仅 是可以仿真的,也是可综合的,这就是以门级为基础的结构 描述建模的基本思路。
综合工具能自 动把以上源代码综 合成一个八位比较 器
雷达信号处理国防科技重点实验室
2.4 多路器
多路器是一 个多输入、单输 出的组合逻辑电 路,在数字系统 中有着广泛的应 用。它可以根据 地址码的不同, 从多个输入数据 中选取一个,让 其输出到公共的 输出端。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Verilog
System Verilog
It uses the “always” procedure to represent Sequential logic Combinational logic Latched logic
What is SystemVerilog?
System verilog is the superset of verilog It supports all features of verilog plus add on features It’s a super verilog additional features of system verilog will be discussed
1. Writing Testbenches using SystemVerilog - Janick Bergeron
2. Verification Methodology Manual - Janick Bergeron
3. SystemVerilog For Verification - Chris Spear
What is SystemVerilog?
What is SystemVerilog?
SystemVerilog is a hardware description and Verification language(HDVL) SystemVerilog is an extensive set of enhancements to IEEE 1364 Verilog-2001 standards It has features inherited from Verilog HDL,VHDL,C,C++ Adds extended features to verilog
Why SystemVerilog ?
Why SystemVerilog?
Constrained Randomization
Easy c model integration
OOP support Assertions
System Verilog
New data types ie,logic Coverage support
System level verification
Unified language to span almost the entire SoC dese rules
Verilog
System Verilog
Strict about usage of wire Logic data type can be used so
& reg data type
no need to worry about reg & wire
Variable types are 4 state 2 state data type added – 0, 1
– 0,1,X,Z
state
2 state variable can be used in test benches,where X,Z are not required
An Introduction to SystemVerilog
This Presentation will…
Define what is “SystemVerilog” Provide an overview of the major features in “SystemVerilog” How it’s different from other languages
Narrow gap b/w design & verification engineer
SystemVerilog Intent
Verilog
System Verilog
Design entry
Module level design
Module level verification Gate level simulations
2 state variable in RTL model may enable simulators to be more efficient
Memory Management
Verilog
System Verilog
Memories in verilog are static in nature
Complexity
Verilog
System Verilog
For complex designs large number of RTL code is required
Increase in verification code to test these designs
Extra time
Less RTL & verification code
Less code hence less no. of bugs
Readable
Higher level of abstraction due to algorithmic nature(inherited from C++)
Hardware specific procedures
Prime goal is to make you understand the significance of SystemVerilog
References
Websources:
1. 2. systemverilog/index.html 3.
Books :
Example :-reg[7:0] X[0:127]; 128 bytes of memory
Memories are dynamic in nature
Allocated at runtime
Better memory management ie,queues
Example:Logic[3:0] length[$]; an empty queue with an unbounded size of logic data type