逻辑仿真工具VCS使用

1 Makefile执行VCS仿真

# Makefile for simulating the full_adder.v with the simulator VCS

# ----------------------------------------------------------------------------------
# Macro variable
RTL := ./full_adder.v
TB += ./full_adder_tb.v
SEED ?= $(shell date +%s) # Target : Dependency
all : compile simulate compile:
vcs -sverilog -debug_all -timescale=1ns/1ps -l com.log simulate:
./simv -l sim.log run_dve:
dve -vpd vcdplus.vpd & clean :
rm -rf *.log csrc simv* *.key *.vpd DVEfiles coverage *.vdb # ------------------------------------------------------------------------------------
# This all_cov target is used to collect the code coverage
all_cov: compile_coverage simulate_coverage compile_coverage:
vcs -sverilog -debug_all -cm line+cond+fsm+tgl+branch \
-lca timescale.v full_adder.v full_adder_tb.v -l com.log simulate_coverage:
./simv +ntb_random_seed=$(SEED) -cm line+cond+fsm+tgl+branch \
-lca -cm.log cm.log -l sim.log report_cov:
urg -dir simv.vdb -format both -report coverage dve_cov:
dve -cov -covdir simv.vdb -lca

2 full_adder RTL

module fulladder (
// module head : verilog-2001 format
input wire a_in,
input wire b_in,
input wire c_in,
output wire sum_out,
output wire c_out
);
// method 1 Gate Level Describe
assign sum_out = a_in ^ b_in ^ c_in;
assign c_out = (a_in & b_in) | (b_in & c_in) | (c_in & a_in); // method 2 RTL design for Adder with the keyword "assign"
// behavior of adder can be systhesizable
// "assign" means connectivity ,which is used to describe a combinational circuit
// assign {c_out,sum_out} = a_in + b_in + c_in; // method 3 RTL design for Adder with the keyword "always"
//reg c_out,sum_out
//always @ (a_in,b_in,c_in) begin endmodule

3 Testbench

module full_adder_tb;

  reg ain,bin,cin; //drive the input port with the reg type
wire sumout,cout;//sample the output port with the wire type
full_adder u_full_adder(
//task 1. how to create an instance
// module head: verilog-2001 format
/*input wire*/ .a_in (ain),
/*input wire*/ .b_in (bin),
/*input wire*/ .c_in (cin), //carry in
/*output reg*/ .sum_out (sumout);
/*output reg*/ .c_out (cout) //carry out
);
// behavior of the adder can be systhesizable
// "assign" means connectivity
// assign {c_out,sum_out} = a_in + b_in + c_in; // task 2. clock and rest generator
parameter CLK_PERIOD = 20
reg clk,rest_n; // rest_n :active low initial begin
clk = 0
forever begin
#(CLK_PERIOD/2) clk = ~clk
end
end initial begin
reset_n = 0;
#100
reset_n = 1;
end //taske 3. drive the stimulus and capture the response
//Here is a testcase
initial begin
#110 ain=0;
bin=0;
cin=0; //00
#20 ain=0;
bin=1;
cin=0; //01
#20 ain=1;
bin=0;
cin=0; //01
#20 ain=1;
bin=1;
cin=0; //01
#20 ain=0;
bin=1;
cin=0; //01
#20 ain=1;
bin=0;
cin=0; //01
#20 ain=1;
bin=1;
cin=0; //10
#20 ain=0;
bin=0;
cin=1; //01
#20 ain=0;
bin=1;
cin=1; //10
#20 ain=0;
bin=0;
cin=1; //01
#20 ain=0;
bin=1;
cin=1; //10
#20 ain=1;
bin=0;
cin=1; //10
#20 ain=1;
bin=1;
cin=1; //11
#50 finish; // Here is a system task which can stop the simulation
end //task 4. check the result
always @ (posedge clk) begin
if (!reset_n) begin
$dispaly("%t:%m:restting...",$time) // counter 5 clock
end
else begin
$dispaly("%t:%m:restting finish!",$time) // the 6th clock
end
end initial begin
#115 if ({cout,simout} != 2'b00) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b01) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b01) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b10) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b01) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b10) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b10) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
#20 if ({cout,simout} != 2'b11) $display("Error:{cout,sumout}=%b,ain=%b,bin=%b,cin=%b",{cout,sumout},ain,bin,cin);
end //task 5. dump waveform with the comiple option -debug_all
initial begin
$vcdpluson
end
endmodule

02-逻辑仿真工具VCS使用的更多相关文章

  1. [笔记]机器学习(Machine Learning) - 02.逻辑回归(Logistic Regression)

    逻辑回归算法是分类算法,虽然这个算法的名字中出现了"回归",但逻辑回归算法实际上是一种分类算法,我们将它作为分类算法使用.. 分类问题:对于每个样本,判断它属于N个类中的那个类或哪 ...

  2. VCS 常用命令速查

      VCS是编译型Verilog模拟器,它完全支持OVI标准的Verilog HDL语言.PLI和SDF.VCS具有目前行业中最高的模拟性能,其出色的内存管理能力足以支持千万门级的ASIC设计,而其模 ...

  3. DDR3 IP和CIC IP仿真问题解决记录

    1.更新vivado的仿真库(data/secureip和verilog和vhdl文件夹)至最新的vivado库和生成IP的版本匹配: 2.vcs编译脚本里面把仿真库地址指向匹配的仿真库版本: 3.v ...

  4. oracle12C--DG 状态集

    一,物理备库 01,状态查询与状态详解 select switchover_status from v$database 02,状态转换到备用数据库 alter database commit to ...

  5. 数字IC设计工程师成长之路

    学习的课程 仿真工具VCS实践学习 2019年12月9日-2019年12月23日

  6. 我叫Mongo,干了「查询终结篇」,值得您拥有

    这是mongo第三篇"查终结篇",后续会连续更新5篇 mongodb的文章总结上会有一系列的文章,顺序是先学会怎么用,在学会怎么用好,戒急戒躁,循序渐进,跟着我一起来探索交流. 通 ...

  7. VCS使用学习笔记(1)——Verilog相关的仿真知识

    本文主要学习Verilog的仿真特性,以及仿真器对Verilog的处理,算是对Verilog知识的增量学习.本文内容与我的另一篇博文(http://www.cnblogs.com/IClearner/ ...

  8. VCS使用学习笔记(0)——写在前面的话

    由于毕业设计做的是数字IC相关,虽然不是纯设计,但是也有设计相关.有设计就要有仿真验证,我就趁此机会来学习一下VCS的使用吧.当然,这里只是学习其简单的逻辑仿真功能,从波形仿真到覆盖率等,基本上不涉其 ...

  9. ASP.NET MVC5 网站开发实践(一) - 框架(续) 模型、数据存储、业务逻辑

    上次搭建好了项目框架,但还是觉得不太对劲,后来才想起来没有对开发目标进行定位,这个小demo虽然不用做需求分析,但是要实现什么效果还得明确.后来想了一下就做个最简单的网站,目标定为小公司进行展示用的网 ...

  10. TCP/IP详解系列 --- 概念总结02

    TCP复位报文段(RST)的用途: 1.当客户端程序访问不存在的端口时,目标主机将给它发送一个复位报文段:收到复位报文段的一端应该关闭连接或者重新连接,而不能回应这个复位报文段. 2.当客户端程序向服 ...

随机推荐

  1. Redis 常见问题-缓存穿透

    问题描述: * 针对 DB 中不存在的数据源,每次请求缓存和数据库都不存在 造成后果: * 应用服务器压力变大 * Redis 命中率大幅度降低 * `数据库压力巨增甚至 down 掉`* 该现象对于 ...

  2. 京东云开发者|经典同态加密算法Paillier解读 - 原理、实现和应用

    摘要 随着云计算和人工智能的兴起,如何安全有效地利用数据,对持有大量数字资产的企业来说至关重要.同态加密,是解决云计算和分布式机器学习中数据安全问题的关键技术,也是隐私计算中,横跨多方安全计算,联邦学 ...

  3. v-for中key的作用与原理

    一.虚拟DOM中key的作用 key是虚拟DOM对象的标识,当数据发生变化时,Vue会根据新数据生成新的虚拟DOM,随后Vue会对新虚拟DOM与旧虚拟DOM的差异进行比较. 二.如何选择key 最好使 ...

  4. Flutter 构建windows应用

    Flutter Windows 桌面端支持进入稳定版 | Flutter 中文文档 | Flutter 中文开发者网站 从2.10之后的版本,flutter已经正式支持构建windows应用.不过距离 ...

  5. 谷歌浏览器xpath获取网页按钮路径

    谷歌浏览器打开要获取的页面按下F12打开开发者工具 点击最左边的元素选择器,高亮后光标移动到对应元素框(这里只选择里层的元素,如这里要选到input级别) 点击后下方HTML会高亮显示,鼠标移动上去右 ...

  6. java学习之注解

    0x00前言 1.注解是什么: (1)可以叫做注释类型,注解是一种引用数据类型,编译后也是生成class文件 (2)提供信息给编译器: 编译器可以利用注解来探测错误和警告信息 比如 @Override ...

  7. SpringBoot启动流程源码分析

    前言 SpringBoot项目的启动流程是很多面试官面试中高级Java程序员喜欢问的问题.这个问题的答案涉及到了SpringBoot工程中的源码,也许我们之前看过别的大牛写过的有关SpringBoot ...

  8. 解决PyQt5报错defaultServiceProvider::requestService(): no service found for..

    简述 之前因为这个报错解决了很长时间,因为我之前一直是用 pip3 工具安装的 PyQt5 ,但是用 pip3 工具安装 PyQt5 后, 自己写的音乐播放器一直没有声音,而且还有不能调用 fcitx ...

  9. python3爬取CSDN个人所有文章列表页

    前言 我之前写了下载单篇文章的接口函数,结合这篇写的,就可以下载所有个人的所有文章了 代码实现 没什么技术含量就是简单的 xpath 处理,不过有意思的是有一位csdn 员工将自己的博客地址写到源码里 ...

  10. 前后端分离开发工具YAPI部署记录

    之前公司说要建立起前后端分离开发模式,而我只是刚毕业,让我负责建立起这个规范 ,虽然刚毕业还没去大厂待过,对我来说是个挑战,只能按我理解和网上的方案进行建立.在 Google 和 github 搜了好 ...