没有合适的资源?快使用搜索试试~ 我知道了~
首页SystemVerilog标准2013用户手册
SystemVerilog标准2013用户手册
需积分: 41 17 下载量 115 浏览量
更新于2024-07-17
收藏 6.57MB PDF 举报
"SV用户手册.pdf,这是一本详细介绍SystemVerilog的2013年版用户手册,由IEEE(电气和电子工程师协会)发布。SystemVerilog是一种统一的硬件设计、规范和验证语言标准,主要由IEEE计算机学会的设计自动化标准委员会和IEEE标准协会企业咨询小组赞助制定。该手册是IEEE Std 1800™-2012,对2009年的版本进行了修订。"
SystemVerilog是集成电路设计和验证领域广泛使用的高级语言,它在硬件描述语言(HDL)中扮演着重要角色。以下是SystemVerilog的一些关键知识点:
1. **数据类型**:SystemVerilog提供丰富的数据类型,包括位矢量类型(bit、logic、reg)、整型(int、shortint、byte等)、枚举类型、数组、结构体、联合体以及类。
2. **并行性与并发**:SystemVerilog支持基于事件驱动的并发执行模型,通过always块(如always_comb、always_latch、always_ff)来处理时序逻辑,并使用fork-join语句实现任务并行。
3. **接口与封装**:接口(interface)允许定义一组相关的操作,便于模块间的通信。它们可以包含端口、函数、任务和其他接口,提供了一种模块间解耦的方式。
4. **类与对象**:SystemVerilog引入了面向对象编程的概念,如类、继承、多态和封装,使得代码更加模块化和可复用。
5. **约束与随机化**:系统级别的随机化和约束随机验证(CRV)是SystemVerilog的重要特性,通过`rand`关键字和`solve`语句,可以生成满足特定条件的随机测试向量。
6. **覆盖**:覆盖是SystemVerilog中用于验证覆盖率度量的关键工具,它允许开发者定义各种覆盖点和覆盖组,以确保设计在仿真中的行为得到了充分的探索。
7. **包(package)**:包是组织和重用代码的机制,它可以包含常量、类型定义、函数、任务和类。通过导入(import)语句,可以在不同的设计模块之间共享这些元素。
8. **断言(assertion)**:断言用于在设计中插入检查点,以确保在特定条件下,某些行为是正确的。这有助于在早期阶段发现潜在错误。
9. **门级建模与行为级建模**:SystemVerilog支持从简单的门级到复杂的高级行为模型的描述,可以用于设计的多层次验证。
10. **任务与函数**:任务和函数是SystemVerilog中过程语句的形式,函数不改变任何值,而任务可以有副作用。它们可以接受参数,返回值,并且可以在并行环境中使用。
11. **异常与异常处理**:SystemVerilog提供了异常处理机制,允许在遇到错误或不可预见情况时采取适当的行动。
SystemVerilog作为一种强大的硬件描述和验证语言,提供了丰富的功能,支持现代集成电路设计的复杂性和验证需求。通过深入学习和应用这些知识点,工程师可以更有效地进行硬件设计和验证工作。
xiv
Copyright © 2013 IEEE. All rights reserved.
11. Operators and expressions ............................................................................................................... 218
11.1 General................................................................................................................................. 218
11.2 Overview.............................................................................................................................. 218
11.3 Operators.............................................................................................................................. 219
11.4 Operator descriptions........................................................................................................... 223
11.5 Operands .............................................................................................................................. 243
11.6 Expression bit lengths.......................................................................................................... 247
11.7 Signed expressions............................................................................................................... 249
11.8 Expression evaluation rules .................................................................................................250
11.9 Tagged union expressions and member access.................................................................... 251
11.10 String literal expressions...................................................................................................... 253
11.11 Operator overloading ........................................................................................................... 254
11.12 Minimum, typical, and maximum delay expressions .......................................................... 256
11.13 Let construct ........................................................................................................................ 258
12. Procedural programming statements ............................................................................................... 264
12.1 General................................................................................................................................. 264
12.2 Overview.............................................................................................................................. 264
12.3 Syntax .................................................................................................................................. 264
12.4 Conditional if–else statement...............................................................................................265
12.5 Case statement ..................................................................................................................... 270
12.6 Pattern matching conditional statements ............................................................................. 275
12.7 Loop statements ................................................................................................................... 279
12.8 Jump statements................................................................................................................... 283
13. Tasks and functions (subroutines) ................................................................................................... 285
13.1 General................................................................................................................................. 285
13.2 Overview.............................................................................................................................. 285
13.3 Tasks .................................................................................................................................... 285
13.4 Functions.............................................................................................................................. 289
13.5 Subroutine calls and argument passing................................................................................ 295
13.6 Import and export functions.................................................................................................300
13.7 Task and function names .....................................................................................................300
13.8 Parameterized tasks and functions....................................................................................... 300
14. Clocking blocks ............................................................................................................................... 302
14.1 General................................................................................................................................. 302
14.2 Overview.............................................................................................................................. 302
14.3 Clocking block declaration ..................................................................................................302
14.4 Input and output skews ........................................................................................................ 304
14.5 Hierarchical expressions ...................................................................................................... 305
14.6 Signals in multiple clocking blocks ..................................................................................... 306
14.7 Clocking block scope and lifetime....................................................................................... 306
14.8 Multiple clocking blocks example....................................................................................... 306
14.9 Interfaces and clocking blocks............................................................................................. 307
14.10 Clocking block events.......................................................................................................... 308
14.11 Cycle delay: ## .................................................................................................................... 308
14.12 Default clocking................................................................................................................... 309
14.13 Input sampling ..................................................................................................................... 310
14.14 Global clocking.................................................................................................................... 311
xv
Copyright © 2013 IEEE. All rights reserved.
14.15 Synchronous events ............................................................................................................. 315
14.16 Synchronous drives.............................................................................................................. 315
15. Interprocess synchronization and communication........................................................................... 320
15.1 General................................................................................................................................. 320
15.2 Overview.............................................................................................................................. 320
15.3 Semaphores.......................................................................................................................... 320
15.4 Mailboxes............................................................................................................................. 322
15.5 Named events....................................................................................................................... 325
16. Assertions......................................................................................................................................... 330
16.1 General................................................................................................................................. 330
16.2 Overview.............................................................................................................................. 330
16.3 Immediate assertions............................................................................................................ 330
16.4 Deferred assertions .............................................................................................................. 333
16.5 Concurrent assertions overview........................................................................................... 340
16.6 Boolean expressions ............................................................................................................ 343
16.7 Sequences............................................................................................................................. 344
16.8 Declaring sequences ............................................................................................................ 348
16.9 Sequence operations ............................................................................................................ 356
16.10 Local variables..................................................................................................................... 378
16.11 Calling subroutines on match of a sequence........................................................................ 384
16.12 Declaring properties............................................................................................................. 385
16.13 Multiclock support............................................................................................................... 411
16.14 Concurrent assertions........................................................................................................... 421
16.15 Disable iff resolution ........................................................................................................... 438
16.16 Clock resolution................................................................................................................... 440
16.17 Expect statement .................................................................................................................. 445
16.18 Clocking blocks and concurrent assertions.......................................................................... 446
17. Checkers........................................................................................................................................... 448
17.1 Overview.............................................................................................................................. 448
17.2 Checker declaration ............................................................................................................. 448
17.3 Checker instantiation ........................................................................................................... 451
17.4 Context inference................................................................................................................. 454
17.5 Checker procedures.............................................................................................................. 455
17.6 Covergroups in checkers...................................................................................................... 457
17.7 Checker variables................................................................................................................. 458
17.8 Functions in checkers........................................................................................................... 464
17.9 Complex checker example................................................................................................... 464
18. Constrained random value generation ............................................................................................. 467
18.1 General................................................................................................................................. 467
18.2 Overview.............................................................................................................................. 467
18.3 Concepts and usage.............................................................................................................. 467
18.4 Random variables ................................................................................................................ 470
18.5 Constraint blocks ................................................................................................................. 472
18.6 Randomization methods ...................................................................................................... 492
18.7 In-line constraints—randomize() with................................................................................. 493
18.8 Disabling random variables with rand_mode() ................................................................... 496
18.9 Controlling constraints with constraint_mode() .................................................................. 497
xvi
Copyright © 2013 IEEE. All rights reserved.
18.10 Dynamic constraint modification......................................................................................... 498
18.11 In-line random variable control ........................................................................................... 499
18.12 Randomization of scope variables—std::randomize()......................................................... 500
18.13 Random number system functions and methods ................................................................. 501
18.14 Random stability .................................................................................................................. 503
18.15 Manually seeding randomize ............................................................................................... 505
18.16 Random weighted case—randcase ...................................................................................... 506
18.17 Random sequence generation—randsequence..................................................................... 507
19. Functional coverage......................................................................................................................... 517
19.1 General................................................................................................................................. 517
19.2 Overview.............................................................................................................................. 517
19.3 Defining the coverage model: covergroup........................................................................... 518
19.4 Using covergroup in classes ................................................................................................ 520
19.5 Defining coverage points ..................................................................................................... 522
19.6 Defining cross coverage....................................................................................................... 533
19.7 Specifying coverage options................................................................................................ 542
19.8 Predefined coverage methods .............................................................................................. 547
19.9 Predefined coverage system tasks and system functions..................................................... 549
19.10 Organization of option and type_option members .............................................................. 549
19.11 Coverage computation ......................................................................................................... 550
20. Utility system tasks and system functions ....................................................................................... 555
20.1 General................................................................................................................................. 555
20.2 Simulation control system tasks .......................................................................................... 556
20.3 Simulation time system functions........................................................................................ 556
20.4 Timescale system tasks........................................................................................................ 558
20.5 Conversion functions ........................................................................................................... 561
20.6 Data query functions............................................................................................................ 562
20.7 Array querying functions ..................................................................................................... 564
20.8 Math functions ..................................................................................................................... 566
20.9 Bit vector system functions.................................................................................................. 568
20.10 Severity tasks ....................................................................................................................... 569
20.11 Elaboration system tasks...................................................................................................... 570
20.12 Assertion control system tasks.............................................................................................571
20.13 Sampled value system functions.......................................................................................... 578
20.14 Coverage system functions ..................................................................................................579
20.15 Probabilistic distribution functions...................................................................................... 579
20.16 Stochastic analysis tasks and functions ............................................................................... 581
20.17 Programmable logic array modeling system tasks .............................................................. 583
20.18 Miscellaneous tasks and functions....................................................................................... 586
21. Input/output system tasks and system functions.............................................................................. 588
21.1 General................................................................................................................................. 588
21.2 Display system tasks............................................................................................................ 588
21.3 File input/output system tasks and system functions........................................................... 599
21.4 Loading memory array data from a file ............................................................................... 609
21.5 Writing memory array data to a file..................................................................................... 613
21.6 Command line input............................................................................................................. 614
21.7 Value change dump (VCD) files ......................................................................................... 617
xvii
Copyright © 2013 IEEE. All rights reserved.
22. Compiler directives.......................................................................................................................... 638
22.1 General................................................................................................................................. 638
22.2 Overview ............................................................................................................................. 638
22.3 `resetall................................................................................................................................. 638
22.4 `include ................................................................................................................................ 639
22.5 `define, `undef, and `undefineall ......................................................................................... 639
22.6 `ifdef, `else, `elsif, `endif, `ifndef ........................................................................................ 645
22.7 `timescale............................................................................................................................. 648
22.8 `default_nettype ................................................................................................................... 649
22.9 `unconnected_drive and `nounconnected_drive .................................................................. 650
22.10 `celldefine and `endcelldefine.............................................................................................. 650
22.11 `pragma ................................................................................................................................ 650
22.12 `line ...................................................................................................................................... 651
22.13 `__FILE__ and `__LINE__ ................................................................................................. 652
22.14 `begin_keywords, `end_keywords ....................................................................................... 653
Part Two: Hierarchy Constructs
23. Modules and hierarchy..................................................................................................................... 660
23.1 General................................................................................................................................. 660
23.2 Module definitions............................................................................................................... 660
23.3 Module instances (hierarchy)............................................................................................... 672
23.4 Nested modules.................................................................................................................... 683
23.5 Extern modules .................................................................................................................... 684
23.6 Hierarchical names .............................................................................................................. 685
23.7 Member selects and hierarchical names .............................................................................. 688
23.8 Upwards name referencing .................................................................................................. 689
23.9 Scope rules .......................................................................................................................... 692
23.10 Overriding module parameters ............................................................................................ 694
23.11 Binding auxiliary code to scopes or instances ..................................................................... 701
24. Programs .......................................................................................................................................... 705
24.1 General................................................................................................................................. 705
24.2 Overview.............................................................................................................................. 705
24.3 The program construct ......................................................................................................... 705
24.4 Eliminating testbench races .................................................................................................709
24.5 Blocking tasks in cycle/event mode..................................................................................... 709
24.6 Programwide space and anonymous programs.................................................................... 710
24.7 Program control tasks .......................................................................................................... 710
25. Interfaces.......................................................................................................................................... 711
25.1 General................................................................................................................................. 711
25.2 Overview.............................................................................................................................. 711
25.3 Interface syntax.................................................................................................................... 712
25.4 Ports in interfaces........................................................................................................
......... 716
25.5 Modports.............................................................................................................................. 717
25.6 Interfaces and specify blocks...............................................................................................723
25.7 Tasks and functions in interfaces......................................................................................... 724
25.8 Parameterized interfaces ...................................................................................................... 730
25.9 Virtual interfaces.................................................................................................................. 732
25.10 Access to interface objects................................................................................................... 737
xviii
Copyright © 2013 IEEE. All rights reserved.
26. Packages........................................................................................................................................... 738
26.1 General................................................................................................................................. 738
26.2 Package declarations............................................................................................................ 738
26.3 Referencing data in packages .............................................................................................. 739
26.4 Using packages in module headers...................................................................................... 743
26.5 Search order rules ................................................................................................................ 744
26.6 Exporting imported names from packages .......................................................................... 746
26.7 The std built-in package....................................................................................................... 747
27. Generate constructs.......................................................................................................................... 749
27.1 General................................................................................................................................. 749
27.2 Overview.............................................................................................................................. 749
27.3 Generate construct syntax.................................................................................................... 749
27.4 Loop generate constructs ..................................................................................................... 751
27.5 Conditional generate constructs........................................................................................... 755
27.6 External names for unnamed generate blocks ..................................................................... 758
28. Gate-level and switch-level modeling ............................................................................................. 760
28.1 General................................................................................................................................. 760
28.2 Overview.............................................................................................................................. 760
28.3 Gate and switch declaration syntax ..................................................................................... 760
28.4 and, nand, nor, or, xor, and xnor gates................................................................................. 766
28.5 buf and not gates .................................................................................................................. 767
28.6 bufif1, bufif0, notif1, and notif0 gates................................................................................. 768
28.7 MOS switches ...................................................................................................................... 769
28.8 Bidirectional pass switches.................................................................................................. 770
28.9 CMOS switches ................................................................................................................... 771
28.10 pullup and pulldown sources ............................................................................................... 772
28.11 Logic strength modeling ...................................................................................................... 772
28.12 Strengths and values of combined signals ........................................................................... 774
28.13 Strength reduction by nonresistive devices ......................................................................... 786
28.14 Strength reduction by resistive devices ............................................................................... 786
28.15 Strengths of net types........................................................................................................... 786
28.16 Gate and net delays .............................................................................................................. 787
29. User-defined primitives ................................................................................................................... 791
29.1 General................................................................................................................................. 791
29.2 Overview.............................................................................................................................. 791
29.3 UDP definition..................................................................................................................... 791
29.4 Combinational UDPs ........................................................................................................... 795
29.5 Level-sensitive sequential UDPs ......................................................................................... 796
29.6 Edge-sensitive sequential UDPs .......................................................................................... 796
29.7 Sequential UDP initialization .............................................................................................. 797
29.8 UDP instances...................................................................................................................... 799
29.9 Mixing level-sensitive and edge-sensitive descriptions....................................................... 800
29.10 Level-sensitive dominance ..................................................................................................801
30. Specify blocks.................................................................................................................................. 802
30.1 General................................................................................................................................. 802
30.2 Overview.............................................................................................................................. 802
剩余1314页未读,继续阅读
2021-07-21 上传
2021-10-19 上传
2021-07-21 上传
2021-07-21 上传
2021-07-21 上传
qq_18417321
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Java集合ArrayList实现字符串管理及效果展示
- 实现2D3D相机拾取射线的关键技术
- LiveLy-公寓管理门户:创新体验与技术实现
- 易语言打造的快捷禁止程序运行小工具
- Microgateway核心:实现配置和插件的主端口转发
- 掌握Java基本操作:增删查改入门代码详解
- Apache Tomcat 7.0.109 Windows版下载指南
- Qt实现文件系统浏览器界面设计与功能开发
- ReactJS新手实验:搭建与运行教程
- 探索生成艺术:几个月创意Processing实验
- Django框架下Cisco IOx平台实战开发案例源码解析
- 在Linux环境下配置Java版VTK开发环境
- 29街网上城市公司网站系统v1.0:企业建站全面解决方案
- WordPress CMB2插件的Suggest字段类型使用教程
- TCP协议实现的Java桌面聊天客户端应用
- ANR-WatchDog: 检测Android应用无响应并报告异常
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功