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

Chapter 5. Gate-level Modeling

5.4 Exercises

1. Create your own 2-input Verilog gates called my_or, my_and and my_not from 2-input nand gates. Check the functionality of these gates with a stimulus module.

my answer:

clip_image002

clip_image004

clip_image006

2. A 2-input xor gate can be built from my_and, my_or and my_not gates. Construct an xor module in Verilog that realizes the logic function, z=xy’+x’y. Inputs are x and y, and z is the output. Write a stimulus module that exercises all four combinations of x and y inputs.

my answer:

clip_image008

clip_image010

clip_image012

3. The 1-bit full adder described in the chapter can be expressed in a sum of products form.

sum=a.b.c_in+a’.b.c_in’+a’.b’.c_in+a.b’c_in’

c_out=a.b+b.c_in+a.c_in

Assuming a,b,c_in are the inputs and sum and c_out are the outputs, design a logic circuit to implement the 1-bit full adder, using only and, not ,and or gates. Write the Verilog description for the circuit. You may use up to 4-input Verilog primitive and and or gates. Write the stimulus for the full adder and check the functionality for all input combinations.

my answer:

clip_image014

clip_image016

clip_image018

4. The logic diagram for an RS latch with delay is shown below.

clip_image020

Write the Verilog description for the RS latch. Include delays of 1 unit when instantiating the nor gates. Write the stimulus module for the RS latch, using the following table, and verify the outputs.

clip_image022

my answer:

clip_image024

clip_image026

clip_image028

5. Design a 2-to-1 multiplexer using bufif0 and bufif1 gates as shown below.

clip_image030

The delay specification for gates b1 and b2 are as follows:

 

Min

Typ

Max

Rise

1

2

3

Fall

3

4

5

Turnoff

5

6

7

Apply stimuls and test the output values.

my answer:

clip_image032

clip_image034

clip_image036

Reference

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

原文地址:https://www.cnblogs.com/halflife/p/1982867.html