4
缘木求鱼   天书奇谭 埋头求术,抬头问道。 【原创】The solutional manual of the Verilog HDL: A Guide to Digital Design and Synthesis (2nd)--ch06 Chapter 6. Dataflow Modeling 6.7 Exercises 1. A full subtractor has three 1-bit inputs x,y,and z(previou s borrow) and two 1-bit outputs D(difference) and B(borrow). The logic equations for D and B are as follows: D=x’.y’.z + x’.y.z’ + x.y’.z’ + x.y.z B=x’.y + x’.z + y.z Write the full Verilog description for the substractor module, including I/O ports (Rememb er that + in logic equations corresponds to a logical or operator (||) in dataflow). Instantiate the subtractor inside a stimulus block and test all eight possible combinations of x,y,and z given in the following truth table. X Y Z B D 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 1 1 my answer: 2. A magnitude comparator checks if one number is greater than or equal to or less than another number . A 4-bit magnitude compar ator takes two 4-bit numbers, A and B, as input. We write the bits in A and B as follows. The l eftmost bit < 20113 > 27 28 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 2 3 4 5 6 7 8 9 导航 博客园 首页 新随笔 联系 订阅 管理 统计 随笔 - 140 文章 - 0 评论 - 154 引用 - 0 公告 昵称:yf.x 园龄:511个月 粉丝:94 关注:2 +加关注 搜索  找找看  谷歌搜索 常用链接 我的随笔 我的评论 我的参与 最新评论 我的标签 随笔分类 (265) Analog electrics(21) DE2(34) Digital Logic(53) Java(22) lightroom(1) Linux(3) ModelSim(6) Nios II(4) office(19) Quartus II(39) shooting(1) SOPC(4) Verilog HDL(58) 随笔档案 (140) 201411 (9) 201212 (1) 201112 (1) 201110 (1) 20118 (1) 20117 (8) 20116 (20) 20115 (11) 20114 (16) 20113 (25) 20112 (1) 201012 (10) 201011 (11) 20109 (2) 20107 (1) 20106 (2) 20105 (2) 20104 (6) 20103 (12) 相册 (1) Qii_tutorial(1) fpga .COM 缺氧®(张亚峰) cainong ilove314 ouxiang chna fpga4fun ni_labview riple 积分与排名 【原创】The solu tio na l ma nual o f the Ver ilo g HDL: A Gui de t o Di git al ... htt p: //www .cnblog s.com/ halfl if e/ arc hi ve/20 11/0 3/ 15/ 1985277. ht ml 1 of 4 2/19/2016 2:14 PM

Chapter5 Solution Manual Verilog Samir Palnitkar

Embed Size (px)

Citation preview

Page 1: Chapter5 Solution Manual Verilog Samir Palnitkar

7/24/2019 Chapter5 Solution Manual Verilog Samir Palnitkar

http://slidepdf.com/reader/full/chapter5-solution-manual-verilog-samir-palnitkar 1/4

缘木求鱼 之 天书奇谭埋头求术,抬头问道。

【原创】The solutional manual of the Verilog HDL: A Guide to Digital Design and Synthesis (2nd)--ch06

Chapter 6. Dataflow Modeling

6.7 Exercises

1. A full subtractor has three 1-bit inputs x,y,and z(previous borrow) and two 1-bit outputs D(difference) and B(borrow).

The logic equations for D and B are as follows:

D=x’.y’.z + x’.y.z’ + x.y’.z’ + x.y.z

B=x’.y + x’.z + y.z

Write the full Verilog description for the substractor module, including I/O ports (Remember that + in logic equations

corresponds to a logical or operator (||) in dataflow). Instantiate the subtractor inside a stimulus block and test all eight

possible combinations of x,y,and z given in the following truth table.

X Y Z B D

0 0 0 0 0

0 0 1 1 1

0 1 0 1 1

0 1 1 1 0

1 0 0 0 1

1 0 1 0 0

1 1 0 0 0

1 1 1 1 1

my answer:

2. A magnitude comparator checks if one number is greater than or equal to or less than another number. A 4-bit

magnitude comparator takes two 4-bit numbers, A and B, as input. We write the bits in A and B as follows. The leftmost bit

< 2011年3月   >

日 一 二 三 四 五 六

27 28 1 2 3 4 5

6 7 8 9 10 11 12

13 14 15 16 17 18 19

20 21 22 23 24 25 26

27 28 29 30 31 1 2

3 4 5 6 7 8 9

导航

博客园

首页新随笔

联系

订阅

管理

统计

随笔 - 140

文章 - 0

评论 - 154

引用 - 0

公告

昵称:yf.x

园龄:5年11个月

粉丝:94

关注:2

+加关注

搜索

  找找看

  谷歌搜索

常用链接

我的随笔

我的评论

我的参与

最新评论

我的标签

随笔分类(265)

Analog electrics(21)

DE2(34)

Digital Logic(53)

Java(22)

lightroom(1)

Linux(3)

ModelSim(6)

Nios II(4)

office(19)

Quartus II(39)

shooting(1)

SOPC(4)

Verilog HDL(58)

随笔档案(140)

2014年11月 (9)

2012年12月 (1)

2011年12月 (1)

2011年10月 (1)

2011年8月 (1)

2011年7月 (8)

2011年6月 (20)

2011年5月 (11)

2011年4月 (16)

2011年3月 (25)

2011年2月 (1)

2010年12月 (10)

2010年11月 (11)

2010年9月 (2)

2010年7月 (1)

2010年6月 (2)2010年5月 (2)

2010年4月 (6)

2010年3月 (12)

相册(1)

Qii_tutorial(1)

fpga

.COM缺氧®(张亚峰)

cainong

ilove314

ouxiang

chna

fpga4fun

ni_labview

riple

积分与排名

创】The solutional manual of the Verilog HDL: A Guide to Digital... http://www.cnblogs.com/halflife/archive/2011/03/15/1985

2/19/2016

Page 2: Chapter5 Solution Manual Verilog Samir Palnitkar

7/24/2019 Chapter5 Solution Manual Verilog Samir Palnitkar

http://slidepdf.com/reader/full/chapter5-solution-manual-verilog-samir-palnitkar 2/4

is the most significant bit.

A=A(3)A(2)A(1)A(0)

B=B(3)B(2)B(1)B(0)

The magnitude can be compared by comparing the numbers bit by bit, starting with the most significant bit. If any bit

mismatches, the number with bit 0 is the lower number. To realize this functionality in logic equations, let us define an

intermediate variable. Notice that the function below is an xnor function.

x(i)=A(i)B(i)+A(i)’B(i)’ 

The three outputs of the magnitude comparator are A_gt_B,A_lt_B,A_eq_B. They are define with the following logic

equations:

A_gt_B=A(3)B(3)’  + x(3).A(2).B(2)' + x(3).x(2).A(1).B(1)' + x(3).x(2).x(1).A(0).B(0)' 

 A_lt_B = A(3)'.B(3) + x(3).A(2)'.B(2) + x(3).x(2).A(1)'.B(1) + x(3).x(2).x(1).A(0)'.B(0)

 A_eq_B = x(3).x(2).x(1).x(0)

Write the Verilog description of the module magnitude_comparator. Instantiate the magnitude comparator inside the

stimulus module and try out a few combinations of A and B.

my answer:

3. A synchronous counter can be designed by using master-slave JK flipflops. Design a 4-bit synchronous counter. Circuit

diagrams for the synchronous counter and the JK flipflop are given below. The clear signal is active low. Data gets latched

on the positive edge of clock, and the output of the flipflop appears on the negative edge of clock. Counting is disabled

when count_enable signal is low. Write the dataflow description for the synchronous counter. Write a s timulus file that

exercises clear and count_enable. Display the output count Q[3:0].

积分 - 35170

排名 - 6269

最新评论

1. Re:【原创】DE2实验解答—lab09

(Quartus II)(Verilog HDL)(Digital Logic)

楼主请问partII代码是不是少了一部分

--风暴哇咔咔

2. Re:【黑金教程笔记之008】【建模篇】

【Lab 07 数码管电路驱动】—笔记

有个问题是 /10和%10在很多环境不可综

合……

--fgg1991

3. Re:(原创)多功能数字钟(Digital Logic)

(DE2)(QuartusII)

为什么时间输出用了八个东西?不是用的七段管么?

--skyadmin

4. Re:【黑金教程笔记之003】【建模篇】

【Lab 02 闪耀灯和流水灯】—笔记

@辛MM添加观察节点的时候,不重复勾选即

可。...

--yf.x

5. Re:【黑金教程笔记之003】【建模篇】

【Lab 02 闪耀灯和流水灯】—笔记

@yf.x另外,确实,加与不加在RTL视图上没

有区别。...

--辛MM

6. Re:【黑金教程笔记之003】【建模篇】

【Lab 02 闪耀灯和流水灯】—笔记

@yf.x我用的ALTERA-MODERSIM 10.0,版

本会有影响么?因为确实出现了这个问题,不

过没有在开发板里实验。...

--辛MM

7. Re:【黑金教程笔记之003】【建模篇】

【Lab 02 闪耀灯和流水灯】—笔记@辛MM主要是一种代码风格,统一端口就只

做端口,最后用wire或reg类型的中间变量赋

值。不影响仿真的。...

--yf.x

8. Re:【黑金教程笔记之003】【建模篇】

【Lab 02 闪耀灯和流水灯】—笔记

请教~~~

MIX_MODULE里面最后两句assign赋值是什

么作用?当我加上这两句的时

候,MODELSIM仿真不出结果,注释掉了就

好了。

--辛MM

9. Re:【原创】如何使用DE2的1602LCD --

之一(quartus)(verilog)(digital

logic)

@xiewen221这就是非阻塞赋值的作用了 ...

--soc泉

10. Re:【原创】The solutional manual of 

the Verilog HDL: A Guide to Digital

Design and Synthesis (2nd)--ch06太感谢了 那个6.6的图的错误比较坑

顺便请教ms_jk模块里面的赋值语句 为什么用

unblock会报错呢?

--fgg1991

阅读排行榜

1. 【翻译】Quartus II里如何仿真(6549)

2. (原创)如何在Quartus II里查看综合器

生成的原理图(Quartus II)(5938)

3. 【原创】DE2 实验练习解答—lab 3:锁存

器、触发器和寄存器(digital Logic)

(DE2)(quartus II)(3312)

4. [笔记]模电--如何判断和识别二极管的正负

极(3247)

5. 【原创】DE2 实验练习解答—lab 2:数字

和显示(digital Logic)(DE2)(3199)

6. (翻译)Altera SOPC Builder 指南

(SOPC)(DE2)(3151)

7. (原创) DE2 实验练习解答—lab 1

(Digital Logic) (DE2) (Quartus II)(2850)

8. 【原创】如何使用DE2的1602LCD --之一

(quartus)(verilog)(digital logic)

(2571)

9. 【翻译】在Verilog设计中使用参数化模块

库(Quartus II)(Verilog)(2514)

10. 【翻译】基于Verilog设计的时序注意事项

【Quartus II】【Digital

Logic】(2499)

评论排行榜

1. 【原创】DE2 实验练习解答—lab 2:数字

和显示(digital Logic)(DE2)(30)

2. (翻译)Altera Monitor Program 指南

(SOPC)(DE2)(14)

3. 【原创】DE2实验解答—lab7 (Quartus

II)(Digital Logic)(Verilog HDL)(14)

4. 【原创】基于Altera DE2的数字实验—

001_1 (DE2)(Digital Logical)

创】The solutional manual of the Verilog HDL: A Guide to Digital... http://www.cnblogs.com/halflife/archive/2011/03/15/1985

2/19/2016

Page 3: Chapter5 Solution Manual Verilog Samir Palnitkar

7/24/2019 Chapter5 Solution Manual Verilog Samir Palnitkar

http://slidepdf.com/reader/full/chapter5-solution-manual-verilog-samir-palnitkar 3/4

my answer:

(ps:图6.6有 错误J)

(Verilog)(8)

5. (原创) DE2 实验练习解答—lab 1

(Digital Logic) (DE2) (Quartus II)(8)

6. 【原创】DE2 实验练习解答—lab 3:锁存

器、触发器和寄存器(digital Logic)

(DE2)(quartus II)(8)

7. (笔记)Quartus II 与 DE2 入门指导

(Digital Logic)(DE2)(7)

8. 【原创】基于Altera DE2的数字实验—

001_2 (DE2)(Digital Logical)

(Verilog)(6)

9. 【翻译】Quartus II里如何仿真(6)

10. 【黑金教程笔记之003】【建模篇】

【Lab 02 闪耀灯和流水灯】—笔记(5)

推荐排行榜

1. (翻译)Altera SOPC Builder 指南

(SOPC)(DE2)(4)

2. (原创)汽车尾灯电路设计(Digital

Logic)(DE2)(3)

3. (原创)如何在Quartus II里查看综合器

生成的原理图(Quartus II)(2)

4. 【原创】DE2 实验练习解答—lab4

counters【verilog】【digital logic】(2)

5. 【翻译】在Verilog设计中使用参数化模块

库(Quartus II)(Verilog)(2)

6. (原创)多功能数字钟(Digital Logic)

(DE2)(QuartusII)(2)

7. 【翻译】如何编写测试台--之一(2)

8. 【原创】如何使用DE2的1602LCD --之一

(quartus)(verilog)(digital logic)(2)

9. 【翻译】ModelSim指南 IV

(ModelSim)(Verilog)

(Digital Logic)(2)

10. 【翻译】ModelSim指南 III

(ModelSIM)(Verilog)(Digital Logic)(2)

创】The solutional manual of the Verilog HDL: A Guide to Digital... http://www.cnblogs.com/halflife/archive/2011/03/15/1985

2/19/2016

Page 4: Chapter5 Solution Manual Verilog Samir Palnitkar

7/24/2019 Chapter5 Solution Manual Verilog Samir Palnitkar

http://slidepdf.com/reader/full/chapter5-solution-manual-verilog-samir-palnitkar 4/4

Reference

Smair Palnitkar, <Verilog HDL: A Guide to Digital Design and Synthesis (2 nd) >

« 上一篇:【原创】The solutional manual of the Verilog HDL: A Guide to Digital Design and Synthesis (2nd)--ch05

» 下一篇:【原创】The solutional manual of the Verilog HDL: A Guide to Digital Design and Synthesis (2nd)—ch07-I

posted on 2011-03-15 20:07 yf.x 阅读(2180)评论(1) 编辑 收藏

评论

#1楼 2015-03-20 10:43 fgg1991 

太感谢了 那个6.6的图的错误比较坑

顺便请教ms_jk模块里面的赋值语句 为什么用unblock会报错呢?

支持(0) 反对(0)

 

刷新评论 刷新页面 返回顶部

注册用户登录后才能发表评论 请

 登录

 或

 注册 访问网站首页

最新

IT新闻

:

· 地球工程能解决暖化吗?学者:全都不可行

· 20个问题揭穿冒牌数据科学家

· 婚姻保卫战:不要因各种屏幕而失去另一半

· 网络黑客的胜利?美洛杉矶医院付 17000美元的比特币赎回医网

· 揭秘成功人士的8大共同点

» 更多新闻...

最新知识库文章:

· 为什么说DOM操作很慢

· 为什么你应该尝试全栈

· 学习新东西的唯一方法

· 关于烂代码的那些事(下)

· 每个架构师都应该研究下康威定律

» 更多知识库文章...

Powered by:

博客园

Copyright © yf.x

创】The solutional manual of the Verilog HDL: A Guide to Digital... http://www.cnblogs.com/halflife/archive/2011/03/15/1985

2/19/2016