cuttlefish的个人空间 https://blog.eetop.cn/verification [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

学习SystemVerilog(一)——不学习它的理由zz

已有 2843 次阅读| 2008-10-14 13:27 |个人分类:SOC验证

   想要学习SystemVerilog已经很久了。曾经尝试通过Accellera网站上给出的LRM学习,怎奈内容众多,找不出入手点和重点,只能望而却步。虽然手头有三本SystemVerilog方面的书:《SVA应用指南》,《SystemVerilog验证方法学》和《高级验证方法学》,但是难成系统。第一本只给出了SystemVerilog在断言方面的应用,详细实用但是不全面;第二本给出了SystemVerilog在验证领域的应用,详细全面但是过于高级而不实用,很难作为入门教材;第三本也给出了验证领域的应用,详细但是不够全面,也有高级而不实用的问题。 riple

    十一放假前,从图书馆借来了两本书:SystemVerilog for Design 和SystemVerilog for Verification。利用放假的“娱余时间”通读了两本书的前言部分和前一本书的各个章节。通过读这两本书的前言部分,我对SystemVerilog有了一些整体的认识;通过读第一本书的各个章节,我对SystemVerilog的细节有了一些初步和不成熟的认识。 riple

    随着这些认识而来的是两种相反但是不矛盾的想法:不应该学SystemVerilog和应该学SystemVerilog。 riple

 

    现在来说说为什么不该学SystemVerilog。 riple

    从Verilog到SystemVerilog的发展过程来看,两种语言都有其产生的必要性。Verilog在上世纪80年代中期产生,解决了当时一万门以上设计面临的种种问题,Verilog的产生带来了门级设计到RTL级设计的变革,接下来的近20年,随着设计规模的扩大,Verilog也在不断的演变和扩展,但是抽象层次始终徘徊在RTL级别;进入90年代以后,Verilog较弱的验证能力逐渐显露出来,而Verilog的几次标准化过程都没能解决这一问题,在验证领域各种新的语言不断出现以代替Verilog;90年代后期,一个叫Co-Design的公司尝试扩展Verilog,增强其更高抽象级别的描述能力和用于的验证能力,这一工作产生了我们现在看到的SystemVerilog——HDL & HVL。 riple

    从我们当前的设计需要看,我们的设计规模是否达到了RTL抽象级别不能描述的程度?对于我这样的FPGA设计者来说(我相信看我博客的人大多是FPGA设计者),工作中使用的芯片资源不超过6000个LE,以一个LE等价于12个门电路来计算(谁说的来哉?),设计规模不过72000门。Verilog的设计描述能力足以应对我的日常工作。即使我的下一个项目规模是当前项目的10倍,我所做的工作不过是规划10个当前项目大小的模块,然后用近似10倍的工作量完成10个模块的编码,每个模块的设计仍然可以用Verilog完成。 riple

    虽然SystemVerilog提供了更高级别的抽象层次描述能力,但是目前的综合工具仍然不能支持其简单和直接的实现,还是需要人工逐级细化到RTL级别才能交给综合工具。只有ESL工具的进一步演化才能解决高层次抽象级别描述的可综合问题,而不是SystemVerilog。SystemVerilog是这一过程中可选的一种描述语言。 riple

    第一个认识是在阅读这两本书前言的过程中思考上述问题得到的:我们现在的设计规模虽然很大,但是我们能够人工实现的设计量与Verilog最初产生时的设计能力相比,仍然没有超出Verilog的设计能力,仍然是RTL级别。(这当然不是原书作者的观点,而且我得到的认识也不只这一点,其他的认识与这一点正好相反,放在下一篇。) riple

 

    通读完了SystemVerilog for Design的各个章节,我最深刻的感受是自己对Verilog语言掌握得还很不够。毕竟,Verilog是SystemVerilog的基础,而我的基础又是很差的,只够应付当前工作的需要。 riple

    这本书中提到的对Verilog的扩展和改进的大多数内容虽然很吸引人,虽然很有道理,在实际应用中也确实方便和准确了些,但是只不过是方便和准确了“一些”而已。从语言设计者的角度来说,在SystemVerilog中改进Verilog的不足是必要的,但是从语言使用者的角度来说,这些改进不是根本性的,也不是采用SystemVerilog的决定性因素。从这些内容来看,不学SystemVerilog也可以设计好数字电路。(尽管如此,这本书的另外一些内容却给出了学习SystemVerilog的必要性,这些内容我放在下一篇里。) riple

    第二个认识:对于刚刚进入逻辑设计领域的设计者来说,从工作出发,学好Verilog是必要的,学习SystemVerilog是要以学好Verilog为基础的,在Verilog的掌握和使用尚不成熟时,就强学强记SystemVerilog的高级功能是不切实际的,甚至可以说是好高骛远。 riple

 

    下面是从SystemVerilog LRM中摘抄的一段,给出了SystemVerilog对Verilog的所有扩展和增强。内容显然太丰富了些,更适合对SystemVerilog有了全面而深入认识的人士(比如语言的设计者),从归纳和总结的角度阅读,对于我这样基础薄弱的初学者来说,太具震慑力了些。 riple

SystemVerilog adds extended and new constructs to Verilog-2001, including:
— Extensions to data types for better encapsulation and compactness of code and for tighter specification
    — C data types: int, typedef, struct, union, enum
    — other data types: bounded queues, logic (0, 1, X, Z) and bit (0, 1), tagged unions for safety
    — dynamic data types: string, classes, dynamic queues, dynamic arrays, associative arrays including automatic memory management freeing users from de-allocation issues
    — dynamic casting and bit-stream casting
    — Automatic/static specification on a per variable instance basis
— Extended operators for concise description
    — Wild equality and inequality
    — built-in methods to extend the language
    — operator overloading
    — streaming operators
    — set membership
— Extended procedural statements
    — pattern matching on selection statements for use with tagged unions
    — enhanced loop statements plus the foreach statement
    — C like jump statements: return, break, continue
    — final blocks that executes at the end of simulation (inverse of initial)
    — extended event control and sequence events
— Enhanced process control
    — Extensions to always blocks to include synthesis consistent simulation semantics
    — Extensions to fork…join to model pipelines and for enhanced process control
    — Fine-grain process control
— Enhanced tasks and functions
    — C like void functions
    — pass by reference
    — default arguments
    — pass by name
    — optional arguments
    — import/export functions for DPI (Direct Programming Interface)
— Classes: Object-Oriented mechanism that provides abstraction, encapsulation, and safe pointer capabilities
— Automated testbench support with random constraints
— Interprocess communication synchronization
    — semaphores
    — mailboxes
    — event extensions, event variables, and event sequencing
— Clarification and extension of the scheduling semantics
— Cycle-Based Functionality: Clocking blocks and cycle-based attributes that help reduce development, ease maintainability, and promote reusability:
    — cycle-based signal drives and samples
    — synchronous samples
    — race-free program context
— Assertion mechanism for verifying design intent and functional coverage intent.
    — property and sequence declarations
    — assertions and Coverage statements with action blocks
— Extended hierarchy support
    — packages for declaration encapsulation with import for controlled access
    — compilation-unit scope nested modules and extern modules for separate compilation support
    — extension of port declarations to support interfaces, events, and variables.
    — $root to provide unambiguous access using hierarchical references
— Interfaces to encapsulate communication and facilitate “Communication Oriented” design
— Functional coverage
— Direct Programming Interface (DPI) for clean, efficient interoperation with other languages (C provided)
— Assertion API
— Coverage API
— Data Read API
— VPI extensions for SystemVerilog constructs
— Concurrent assertion formal semantics


点赞

发表评论 评论 (1 个评论)

回复 sunny_hua 2010-7-16 00:24
囧……

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 2

    获赞
  • 7

    评论
  • 326

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-6-11 13:59 , Processed in 0.025526 second(s), 15 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部