02-逻辑仿真工具VCS使用
逻辑仿真工具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使用的更多相关文章
- [笔记]机器学习(Machine Learning) - 02.逻辑回归(Logistic Regression)
逻辑回归算法是分类算法,虽然这个算法的名字中出现了"回归",但逻辑回归算法实际上是一种分类算法,我们将它作为分类算法使用.. 分类问题:对于每个样本,判断它属于N个类中的那个类或哪 ...
- VCS 常用命令速查
VCS是编译型Verilog模拟器,它完全支持OVI标准的Verilog HDL语言.PLI和SDF.VCS具有目前行业中最高的模拟性能,其出色的内存管理能力足以支持千万门级的ASIC设计,而其模 ...
- DDR3 IP和CIC IP仿真问题解决记录
1.更新vivado的仿真库(data/secureip和verilog和vhdl文件夹)至最新的vivado库和生成IP的版本匹配: 2.vcs编译脚本里面把仿真库地址指向匹配的仿真库版本: 3.v ...
- oracle12C--DG 状态集
一,物理备库 01,状态查询与状态详解 select switchover_status from v$database 02,状态转换到备用数据库 alter database commit to ...
- 数字IC设计工程师成长之路
学习的课程 仿真工具VCS实践学习 2019年12月9日-2019年12月23日
- 我叫Mongo,干了「查询终结篇」,值得您拥有
这是mongo第三篇"查终结篇",后续会连续更新5篇 mongodb的文章总结上会有一系列的文章,顺序是先学会怎么用,在学会怎么用好,戒急戒躁,循序渐进,跟着我一起来探索交流. 通 ...
- VCS使用学习笔记(1)——Verilog相关的仿真知识
本文主要学习Verilog的仿真特性,以及仿真器对Verilog的处理,算是对Verilog知识的增量学习.本文内容与我的另一篇博文(http://www.cnblogs.com/IClearner/ ...
- VCS使用学习笔记(0)——写在前面的话
由于毕业设计做的是数字IC相关,虽然不是纯设计,但是也有设计相关.有设计就要有仿真验证,我就趁此机会来学习一下VCS的使用吧.当然,这里只是学习其简单的逻辑仿真功能,从波形仿真到覆盖率等,基本上不涉其 ...
- ASP.NET MVC5 网站开发实践(一) - 框架(续) 模型、数据存储、业务逻辑
上次搭建好了项目框架,但还是觉得不太对劲,后来才想起来没有对开发目标进行定位,这个小demo虽然不用做需求分析,但是要实现什么效果还得明确.后来想了一下就做个最简单的网站,目标定为小公司进行展示用的网 ...
- TCP/IP详解系列 --- 概念总结02
TCP复位报文段(RST)的用途: 1.当客户端程序访问不存在的端口时,目标主机将给它发送一个复位报文段:收到复位报文段的一端应该关闭连接或者重新连接,而不能回应这个复位报文段. 2.当客户端程序向服 ...
随机推荐
- 超好用的截图软件Snipaste(包含安装包)、如何设置Snipaste开机自启
文章目录 1.设置开机自动启动 2.基本使用 链接: https://pan.baidu.com/s/1oR2qkOZl5-etPxr7kWip7Q 提取码:8888 1.设置开机自动启动 2.基本使 ...
- echarts在Vue项目中的实际运用效果图
文章目录 1.在后台系统首页中.可以根据需求制作相应的图表 2.在Vue中使用echarts的详细过程参照这个链接 1.在后台系统首页中.可以根据需求制作相应的图表 2.在Vue中使用echarts的 ...
- Pycharm和IDEA利用Git操作Github仓库
1. Git Bash 选择一个本地代码仓库文件夹:D:/Github_Code/新建文件夹,然后在此目录打开git bash 依次进行: git init //首次需执行,之后可不用 git add ...
- 一篇文章带你了解轻量级Web服务器——Nginx简单入门
一篇文章带你了解轻量级Web服务器--Nginx简单入门 Nginx是一款轻量级的Web服务器/反向代理服务器及电子邮件代理服务器 在本篇中我们会简单介绍Nginx的特点,安装,相关指令使用以及配置信 ...
- 出现The server time zone value ‘�й���ʱ��‘ is unrecognized的解决方法
使用mybatis链接数据库时出现如下错误, The server time zone value '�й���ʱ��' is unrecognized or represents more tha ...
- Vivado_8位流水灯
Design 代码中的计数器设置是因为我的开发板的时钟是100MHZ的,也就是1秒完成了100_000_000次时钟信号,所以我设置计数器为100_000_000次. 也就是说,我让流水灯的变化周期为 ...
- 「浙江理工大学ACM入队200题系列」问题 K: 零基础学C/C++84——奇偶ASCII值判断
本题是浙江理工大学ACM入队200题第八套中的K题 我们先来看一下这题的题面. 题面 题目描述 任意输入一个字符,判断其ASCII是否是奇数,若是,输出YES,否则,输出NO; 例如,字符A的ASCI ...
- day16-Servlet05
Servlet05 14.HttpServletRequest HttpServletRequest对象代表客户端的请求 当 客户端/浏览器 通过HTTP协议访问服务器时,HTTP请求头中的所有信息都 ...
- MySQL 是怎么加行级锁的?为什么一会是 next-key 锁,一会是间隙锁,一会又是记录锁?
大家好,我是小林. 是不是很多人都对 MySQL 加行级锁的规则搞的迷迷糊糊,一会是 next-key 锁,一会是间隙锁,一会又是记录锁. 坦白说,确实还挺复杂的,但是好在我找点了点规律,也知道如何如 ...
- Java 同步锁ReentrantLock与抽象同步队列AQS
AbstractQueuedSynchronizer 抽象同步队列,它是个模板类提供了许多以锁相关的操作,常说的AQS指的就是它.AQS继承了AbstractOwnableSynchronizer类, ...