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

网友投稿 250 2022-09-24

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

Chapter 8. Tasks and Functions

8.5 Exercises

1. Define a function to calculate the factorial of a 4-bit number. The output is a 32-bit value. Invoke the function by using stimulus and check results.

my answer:

# Factorial of 4 is 3628800

2. Define a function to multiply two 4-bit numbers a and b. The output is an 8-bit value. Invoke the function by using stimulus and check results.

my answer:

# a x b= 150

3. Define a function to design an 8-function ALU that takes two 4-bit numbers a and b and computes a 5-bit result out based on a 3-bit select signal. Ignore overflow or underflow bits.

Select Signal

Function Output

3’b000

a

3’b001

a+b

3’b010

a-b

3’b011

a/b

3’b100

a%b

3’b101

a<<1

3’b110

a>>1

3’b111

(a>b)

my answer:

4. Define a task to compute the factorial of 4-bit number. The output is a 32-bit value. The result is assigned to the output after a delay of 10 time units.

my answer:

5. Define a task to compute even parity of a 16-bit number. The result is a 1-bit value that is assigned to the output after three positive edges of clock.(Hint: Use a repeat loop in the task).

my answer:

6. Using named events, tasks, and functions, design the traffic signal controller .

my answer:

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:张译唱起“长坂坡”,我的眼泪止不住了!
下一篇:How to Install & Configure VNC Server on Ubuntu 22.04 or 20.04
相关文章

 发表评论

暂时没有评论,来抢沙发吧~