1 / 15

Verilog Tutorial

Verilog Tutorial. Outline. Numbers(A.2.7) Vectors in Verilog (Section 4.1.7) Four value logic (Section 4.2.1) Comments and White Space (A.2.2) Test Methodology (Section 4.2.2) Propagation Delay (Section 4.3 ). Number Format. N’Bvalue N is the size in bits

shaun
Download Presentation

Verilog Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Verilog Tutorial

  2. Outline • Numbers(A.2.7) • Vectors in Verilog (Section 4.1.7) • Four value logic (Section 4.2.1) • Comments and White Space (A.2.2) • Test Methodology (Section 4.2.2) • Propagation Delay (Section 4.3)

  3. Number Format • N’Bvalue • N is the size in bits • If the size is not known, the number is assumed to have as many bits as the expression in which it is being used. Zeros are automatically padded on the front to bring it up to full size. • B is the base • ‘b for binary (base 2) • ‘o for octal (base 8) • ‘d for decimal (base 10) • ‘h for hexadecimal (base 16) • If the base is omitted, the base defaults to decimal • value gives the value

  4. Numbers • 3’b101 • 3 bits, binary, 101 • ‘b11 • 000…0011 • 8’b11 • 00000011 • 8’hAB • 10101011

  5. Vector in Verilog • A vector in Verilog is denoted by square brackets, enclosing a contiguous range of bits. • e.g. sum[3:0] • The leftmost index in the bit range is the most significant bit • The rightmost index is the least significant bit

  6. A Vector Example • vect_word[7:0]=00000100 • vect_word[2]=1 • vect_word[3:0]=0100 ↔4 • vect_word[5:1]=00010↔2

  7. Four-Value Logic • 0 • 1 • X • Represents a condition of ambiguity • X happens when a net is driven by two primitives that have opposing output values • Z • Three state primitives produce an output value of Z when they are not enabled. • Great care must be taken to ensure that a bus does not have contending drivers active at the same time.

  8. Modeling Tip • A verilog simulator assigns an initial value of z to all nets, which then inherit the value of their drivers. • A simulator assigns an initial value of x to variables that have type reg.

  9. Example

  10. Comments • A pair of slashes • // comment • Forms a comment from the text that follows it on the same line • /* */ • /* comment */

  11. Test Methodology • Organization • Stimulus Generator • UUT • Response Monitor

  12. A Sample Test Bench

  13. Output

  14. Propagation Delay • Physical logic gates have a propagation delay between the time that an input changes and the time that the output responds to the change. • The primitives in verilog have a default propagation delay of 0. • Use 0 delay to verify functionality of a model quickly. • Use a unit delay to expose the time sequence of signal activity, which can be masked by a 0-delay simulation • Circuit designers do not attempt to create accurate gate level timing model of a circuit by manual methods. Instead, they rely on a synthesis tool to implement a design that will satisfy timing constraints.

  15. Add Propagation Delay

More Related