没有合适的资源?快使用搜索试试~ 我知道了~
首页systemverilog for verification 绿皮书第三版(最新)课后习题答案.pdf
systemverilog for verification 绿皮书第三版(最新)课后习题答案.pdf
需积分: 5 85 下载量 176 浏览量
更新于2023-04-28
评论 7
收藏 1.47MB PDF 举报
systemverilog for verification 绿皮书第三版(最新)课后习题答案.pdf
资源详情
资源评论
资源推荐
©Greg Tumbush, ©Chris Spear 2011 Page 1 of 63 Solutions Manual v1.2
This manual contains solutions to Exercises at the end of each chapter.
Table of Contents
1 Solution to Exercises for Chap 1 Verification Guidelines ...................................................................... 2
2 Solution to Exercises for Chap 2 Data Types ......................................................................................... 4
3 Solution to Exercises for Chap 3 Procedural Statements and Routines ............................................. 12
4 Solution to Exercises for Chap 4 Connecting the Testbench and Design ........................................... 16
5 Solution to Exercises for Chap 5 Basic OOP ........................................................................................ 20
6 Solution to Exercises for Chap 6 Randomization ................................................................................ 28
7 Solution to Exercises for Chap 7 Threads and Interprocess Communication ..................................... 38
8 Solution to Exercises for Chap 8 Advanced OOP and Testbench Guidelines ...................................... 46
9 Solution to Exercises for Chap 9 Functional Coverage........................................................................ 53
10 Solution to Exercises for Chap 10 Advanced Interfaces.................................................................. 57
11 Solution to Exercises for Chap 11 A Complete SystemVerilog Testbench ...................................... 63
12 Solution to Exercises for Chap 12 Interfacing with C ...................................................................... 66
©Greg Tumbush, ©Chris Spear 2011 Page 2 of 63 Solutions Manual v1.2
1 Solution to Exercises for Chap 1 Verification Guidelines
1. Write a verification plan for an Arithmetic Logic Unit (ALU) with:
Asynchronous active high input reset
Input clock
4-bit signed inputs, A and B
5-bit signed output C that is registered on the positive edge of input clock.
4 opcodes
o Add: A+B
o Sub: A-B
o Bitwise invert A
o reduction OR B
Solution: There are many solutions to this Exercise. One possible solution is:
Check reset value of output C.
Apply all permutations of max pos, max neg, and 0 to the add and subtract opcodes
Apply 0 and all 1’s to A for bitwise invert input A opcode. Set B to non-all 0 and non-all 1.
Apply 0, all 1’s, and walking 1’s to B for ReductionOR_B opcode. Set A to a value that will yield
the opposite result of B, i.e. if the expected value of B =1, set A to a value so that the bitwise
invert is 0.
Assert reset when output C is 5’b11111.
2. What are the advantages and disadvantages to testing at the block level? Why?
Solution: The advantages of verifying at the block level are speed of execution due to the small
amount of circuitry being simulated, ease of debug, again, due to the small amount of circuitry
being simulated, and excellent control because the testbench has direct control of the I/O of the
block.
The first disadvantage to verifying at the block level is testbench complexity if a block has many
interfaces. The testbench can be very complex because all of these interfaces must be modeled.
Another disadvantage is simply that the system is not being tested, just individual blocks. There
is no guarantee that when all the verified blocks are integrated that they will implement the
specification.
3. What are the advantages and disadvantages to testing at the system level? Why?
Solution: The advantage of verifying at the system level is that the final system is being tested
and results can be compared directly to the specification. A system level testbench can be
©Greg Tumbush, ©Chris Spear 2011 Page 3 of 63 Solutions Manual v1.2
simpler than a block level testbench if the interfaces are few and simple and the checking
mechanism is simple.
The disadvantages of verifying at the system level are speed of execution due to the large
amount of circuitry being simulated, difficulty of debug due to the many layers of circuitry and
complex interaction between circuits, and poor control because the testbench has to traverse
many layers of circuitry to manipulate a particular signal.
4. What are the advantages and disadvantages to directed testing? Why?
Solution: The advantages to directed testing are fast testbench development time because no
complex scoreboard or reference model is required, linear progress because each test takes a
similar amount of time to write, and popularity of management because steady progress is being
made.
The disadvantages to directed testing is that bugs are easy to miss because corner cases are not
tested. Random testing finds corner cases that the verification engineer never thought about.
5. What are the advantages and disadvantages to constrained random testing? Why?
Solution: The advantages to constrained random testing are shorter total verification time due
to better than linear progress, ease of maintenance because if the specification changes only the
scoreboard or reference model needs to change, and a methodology that is reusable and scales
to larger designs.
The disadvantages are that initially no verification is being done due to a more complex
testbench being developed.
©Greg Tumbush, ©Chris Spear 2011 Page 4 of 63 Solutions Manual v1.2
2 Solution to Exercises for Chap 2 Data Types
1. Given the following code sample:
a) What is the range of values my_byte can take?
Solution: my_byte ranges from -128 (-(2
7
)) to 127 (2
7
-1) because my_byte is of 8-bit
signed type.
b) What is the value of my_int in hex?
Solution: my_int is 32’h0000_0F00 because the X’s and Z’s in 4-state my_integer resolve
to 0 when assigned to 2-state my_int.
c) What is the value of my_bit in decimal?
Solution: my_bit is 32768 because my_bit is not signed
d) What is the value of my_short_int1 in decimal?
Solution: my_short_int1 is -32768 because my_short_int1 is signed
e) What is the value of my_short_int2 in decimal?
Solution: my_short_int2 is 32767 because it has wrapped from max_neg to max_pos
See Chap_2_Data_Types/exercise1 for code.
2. Given the following code sample:
byte my_byte;
integer my_integer;
int my_int;
bit [15:0] my_bit;
shortint my_short_int1;
shortint my_short_int2;
my_integer = 32’b000_1111_xxxx_zzzz;
my_int = my_integer;
my_bit = 16’h8000;
my_short_int1= my_bit;
my_short_int2 = my_short_int1-1;
©Greg Tumbush, ©Chris Spear 2011 Page 5 of 63 Solutions Manual v1.2
Evaluate in order:
a) my_mem[2] = my_logicmem[4];
Solution: my_mem = {A5, A5, 0} because reading from an out of bounds 4-valued type
returns an X but it is resolved to a 0 when assigned to 2-value logic.
b) my_logic = my_logicmem[4];
Solution: my_logic = 4’hxbecause reading from an out of bounds 4-valued type returns
an X
c) my_logicmem[3] = my_mem[3];
Solution: my_logicmem= {0,1,2,0} because reading from an out of bounds 2-value type
returns a 0
d) my_mem[3] = my_logic;
Solution: my_mem does not change since the write to my_mem[3] is out of range.
e) my_logic = my_logicmem[1];
Solution: my_logic = 1 since my_logicmem[1] = 1
f) my_logic = my_mem[1];
Solution: my_logic = 4’h5 since my_mem[1] = 8’hA5 but my_logic is only 4-bits wide
g) my_logic = my_logicmem[my_logicmem[4]];
Solution: my_logic =4’h x since my_logicmem[4] returns an X since the index is out of
bounds. my_logicmem[x] = x.
See Chap_2_Data_Types/exercise2 for code.
3. Write the SystemVerilog code to:
a) Declare a 2-state array, my_array, that holds four 12-bit values
b) initialize my_array so that:
my_array[0] = 12’h012
bit [7:0] my_mem [3];
logic [3:0] my_logicmem [4];
logic [3:0] my_logic;
my_mem = '{default:8'hA5};
my_logicmem = '{0,1,2,3};
my_logic = 4’hF;
剩余62页未读,继续阅读
llxxyy507
- 粉丝: 185
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0