来自网站

1.网站说明-tutorial

  • This SystemVerilog tutorial is written to help engineers with background in Verilog/VHDL to get jump start in SystemVerilog design and Verification. In case you find any mistake, please do let me know. I always love to hear about mistakes in my website.

  • As such this tutorial assumes that, you are already familiar with Verilog and bit of C/C++ language. If you are not well versed with verilog, you can refer to verilog section or go through the Verilog basics tutorial below.

  • Currently this website is getting more than 3 million hits every month.

    总结就是网站帮助具有Verilog或VHDL背景的人员快速学习使用SystemVerilog来设计和验证.假想读者已经熟悉Verilog或者C/C++,否则可以先看看Verilog基础部分——verilog basic

2.SystemVerilog

  • Verilog 1995 version has been in market for a very long time. IEEE extended the features of Verilog 1995 and released it as Verilog 2001. But this was no good for verification engineers, so verifcation engineers had to use languages like "e", VERA, Testbuider. It was rather painfull to have two language, one for design and other for verification. SystemVerilog combines the Verification capabilties of HVL (Hardware Verification Language) with ease of Verilog to provide a single platform for both design and verification.

  • ==Anyone with background of C++, or OO programming language will feel at home with SystemVerilog. But on other hand if you have been thinking C or C++ is not required, then you may be shocked to know that SystemVerilog is very much like C++. ==

  • *Now IEEE has accepted the SystemVerilog, and it is called 1800-2005 standard. *

Some of the new features in SystemVerilog are as listed below.

  • C type data types like int, typedef, struct, union, enum.
  • Dynamic data types : struct, classes, dynamic queues, dynamic arrays.
  • New operators and built in methods.
  • Enhanced flow control like, foreach, return, break, continue.
  • Semaphores, mailboxes, event extensions.
  • classes for object oriented programming.面向对象编程
  • Assertions.断言
  • Coverage.覆盖
  • VPI extensions.

2.1Verilog Basic

  • 主要回顾verilog最基础的部分,为SV入门必备

Verilog介绍

  • Every new learner's dream is to understand Verilog in one day, at least enough to use it. The next few pages are my attempt to make this dream a reality. There will be some theory and examples followed by some exercises. This tutorial will not teach you how to program; it is designed for those with some programming experience. Even though Verilog executes different code blocks concurrently as opposed to the sequential execution of most programming languages, there are still many parallels. Some background in digital design is also helpful.不同于大多数编程语言,verilog语言中有许多并行执行的语句,有数字设计背景将有助于学习理解
  • Life before Verilog was a life full of schematics. Every design, regardless of complexity, was designed through schematics. They were difficult to verify and error-prone, resulting in long, tedious development cycles of design, verification... design, verification... design, verification... Verilog语言出现之前,设计中多是原理图设计,对验证和错误检测带来了很大困难,从而导致开发周期很长

When Verilog arrived, we suddenly had a different way of thinking about logic circuits. The Verilog design cycle is more like a traditional programming one, and it is what this tutorial will walk you through. **Here's how it goes: **

  • Specifications (specs) 协议
  • High level design 高层次设计
  • Low level (micro) design 低层次设计
  • RTL coding RTL代码
  • Verification 验证
  • Synthesis. 综合

2.2Specifications

For this tutorial, we'll be building a two agent arbiter: a device that selects among two agents competing for mastership. Here are some specs we might write up.

  • Two agent arbiter.
  • Active high asynchronous reset. 高电平异步复位
  • Fixed priority, with agent 0 having priority over agent 1 优先级
  • Grant will be asserted as long as request is asserted. 发出请求时输出grant断言

    Once we have the specs, we can draw the block diagram, which is basically an abstraction of the data flow through a system (what goes into or comes out of the black boxes?). Since the example that we have taken is a simple one, we can have a block diagram as shown below. We don't worry about what's inside the magical black boxes just yet.

2.3Block diagram of arbiter

  • Now, if we were designing this machine without Verilog, the standard procedure would dictate that we draw a state machine. From there, we'd make a truth table with state transitions for each flip-flop. And after that we'd draw Karnaugh maps, and from K-maps we could get the optimized circuit. This method works just fine for small designs, but with large designs this flow becomes complicated and error prone. This is where Verilog comes in and shows us another way.从顶层模块直接设计状态机容易出错,将顶层模块划分为若干子模块可以简化设计

2.4Low level design

Each of the circles represents a state that the machine can be in. Each state corresponds to an output. The arrows between the states are state transitions, labeled by the event that causes the transition. For instance, the leftmost orange arrow means that if the machine is in state GNT0 (outputting the signal that corresponds to GNT0) and receives an input of !req_0, the machine moves to state IDLE and outputs the signal that corresponds to that. This state machine describes all the logic of the system that you'll need. The next step is to put it all in Verilog.

Each of the circles represents a state that the machine can be in. Each state corresponds to an output. The arrows between the states are state transitions, labeled by the event that causes the transition. For instance, the leftmost orange arrow means that if the machine is in state GNT0 (outputting the signal that corresponds to GNT0) and receives an input of !req_0, the machine moves to state IDLE and outputs the signal that corresponds to that. This state machine describes all the logic of the system that you'll need.* The next step is to put it all in Verilog.*=详细的介绍看网站,=)

2.5两种设计方法

  • 第一种设计方法是采用状态机设计
// 方法2 采用状态机实现
module arbiter_1 (
input clk,
input reset,//high activate asynchronous
input req_0,req_1,//agent 0 having priority over agent 1
output reg gnt_0,gnt_1
); reg [2:0] state,next_state;
parameter IDLE = 3'b001,GNT0 = 3'b010,GNT1 = 3'b100;
always @(posedge clk or posedge reset) begin
if (reset) begin
state <= IDLE;
end
else begin
state <= next_state;
end
end
always @(*) begin
case (state)
IDLE: begin if(req_0==1'b1) next_state = GNT0;
else if(req_1==1'b1) next_state = GNT1;
else next_state = IDLE; end
GNT0:begin if(req_0==1'b1) next_state = GNT0;
// else if(req_1==1'b1) next_state = GNT1;
else next_state = IDLE;end
GNT1:begin if(req_1==1'b1) next_state = GNT1;
// else if(req_1==1'b1) next_state = GNT1;
else next_state = IDLE;end
default:begin next_state = IDLE; end
endcase
end always @(*) begin
if(state == GNT0)begin
gnt_0 = 1'b1;
gnt_1 = 1'b0;
end
else if(state == GNT1)begin
gnt_1 = 1'b1;
gnt_0 = 1'b0;
end
else begin
gnt_0 = 1'b0;
gnt_1 = 1'b0;
end
end endmodule
  • 在quartus II里面生成的状态图

  • 第二种采用普通写法

    // 方法2

module arbiter (
input clk,
input reset,//high activate asynchronous
input req_0,req_1,//agent 0 having priority over agent 1
output reg gnt_0,gnt_1
);
always @(posedge clk or posedge reset) begin
if (reset==1'b1) begin
gnt_0 <= 1'b0;
gnt_1 <= 1'b0;
end
else if(req_0==1'b1)begin
gnt_0 = 1'b1;
gnt_1 = 1'b0;
end
else if(req_1 == 1'b1)begin
gnt_1= 1'b1;
gnt_0= 1'b0;
end
else begin
gnt_1= 1'b0;
gnt_0= 1'b0;
end end
endmodule

verification——TestBench

  • 使用网站上写好的code去测试设计结果。测试就是对输入施加特定激励,看输出是满足期望
`timescale 1ns / 1ps
module arbiter_tb;
// 输入采用寄存器reg类型,输入采用线网类型wire
reg clock, reset, req0,req1;
wire gnt0,gnt1; // 初始化输入
initial begin
$monitor ("req0=%b,req1=%b,gnt0=%b,gnt1=%b", req0,req1,gnt0,gnt1);//检测信号
clock = 0;
reset = 0;
req0 = 0;
req1 = 0;
#5 reset = 1;
#15 reset = 0;
#10 req0 = 1;
#10 req0 = 0;
#10 req1 = 1;
#10 req1 = 0;
#10 {req0,req1} = 2'b11;
#10 {req0,req1} = 2'b00;
#10 $finish;//执行到此处结束 运行90ns停止仿真
end //周期为10ns的时钟
always begin
#5 clock = !clock;
end //例化 将驱动添加到对应模块上的输入
arbiter U0 (
.clock (clock),
.reset (reset),
.req_0 (req0),
.req_1 (req1),
.gnt_0 (gnt0),
.gnt_1 (gnt1)
); endmodule
  • 仿真图:两种写法一致

  • 附录:Verilog里面的操作符号 Operator symbol,和C很相似!

SystemVerilog Tutorial的更多相关文章

  1. SystemVerilog搭建验证平台使用DPI时遇到的问题及解决方案

    本文目的在于分享一下把DPI稿能用了的过程,主要说一下平台其他部分搭建好之后,在完成DPI相关工作阶段遇到的问题,以及解决的办法. 工作环境:win10 64bit, Questasim 10.1b ...

  2. SystemVerilog搭建APB_I2C IP 层次化验证平台

    一.前言 近期疫情严重,身为社畜的我只能在家中继续钻研技术了.之前写过一篇关于搭建FIFO验证平台的博文,利用SV的OOP特性对FIFO进行初步验证,但有很多不足之处,比如结构不够规范.验证组件类不独 ...

  3. systemverilog 字符串类型

    转载:https://blog.csdn.net/Holden_Liu/article/details/100727957 传统的Veriog仅仅支持文字表述上的字符串, 而SystemVerilog ...

  4. [翻译+山寨]Hangfire Highlighter Tutorial

    前言 Hangfire是一个开源且商业免费使用的工具函数库.可以让你非常容易地在ASP.NET应用(也可以不在ASP.NET应用)中执行多种类型的后台任务,而无需自行定制开发和管理基于Windows ...

  5. Django 1.7 Tutorial 学习笔记

    官方教程在这里 : Here 写在前面的废话:)) 以前学习新东西,第一想到的是找本入门教程,按照书上做一遍.现在看了各种网上的入门教程后,我觉得还是看官方Tutorial靠谱.书的弊端一说一大推 本 ...

  6. thrift 服务端linux C ++ 与客户端 windows python 环境配置(thrift 自带tutorial为例)

    关于Thrift文档化的确是做的不好.摸索了很久才终于把跨linux与windows跨C++与python语言的配置成功完成.以下是步骤: 1)                 Linux下环境配置 ...

  7. Hive Tutorial(上)(Hive 入门指导)

    用户指导 Hive 指导 Hive指导 概念 Hive是什么 Hive不是什么 获得和开始 数据单元 类型系统 内置操作符和方法 语言性能 用法和例子(在<下>里面) 概念 Hive是什么 ...

  8. Home / Python MySQL Tutorial / Calling MySQL Stored Procedures in Python Calling MySQL Stored Procedures in Python

    f you are not familiar with MySQL stored procedures or want to review it as a refresher, you can fol ...

  9. Using FreeMarker templates (FTL)- Tutorial

    Lars Vogel, (c) 2012, 2016 vogella GmbHVersion 1.4,06.10.2016 Table of Contents 1. Introduction to F ...

  10. Oracle Forms 10g Tutorial Ebook Download - Oracle Forms Blog

    A step by step tutorial for Oracle Forms 10g development. This guide is helpful for freshers in Orac ...

随机推荐

  1. 视图 触发器 事务 MVCC 存储过程 MySQL函数 MySQL流程控制 索引的数据结构 索引失效 慢查询优化explain 数据库设计三范式

    目录 视图 create view ... as 触发器 简介 创建触发器的语法 create trigger 触发器命名有一定的规律 临时修改SQL语句的结束符 delimiter 触发器的实际运用 ...

  2. C++进阶(unordered_set+unordered_map模拟实现)

    unordered_set unordered_set是以无特定顺序存储唯一元素的容器,并且允许根据它们的值快速检索单个元素,是一种K模型. 在unordered_set中,元素的值同时是它的key, ...

  3. [编程基础] C++多线程入门3-小心地将参数传递给线程

    原始C++标准仅支持单线程编程.新的C++标准(称为c++11或c++0x)于2011年发布.在c++11中,引入了新的线程库.因此运行本文程序需要C++至少符合c++11标准. 文章目录 3 小心地 ...

  4. UnoCSS 简化 CSS 的书写,Nice!

    CSS 样式太多,重复写 在学习 UnoCSS 之前,我提出几个问题: 你是否有过写完了 HTML 之后,跳转到 style 写 CSS 这样来回跳转的痛苦? 你是否有过不知道如何给节点取类名的痛苦( ...

  5. P1005 [NOIP2007 提高组] 矩阵取数游戏

    题目传送门 前言 今天依旧是不写高精的一天呢!(是的,这位作者又只拿了开 \(LL\) 的 \(\color{yellow}{60}\) 分) 思路描述 看到数据 \(n,m \le 80(30)\) ...

  6. 在GCP上创建Cloud SQL的三种方式(Console,gcloud,Terraform)

    1 简介 Cloud SQL 是GCP上的关系型数据库,常用的有三种方式来创建: (1) 界面操作 (2) 命令行 gcloud (3) Terraform 在开始之前,可以查看:<初始化一个G ...

  7. 记一次CVE实战挖掘记录

    CVE实战挖掘记录 前一段时间在学习代码审计,然后为了学习就开始在github上面找开源的项目进行练手学习代码审计,这样就可以获取CVE编号. 0x01 cve编号获取流程 首先登录CVE官方网站,选 ...

  8. GitHubDesktop推送报错“SSL/TLS connection failed”如何解决

    哈喽大家好,今儿提交Git的时候遇到个问题,查看了一会儿,算是解决了.这里记录一下,方便日后查看.和帮助到大家. 这篇博客后续会陆陆续续的更新内容,只要我遇到问题了,就会发上来. 报错内容: fata ...

  9. 云服务器安装Mysql之后,设置可以进行远程连接,Duplicaticate wntry '%-root' for key 'PRIMARY

    云服务器安装Mysql之后,设置可以进行远程连接 1.首先连接mysql mysql -u root -p 2.MySql5版本 GRANT ALL ON *.* TO root@'%' IDENTI ...

  10. 如何在WSL下交叉编译openwrt

    首先我们需要准备一个大小写敏感的文件夹. 然后拉取代码,并且执行代码的先决条件脚本. 注意,如果过程中某项条件不符,你可能要临时修复. 假如下图的组件判定失败(即出现ok=>fail) 那么你就 ...